Changeset 44690 for trunk/tests/phpunit/tests/includes/helpers.php
- Timestamp:
- 01/22/2019 08:51:56 AM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/includes/helpers.php
r42343 r44690 276 276 277 277 /** 278 * @ticket 45933 279 * @dataProvider data_die_process_input 280 */ 281 public function test_die_process_input( $input, $expected ) { 282 $defaults = array( 283 'message' => '', 284 'title' => '', 285 'args' => array(), 286 ); 287 288 $input = wp_parse_args( 289 $input, 290 $defaults 291 ); 292 $expected = wp_parse_args( 293 $expected, 294 $defaults 295 ); 296 297 list( $message, $title, $args ) = _wp_die_process_input( $input['message'], $input['title'], $input['args'] ); 298 299 $this->assertSame( $expected['message'], $message ); 300 $this->assertSame( $expected['title'], $title ); 301 302 // Only check arguments that are explicitly asked for. 303 $this->assertEqualSets( $expected['args'], array_intersect_key( $args, $expected['args'] ) ); 304 } 305 306 public function data_die_process_input() { 307 return array( 308 array( 309 array( 310 'message' => 'Broken.', 311 ), 312 array( 313 'message' => 'Broken.', 314 'title' => 'WordPress › Error', 315 'args' => array( 316 'response' => 500, 317 'code' => 'wp_die', 318 'text_direction' => 'ltr', 319 ), 320 ), 321 ), 322 array( 323 array( 324 'message' => 'Broken.', 325 'title' => 'Fatal Error', 326 'args' => array( 327 'response' => null, 328 ), 329 ), 330 array( 331 'message' => 'Broken.', 332 'title' => 'Fatal Error', 333 'args' => array( 334 'response' => 500, 335 ), 336 ), 337 ), 338 array( 339 array( 340 'message' => 'More breakage.', 341 'args' => array( 342 'response' => 400, 343 'code' => 'custom_code', 344 'text_direction' => 'rtl', 345 ), 346 ), 347 array( 348 'message' => 'More breakage.', 349 'title' => 'WordPress › Error', 350 'args' => array( 351 'response' => 400, 352 'code' => 'custom_code', 353 'text_direction' => 'rtl', 354 ), 355 ), 356 ), 357 array( 358 array( 359 'message' => new WP_Error( 360 'no_access', 361 'You do not have access.', 362 array( 363 'status' => 403, 364 'title' => 'Permission Error', 365 ) 366 ), 367 ), 368 array( 369 'message' => 'You do not have access.', 370 'title' => 'Permission Error', 371 'args' => array( 372 'response' => 403, 373 'code' => 'no_access', 374 ), 375 ), 376 ), 377 ); 378 } 379 380 /** 278 381 * This test is just a setup for the one that follows. 279 382 *
Note: See TracChangeset
for help on using the changeset viewer.