diff --git tests/phpunit/includes/testcase-rest-post-type-controller.php tests/phpunit/includes/testcase-rest-post-type-controller.php
index afba4c9..1336074 100644
|
|
|
abstract class WP_Test_REST_Post_Type_Controller_Testcase extends WP_Test_REST_C
|
| 200 | 200 | } |
| 201 | 201 | |
| 202 | 202 | protected function check_get_posts_response( $response, $context = 'view' ) { |
| 203 | | $this->assertNotInstanceOf( 'WP_Error', $response ); |
| | 203 | $this->assertNotWPError( $response ); |
| 204 | 204 | $response = rest_ensure_response( $response ); |
| 205 | 205 | $this->assertEquals( 200, $response->get_status() ); |
| 206 | 206 | |
| … |
… |
abstract class WP_Test_REST_Post_Type_Controller_Testcase extends WP_Test_REST_C
|
| 232 | 232 | } |
| 233 | 233 | |
| 234 | 234 | protected function check_get_post_response( $response, $context = 'view' ) { |
| 235 | | $this->assertNotInstanceOf( 'WP_Error', $response ); |
| | 235 | $this->assertNotWPError( $response ); |
| 236 | 236 | $response = rest_ensure_response( $response ); |
| 237 | 237 | $this->assertEquals( 200, $response->get_status() ); |
| 238 | 238 | |
| … |
… |
abstract class WP_Test_REST_Post_Type_Controller_Testcase extends WP_Test_REST_C
|
| 243 | 243 | } |
| 244 | 244 | |
| 245 | 245 | protected function check_create_post_response( $response ) { |
| 246 | | $this->assertNotInstanceOf( 'WP_Error', $response ); |
| | 246 | $this->assertNotWPError( $response ); |
| 247 | 247 | $response = rest_ensure_response( $response ); |
| 248 | 248 | |
| 249 | 249 | $this->assertEquals( 201, $response->get_status() ); |
| … |
… |
abstract class WP_Test_REST_Post_Type_Controller_Testcase extends WP_Test_REST_C
|
| 256 | 256 | } |
| 257 | 257 | |
| 258 | 258 | protected function check_update_post_response( $response ) { |
| 259 | | $this->assertNotInstanceOf( 'WP_Error', $response ); |
| | 259 | $this->assertNotWPError( $response ); |
| 260 | 260 | $response = rest_ensure_response( $response ); |
| 261 | 261 | |
| 262 | 262 | $this->assertEquals( 200, $response->get_status() ); |
diff --git tests/phpunit/tests/admin/includesPost.php tests/phpunit/tests/admin/includesPost.php
index 5c080f2..a9c5f46 100644
|
|
|
class Tests_Admin_Includes_Post extends WP_UnitTestCase {
|
| 32 | 32 | $_post_data['saveasdraft'] = true; |
| 33 | 33 | |
| 34 | 34 | $_results = _wp_translate_postdata( false, $_post_data ); |
| 35 | | $this->assertNotInstanceOf( 'WP_Error', $_results ); |
| | 35 | $this->assertNotWPError( $_results ); |
| 36 | 36 | $this->assertEquals( $_post_data['post_author'], $_results['post_author'] ); |
| 37 | 37 | $this->assertEquals( 'draft', $_results['post_status'] ); |
| 38 | 38 | |
| … |
… |
class Tests_Admin_Includes_Post extends WP_UnitTestCase {
|
| 43 | 43 | $_post_data['publish'] = true; |
| 44 | 44 | |
| 45 | 45 | $_results = _wp_translate_postdata( false, $_post_data ); |
| 46 | | $this->assertNotInstanceOf( 'WP_Error', $_results ); |
| | 46 | $this->assertNotWPError( $_results ); |
| 47 | 47 | $this->assertEquals( $_post_data['post_author'], $_results['post_author'] ); |
| 48 | 48 | $this->assertEquals( 'pending', $_results['post_status'] ); |
| 49 | 49 | |
| … |
… |
class Tests_Admin_Includes_Post extends WP_UnitTestCase {
|
| 82 | 82 | $_post_data['saveasdraft'] = true; |
| 83 | 83 | |
| 84 | 84 | $_results = _wp_translate_postdata( false, $_post_data ); |
| 85 | | $this->assertNotInstanceOf( 'WP_Error', $_results ); |
| | 85 | $this->assertNotWPError( $_results ); |
| 86 | 86 | $this->assertEquals( $_post_data['post_author'], $_results['post_author'] ); |
| 87 | 87 | $this->assertEquals( 'draft', $_results['post_status'] ); |
| 88 | 88 | |
| … |
… |
class Tests_Admin_Includes_Post extends WP_UnitTestCase {
|
| 93 | 93 | $_post_data['publish'] = true; |
| 94 | 94 | |
| 95 | 95 | $_results = _wp_translate_postdata( false, $_post_data ); |
| 96 | | $this->assertNotInstanceOf( 'WP_Error', $_results ); |
| | 96 | $this->assertNotWPError( $_results ); |
| 97 | 97 | $this->assertEquals( $_post_data['post_author'], $_results['post_author'] ); |
| 98 | 98 | $this->assertEquals( 'publish', $_results['post_status'] ); |
| 99 | 99 | |
| … |
… |
class Tests_Admin_Includes_Post extends WP_UnitTestCase {
|
| 104 | 104 | $_post_data['saveasdraft'] = true; |
| 105 | 105 | |
| 106 | 106 | $_results = _wp_translate_postdata( false, $_post_data ); |
| 107 | | $this->assertNotInstanceOf( 'WP_Error', $_results ); |
| | 107 | $this->assertNotWPError( $_results ); |
| 108 | 108 | $this->assertEquals( $_post_data['post_author'], $_results['post_author'] ); |
| 109 | 109 | $this->assertEquals( 'draft', $_results['post_status'] ); |
| 110 | 110 | |
| … |
… |
class Tests_Admin_Includes_Post extends WP_UnitTestCase {
|
| 117 | 117 | $_post_data['saveasdraft'] = true; |
| 118 | 118 | |
| 119 | 119 | $_results = _wp_translate_postdata( true, $_post_data ); |
| 120 | | $this->assertNotInstanceOf( 'WP_Error', $_results ); |
| | 120 | $this->assertNotWPError( $_results ); |
| 121 | 121 | $this->assertEquals( $_post_data['post_author'], $_results['post_author'] ); |
| 122 | 122 | $this->assertEquals( 'draft', $_results['post_status'] ); |
| 123 | 123 | } |
diff --git tests/phpunit/tests/ajax/CustomizeManager.php tests/phpunit/tests/ajax/CustomizeManager.php
index 933b992..873d017 100644
|
|
|
class Tests_Ajax_CustomizeManager extends WP_Ajax_UnitTestCase {
|
| 645 | 645 | $this->assertEquals( 'changeset_lock_dismissed', $this->_last_response_parsed['data'] ); |
| 646 | 646 | |
| 647 | 647 | $_POST['dismiss_autosave'] = $_GET['dismiss_autosave'] = $_REQUEST['dismiss_autosave'] = true; |
| 648 | | $this->assertNotInstanceOf( 'WP_Error', $r ); |
| | 648 | $this->assertNotWPError( $r ); |
| 649 | 649 | $this->assertFalse( wp_get_post_autosave( $wp_customize->changeset_post_id() ) ); |
| 650 | 650 | $this->assertContains( 'Foo', get_post( $wp_customize->changeset_post_id() )->post_content ); |
| 651 | 651 | |
| … |
… |
class Tests_Ajax_CustomizeManager extends WP_Ajax_UnitTestCase {
|
| 665 | 665 | 'autosave' => true, |
| 666 | 666 | ) |
| 667 | 667 | ); |
| 668 | | $this->assertNotInstanceOf( 'WP_Error', $r ); |
| | 668 | $this->assertNotWPError( $r ); |
| 669 | 669 | $autosave_revision = wp_get_post_autosave( $wp_customize->changeset_post_id() ); |
| 670 | 670 | $this->assertInstanceOf( 'WP_Post', $autosave_revision ); |
| 671 | 671 | $this->assertContains( 'Foo', get_post( $wp_customize->changeset_post_id() )->post_content ); |
diff --git tests/phpunit/tests/customize/manager.php tests/phpunit/tests/customize/manager.php
index 80cf0c9..aad5d1f 100644
|
|
|
class Tests_WP_Customize_Manager extends WP_UnitTestCase {
|
| 495 | 495 | 'autosave' => true, |
| 496 | 496 | ) |
| 497 | 497 | ); |
| 498 | | $this->assertNotInstanceOf( 'WP_Error', $r ); |
| | 498 | $this->assertNotWPError( $r ); |
| 499 | 499 | |
| 500 | 500 | // No change to data if not requesting autosave. |
| 501 | 501 | $wp_customize = new WP_Customize_Manager( |
diff --git tests/phpunit/tests/customize/nav-menu-setting.php tests/phpunit/tests/customize/nav-menu-setting.php
index b33b17c..cf56900 100644
|
|
|
class Test_WP_Customize_Nav_Menu_Setting extends WP_UnitTestCase {
|
| 253 | 253 | |
| 254 | 254 | $term = (array) wp_get_nav_menu_object( $menu_id ); |
| 255 | 255 | $this->assertNotEmpty( $term ); |
| 256 | | $this->assertNotInstanceOf( 'WP_Error', $term ); |
| | 256 | $this->assertNotWPError( $term ); |
| 257 | 257 | $this->assertEqualSets( $post_value, wp_array_slice_assoc( $term, array_keys( $value ) ) ); |
| 258 | 258 | $this->assertEquals( $menu_id, $term['term_id'] ); |
| 259 | 259 | $this->assertEquals( $menu_id, $term['term_taxonomy_id'] ); |
diff --git tests/phpunit/tests/image/editorGd.php tests/phpunit/tests/image/editorGd.php
index 5be8fc9..fdd0e9c 100644
|
|
|
class Tests_Image_Editor_GD extends WP_Image_UnitTestCase {
|
| 476 | 476 | |
| 477 | 477 | $editor = wp_get_image_editor( $file ); |
| 478 | 478 | |
| 479 | | $this->assertNotInstanceOf( 'WP_Error', $editor ); |
| | 479 | $this->assertNotWPError( $editor ); |
| 480 | 480 | |
| 481 | 481 | $editor->load(); |
| 482 | 482 | $editor->resize( 5, 5 ); |
| … |
… |
class Tests_Image_Editor_GD extends WP_Image_UnitTestCase {
|
| 503 | 503 | |
| 504 | 504 | $editor = wp_get_image_editor( $file ); |
| 505 | 505 | |
| 506 | | $this->assertNotInstanceOf( 'WP_Error', $editor ); |
| | 506 | $this->assertNotWPError( $editor ); |
| 507 | 507 | |
| 508 | 508 | $editor->load(); |
| 509 | 509 | |
| … |
… |
class Tests_Image_Editor_GD extends WP_Image_UnitTestCase {
|
| 531 | 531 | $expected = imagecolorsforindex( $image, $rgb ); |
| 532 | 532 | |
| 533 | 533 | $editor = new WP_Image_Editor_GD( $file ); |
| 534 | | $this->assertNotInstanceOf( 'WP_Error', $editor ); |
| | 534 | $this->assertNotWPError( $editor ); |
| 535 | 535 | $editor->load(); |
| 536 | 536 | $editor->rotate( 180 ); |
| 537 | 537 | $save_to_file = tempnam( get_temp_dir(), '' ) . '.png'; |
diff --git tests/phpunit/tests/image/editorImagick.php tests/phpunit/tests/image/editorImagick.php
index fb88f33..f62ad39 100644
|
|
|
class Tests_Image_Editor_Imagick extends WP_Image_UnitTestCase {
|
| 465 | 465 | |
| 466 | 466 | $editor = new WP_Image_Editor_Imagick( $file ); |
| 467 | 467 | |
| 468 | | $this->assertNotInstanceOf( 'WP_Error', $editor ); |
| | 468 | $this->assertNotWPError( $editor ); |
| 469 | 469 | |
| 470 | 470 | $editor->load(); |
| 471 | 471 | $editor->resize( 5, 5 ); |
| … |
… |
class Tests_Image_Editor_Imagick extends WP_Image_UnitTestCase {
|
| 492 | 492 | |
| 493 | 493 | $editor = new WP_Image_Editor_Imagick( $file ); |
| 494 | 494 | |
| 495 | | $this->assertNotInstanceOf( 'WP_Error', $editor ); |
| | 495 | $this->assertNotWPError( $editor ); |
| 496 | 496 | |
| 497 | 497 | $editor->load(); |
| 498 | 498 | |
| … |
… |
class Tests_Image_Editor_Imagick extends WP_Image_UnitTestCase {
|
| 524 | 524 | |
| 525 | 525 | $image_editor = new WP_Image_Editor_Imagick( $save_to_file ); |
| 526 | 526 | $image_editor->load(); |
| 527 | | $this->assertNotInstanceOf( 'WP_Error', $image_editor ); |
| | 527 | $this->assertNotWPError( $image_editor ); |
| 528 | 528 | $image_editor->rotate( 180 ); |
| 529 | 529 | $image_editor->save( $save_to_file ); |
| 530 | 530 | |
diff --git tests/phpunit/tests/image/functions.php tests/phpunit/tests/image/functions.php
index 913fefd..cff7fc7 100644
|
|
|
class Tests_Image_Functions extends WP_UnitTestCase {
|
| 163 | 163 | $file = wp_tempnam(); |
| 164 | 164 | $ret = wp_save_image_file( $file, $img, $mime_type, 1 ); |
| 165 | 165 | $this->assertNotEmpty( $ret ); |
| 166 | | $this->assertNotInstanceOf( 'WP_Error', $ret ); |
| | 166 | $this->assertNotWPError( $ret ); |
| 167 | 167 | $this->assertEquals( $mime_type, $this->get_mime_type( $ret['path'] ) ); |
| 168 | 168 | |
| 169 | 169 | // Clean up |
| … |
… |
class Tests_Image_Functions extends WP_UnitTestCase {
|
| 205 | 205 | |
| 206 | 206 | // Make assertions |
| 207 | 207 | $this->assertNotEmpty( $ret ); |
| 208 | | $this->assertNotInstanceOf( 'WP_Error', $ret ); |
| | 208 | $this->assertNotWPError( $ret ); |
| 209 | 209 | $this->assertEquals( $mime_type, $this->get_mime_type( $ret['path'] ) ); |
| 210 | 210 | |
| 211 | 211 | // Clean up |
| … |
… |
class Tests_Image_Functions extends WP_UnitTestCase {
|
| 249 | 249 | |
| 250 | 250 | // Save the image as each file extension, check the mime type |
| 251 | 251 | $img = wp_get_image_editor( DIR_TESTDATA . '/images/canola.jpg' ); |
| 252 | | $this->assertNotInstanceOf( 'WP_Error', $img ); |
| | 252 | $this->assertNotWPError( $img ); |
| 253 | 253 | |
| 254 | 254 | $temp = get_temp_dir(); |
| 255 | 255 | foreach ( $mime_types as $ext => $mime_type ) { |
| … |
… |
class Tests_Image_Functions extends WP_UnitTestCase {
|
| 260 | 260 | $file = wp_unique_filename( $temp, uniqid() . ".$ext" ); |
| 261 | 261 | $ret = $img->save( trailingslashit( $temp ) . $file ); |
| 262 | 262 | $this->assertNotEmpty( $ret ); |
| 263 | | $this->assertNotInstanceOf( 'WP_Error', $ret ); |
| | 263 | $this->assertNotWPError( $ret ); |
| 264 | 264 | $this->assertEquals( $mime_type, $this->get_mime_type( $ret['path'] ) ); |
| 265 | 265 | unlink( $ret['path'] ); |
| 266 | 266 | } |
| … |
… |
class Tests_Image_Functions extends WP_UnitTestCase {
|
| 310 | 310 | DIR_TESTDATA . '/images/canola.jpg', |
| 311 | 311 | 0, 0, 100, 100, 100, 100 |
| 312 | 312 | ); |
| 313 | | $this->assertNotInstanceOf( 'WP_Error', $file ); |
| | 313 | $this->assertNotWPError( $file ); |
| 314 | 314 | $this->assertFileExists( $file ); |
| 315 | 315 | $image = wp_get_image_editor( $file ); |
| 316 | 316 | $size = $image->get_size(); |
| … |
… |
class Tests_Image_Functions extends WP_UnitTestCase {
|
| 334 | 334 | 0, 0, 100, 100, 100, 100, false, |
| 335 | 335 | DIR_TESTDATA . '/images/' . __FUNCTION__ . '.jpg' |
| 336 | 336 | ); |
| 337 | | $this->assertNotInstanceOf( 'WP_Error', $file ); |
| | 337 | $this->assertNotWPError( $file ); |
| 338 | 338 | $this->assertFileExists( $file ); |
| 339 | 339 | $image = wp_get_image_editor( $file ); |
| 340 | 340 | $size = $image->get_size(); |
diff --git tests/phpunit/tests/post/formats.php tests/phpunit/tests/post/formats.php
index 3b5c527..961aa98 100644
|
|
|
class Tests_Post_Formats extends WP_UnitTestCase {
|
| 15 | 15 | $this->assertFalse( $format ); |
| 16 | 16 | |
| 17 | 17 | $result = set_post_format( $post_id, 'aside' ); |
| 18 | | $this->assertNotInstanceOf( 'WP_Error', $result ); |
| | 18 | $this->assertNotWPError( $result ); |
| 19 | 19 | $this->assertInternalType( 'array', $result ); |
| 20 | 20 | $this->assertEquals( 1, count( $result ) ); |
| 21 | 21 | |
| … |
… |
class Tests_Post_Formats extends WP_UnitTestCase {
|
| 23 | 23 | $this->assertEquals( 'aside', $format ); |
| 24 | 24 | |
| 25 | 25 | $result = set_post_format( $post_id, 'standard' ); |
| 26 | | $this->assertNotInstanceOf( 'WP_Error', $result ); |
| | 26 | $this->assertNotWPError( $result ); |
| 27 | 27 | $this->assertInternalType( 'array', $result ); |
| 28 | 28 | $this->assertEquals( 0, count( $result ) ); |
| 29 | 29 | |
| 30 | 30 | $result = set_post_format( $post_id, '' ); |
| 31 | | $this->assertNotInstanceOf( 'WP_Error', $result ); |
| | 31 | $this->assertNotWPError( $result ); |
| 32 | 32 | $this->assertInternalType( 'array', $result ); |
| 33 | 33 | $this->assertEquals( 0, count( $result ) ); |
| 34 | 34 | } |
| … |
… |
class Tests_Post_Formats extends WP_UnitTestCase {
|
| 43 | 43 | $this->assertFalse( $format ); |
| 44 | 44 | |
| 45 | 45 | $result = set_post_format( $post_id, 'aside' ); |
| 46 | | $this->assertNotInstanceOf( 'WP_Error', $result ); |
| | 46 | $this->assertNotWPError( $result ); |
| 47 | 47 | $this->assertInternalType( 'array', $result ); |
| 48 | 48 | $this->assertEquals( 1, count( $result ) ); |
| 49 | 49 | // The format can be set but not retrieved until it is registered. |
| … |
… |
class Tests_Post_Formats extends WP_UnitTestCase {
|
| 56 | 56 | $this->assertEquals( 'aside', $format ); |
| 57 | 57 | |
| 58 | 58 | $result = set_post_format( $post_id, 'standard' ); |
| 59 | | $this->assertNotInstanceOf( 'WP_Error', $result ); |
| | 59 | $this->assertNotWPError( $result ); |
| 60 | 60 | $this->assertInternalType( 'array', $result ); |
| 61 | 61 | $this->assertEquals( 0, count( $result ) ); |
| 62 | 62 | |
| 63 | 63 | $result = set_post_format( $post_id, '' ); |
| 64 | | $this->assertNotInstanceOf( 'WP_Error', $result ); |
| | 64 | $this->assertNotWPError( $result ); |
| 65 | 65 | $this->assertInternalType( 'array', $result ); |
| 66 | 66 | $this->assertEquals( 0, count( $result ) ); |
| 67 | 67 | |
| … |
… |
class Tests_Post_Formats extends WP_UnitTestCase {
|
| 75 | 75 | $this->assertFalse( has_post_format( '', $post_id ) ); |
| 76 | 76 | |
| 77 | 77 | $result = set_post_format( $post_id, 'aside' ); |
| 78 | | $this->assertNotInstanceOf( 'WP_Error', $result ); |
| | 78 | $this->assertNotWPError( $result ); |
| 79 | 79 | $this->assertInternalType( 'array', $result ); |
| 80 | 80 | $this->assertEquals( 1, count( $result ) ); |
| 81 | 81 | $this->assertTrue( has_post_format( 'aside', $post_id ) ); |
| 82 | 82 | |
| 83 | 83 | $result = set_post_format( $post_id, 'standard' ); |
| 84 | | $this->assertNotInstanceOf( 'WP_Error', $result ); |
| | 84 | $this->assertNotWPError( $result ); |
| 85 | 85 | $this->assertInternalType( 'array', $result ); |
| 86 | 86 | $this->assertEquals( 0, count( $result ) ); |
| 87 | 87 | // Standard is a special case. It shows as false when set. |