Make WordPress Core

Ticket #42065: 42065.diff

File 42065.diff, 14.3 KB (added by birgire, 8 years ago)
  • tests/phpunit/includes/testcase-rest-post-type-controller.php

    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  
    200200        }
    201201
    202202        protected function check_get_posts_response( $response, $context = 'view' ) {
    203                 $this->assertNotInstanceOf( 'WP_Error', $response );
     203                $this->assertNotWPError( $response );
    204204                $response = rest_ensure_response( $response );
    205205                $this->assertEquals( 200, $response->get_status() );
    206206
    abstract class WP_Test_REST_Post_Type_Controller_Testcase extends WP_Test_REST_C  
    232232        }
    233233
    234234        protected function check_get_post_response( $response, $context = 'view' ) {
    235                 $this->assertNotInstanceOf( 'WP_Error', $response );
     235                $this->assertNotWPError( $response );
    236236                $response = rest_ensure_response( $response );
    237237                $this->assertEquals( 200, $response->get_status() );
    238238
    abstract class WP_Test_REST_Post_Type_Controller_Testcase extends WP_Test_REST_C  
    243243        }
    244244
    245245        protected function check_create_post_response( $response ) {
    246                 $this->assertNotInstanceOf( 'WP_Error', $response );
     246                $this->assertNotWPError( $response );
    247247                $response = rest_ensure_response( $response );
    248248
    249249                $this->assertEquals( 201, $response->get_status() );
    abstract class WP_Test_REST_Post_Type_Controller_Testcase extends WP_Test_REST_C  
    256256        }
    257257
    258258        protected function check_update_post_response( $response ) {
    259                 $this->assertNotInstanceOf( 'WP_Error', $response );
     259                $this->assertNotWPError( $response );
    260260                $response = rest_ensure_response( $response );
    261261
    262262                $this->assertEquals( 200, $response->get_status() );
  • tests/phpunit/tests/admin/includesPost.php

    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 {  
    3232                $_post_data['saveasdraft'] = true;
    3333
    3434                $_results = _wp_translate_postdata( false, $_post_data );
    35                 $this->assertNotInstanceOf( 'WP_Error', $_results );
     35                $this->assertNotWPError( $_results );
    3636                $this->assertEquals( $_post_data['post_author'], $_results['post_author'] );
    3737                $this->assertEquals( 'draft', $_results['post_status'] );
    3838
    class Tests_Admin_Includes_Post extends WP_UnitTestCase {  
    4343                $_post_data['publish']     = true;
    4444
    4545                $_results = _wp_translate_postdata( false, $_post_data );
    46                 $this->assertNotInstanceOf( 'WP_Error', $_results );
     46                $this->assertNotWPError( $_results );
    4747                $this->assertEquals( $_post_data['post_author'], $_results['post_author'] );
    4848                $this->assertEquals( 'pending', $_results['post_status'] );
    4949
    class Tests_Admin_Includes_Post extends WP_UnitTestCase {  
    8282                $_post_data['saveasdraft'] = true;
    8383
    8484                $_results = _wp_translate_postdata( false, $_post_data );
    85                 $this->assertNotInstanceOf( 'WP_Error', $_results );
     85                $this->assertNotWPError( $_results );
    8686                $this->assertEquals( $_post_data['post_author'], $_results['post_author'] );
    8787                $this->assertEquals( 'draft', $_results['post_status'] );
    8888
    class Tests_Admin_Includes_Post extends WP_UnitTestCase {  
    9393                $_post_data['publish']     = true;
    9494
    9595                $_results = _wp_translate_postdata( false, $_post_data );
    96                 $this->assertNotInstanceOf( 'WP_Error', $_results );
     96                $this->assertNotWPError( $_results );
    9797                $this->assertEquals( $_post_data['post_author'], $_results['post_author'] );
    9898                $this->assertEquals( 'publish', $_results['post_status'] );
    9999
    class Tests_Admin_Includes_Post extends WP_UnitTestCase {  
    104104                $_post_data['saveasdraft'] = true;
    105105
    106106                $_results = _wp_translate_postdata( false, $_post_data );
    107                 $this->assertNotInstanceOf( 'WP_Error', $_results );
     107                $this->assertNotWPError( $_results );
    108108                $this->assertEquals( $_post_data['post_author'], $_results['post_author'] );
    109109                $this->assertEquals( 'draft', $_results['post_status'] );
    110110
    class Tests_Admin_Includes_Post extends WP_UnitTestCase {  
    117117                $_post_data['saveasdraft'] = true;
    118118
    119119                $_results = _wp_translate_postdata( true, $_post_data );
    120                 $this->assertNotInstanceOf( 'WP_Error', $_results );
     120                $this->assertNotWPError( $_results );
    121121                $this->assertEquals( $_post_data['post_author'], $_results['post_author'] );
    122122                $this->assertEquals( 'draft', $_results['post_status'] );
    123123        }
  • tests/phpunit/tests/ajax/CustomizeManager.php

    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 {  
    645645                $this->assertEquals( 'changeset_lock_dismissed', $this->_last_response_parsed['data'] );
    646646
    647647                $_POST['dismiss_autosave'] = $_GET['dismiss_autosave'] = $_REQUEST['dismiss_autosave'] = true;
    648                 $this->assertNotInstanceOf( 'WP_Error', $r );
     648                $this->assertNotWPError( $r );
    649649                $this->assertFalse( wp_get_post_autosave( $wp_customize->changeset_post_id() ) );
    650650                $this->assertContains( 'Foo', get_post( $wp_customize->changeset_post_id() )->post_content );
    651651
    class Tests_Ajax_CustomizeManager extends WP_Ajax_UnitTestCase {  
    665665                                'autosave' => true,
    666666                        )
    667667                );
    668                 $this->assertNotInstanceOf( 'WP_Error', $r );
     668                $this->assertNotWPError( $r );
    669669                $autosave_revision = wp_get_post_autosave( $wp_customize->changeset_post_id() );
    670670                $this->assertInstanceOf( 'WP_Post', $autosave_revision );
    671671                $this->assertContains( 'Foo', get_post( $wp_customize->changeset_post_id() )->post_content );
  • tests/phpunit/tests/customize/manager.php

    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 {  
    495495                                'autosave' => true,
    496496                        )
    497497                );
    498                 $this->assertNotInstanceOf( 'WP_Error', $r );
     498                $this->assertNotWPError( $r );
    499499
    500500                // No change to data if not requesting autosave.
    501501                $wp_customize = new WP_Customize_Manager(
  • tests/phpunit/tests/customize/nav-menu-setting.php

    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 {  
    253253
    254254                $term = (array) wp_get_nav_menu_object( $menu_id );
    255255                $this->assertNotEmpty( $term );
    256                 $this->assertNotInstanceOf( 'WP_Error', $term );
     256                $this->assertNotWPError( $term );
    257257                $this->assertEqualSets( $post_value, wp_array_slice_assoc( $term, array_keys( $value ) ) );
    258258                $this->assertEquals( $menu_id, $term['term_id'] );
    259259                $this->assertEquals( $menu_id, $term['term_taxonomy_id'] );
  • tests/phpunit/tests/image/editorGd.php

    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 {  
    476476
    477477                $editor = wp_get_image_editor( $file );
    478478
    479                 $this->assertNotInstanceOf( 'WP_Error', $editor );
     479                $this->assertNotWPError( $editor );
    480480
    481481                $editor->load();
    482482                $editor->resize( 5, 5 );
    class Tests_Image_Editor_GD extends WP_Image_UnitTestCase {  
    503503
    504504                $editor = wp_get_image_editor( $file );
    505505
    506                 $this->assertNotInstanceOf( 'WP_Error', $editor );
     506                $this->assertNotWPError( $editor );
    507507
    508508                $editor->load();
    509509
    class Tests_Image_Editor_GD extends WP_Image_UnitTestCase {  
    531531                $expected = imagecolorsforindex( $image, $rgb );
    532532
    533533                $editor = new WP_Image_Editor_GD( $file );
    534                                 $this->assertNotInstanceOf( 'WP_Error', $editor );
     534                                $this->assertNotWPError( $editor );
    535535                                $editor->load();
    536536                                $editor->rotate( 180 );
    537537                                $save_to_file = tempnam( get_temp_dir(), '' ) . '.png';
  • tests/phpunit/tests/image/editorImagick.php

    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 {  
    465465
    466466                $editor = new WP_Image_Editor_Imagick( $file );
    467467
    468                 $this->assertNotInstanceOf( 'WP_Error', $editor );
     468                $this->assertNotWPError( $editor );
    469469
    470470                $editor->load();
    471471                $editor->resize( 5, 5 );
    class Tests_Image_Editor_Imagick extends WP_Image_UnitTestCase {  
    492492
    493493                $editor = new WP_Image_Editor_Imagick( $file );
    494494
    495                 $this->assertNotInstanceOf( 'WP_Error', $editor );
     495                $this->assertNotWPError( $editor );
    496496
    497497                $editor->load();
    498498
    class Tests_Image_Editor_Imagick extends WP_Image_UnitTestCase {  
    524524
    525525                $image_editor = new WP_Image_Editor_Imagick( $save_to_file );
    526526                $image_editor->load();
    527                 $this->assertNotInstanceOf( 'WP_Error', $image_editor );
     527                $this->assertNotWPError( $image_editor );
    528528                $image_editor->rotate( 180 );
    529529                $image_editor->save( $save_to_file );
    530530
  • tests/phpunit/tests/image/functions.php

    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 {  
    163163                                $file = wp_tempnam();
    164164                                $ret  = wp_save_image_file( $file, $img, $mime_type, 1 );
    165165                                $this->assertNotEmpty( $ret );
    166                                 $this->assertNotInstanceOf( 'WP_Error', $ret );
     166                                $this->assertNotWPError( $ret );
    167167                                $this->assertEquals( $mime_type, $this->get_mime_type( $ret['path'] ) );
    168168
    169169                                // Clean up
    class Tests_Image_Functions extends WP_UnitTestCase {  
    205205
    206206                        // Make assertions
    207207                        $this->assertNotEmpty( $ret );
    208                         $this->assertNotInstanceOf( 'WP_Error', $ret );
     208                        $this->assertNotWPError( $ret );
    209209                        $this->assertEquals( $mime_type, $this->get_mime_type( $ret['path'] ) );
    210210
    211211                        // Clean up
    class Tests_Image_Functions extends WP_UnitTestCase {  
    249249
    250250                        // Save the image as each file extension, check the mime type
    251251                        $img = wp_get_image_editor( DIR_TESTDATA . '/images/canola.jpg' );
    252                         $this->assertNotInstanceOf( 'WP_Error', $img );
     252                        $this->assertNotWPError( $img );
    253253
    254254                        $temp = get_temp_dir();
    255255                        foreach ( $mime_types as $ext => $mime_type ) {
    class Tests_Image_Functions extends WP_UnitTestCase {  
    260260                                $file = wp_unique_filename( $temp, uniqid() . ".$ext" );
    261261                                $ret  = $img->save( trailingslashit( $temp ) . $file );
    262262                                $this->assertNotEmpty( $ret );
    263                                 $this->assertNotInstanceOf( 'WP_Error', $ret );
     263                                $this->assertNotWPError( $ret );
    264264                                $this->assertEquals( $mime_type, $this->get_mime_type( $ret['path'] ) );
    265265                                unlink( $ret['path'] );
    266266                        }
    class Tests_Image_Functions extends WP_UnitTestCase {  
    310310                        DIR_TESTDATA . '/images/canola.jpg',
    311311                        0, 0, 100, 100, 100, 100
    312312                );
    313                 $this->assertNotInstanceOf( 'WP_Error', $file );
     313                $this->assertNotWPError( $file );
    314314                $this->assertFileExists( $file );
    315315                $image = wp_get_image_editor( $file );
    316316                $size  = $image->get_size();
    class Tests_Image_Functions extends WP_UnitTestCase {  
    334334                        0, 0, 100, 100, 100, 100, false,
    335335                        DIR_TESTDATA . '/images/' . __FUNCTION__ . '.jpg'
    336336                );
    337                 $this->assertNotInstanceOf( 'WP_Error', $file );
     337                $this->assertNotWPError( $file );
    338338                $this->assertFileExists( $file );
    339339                $image = wp_get_image_editor( $file );
    340340                $size  = $image->get_size();
  • tests/phpunit/tests/post/formats.php

    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 {  
    1515                $this->assertFalse( $format );
    1616
    1717                $result = set_post_format( $post_id, 'aside' );
    18                 $this->assertNotInstanceOf( 'WP_Error', $result );
     18                $this->assertNotWPError( $result );
    1919                $this->assertInternalType( 'array', $result );
    2020                $this->assertEquals( 1, count( $result ) );
    2121
    class Tests_Post_Formats extends WP_UnitTestCase {  
    2323                $this->assertEquals( 'aside', $format );
    2424
    2525                $result = set_post_format( $post_id, 'standard' );
    26                 $this->assertNotInstanceOf( 'WP_Error', $result );
     26                $this->assertNotWPError( $result );
    2727                $this->assertInternalType( 'array', $result );
    2828                $this->assertEquals( 0, count( $result ) );
    2929
    3030                $result = set_post_format( $post_id, '' );
    31                 $this->assertNotInstanceOf( 'WP_Error', $result );
     31                $this->assertNotWPError( $result );
    3232                $this->assertInternalType( 'array', $result );
    3333                $this->assertEquals( 0, count( $result ) );
    3434        }
    class Tests_Post_Formats extends WP_UnitTestCase {  
    4343                $this->assertFalse( $format );
    4444
    4545                $result = set_post_format( $post_id, 'aside' );
    46                 $this->assertNotInstanceOf( 'WP_Error', $result );
     46                $this->assertNotWPError( $result );
    4747                $this->assertInternalType( 'array', $result );
    4848                $this->assertEquals( 1, count( $result ) );
    4949                // The format can be set but not retrieved until it is registered.
    class Tests_Post_Formats extends WP_UnitTestCase {  
    5656                $this->assertEquals( 'aside', $format );
    5757
    5858                $result = set_post_format( $post_id, 'standard' );
    59                 $this->assertNotInstanceOf( 'WP_Error', $result );
     59                $this->assertNotWPError( $result );
    6060                $this->assertInternalType( 'array', $result );
    6161                $this->assertEquals( 0, count( $result ) );
    6262
    6363                $result = set_post_format( $post_id, '' );
    64                 $this->assertNotInstanceOf( 'WP_Error', $result );
     64                $this->assertNotWPError( $result );
    6565                $this->assertInternalType( 'array', $result );
    6666                $this->assertEquals( 0, count( $result ) );
    6767
    class Tests_Post_Formats extends WP_UnitTestCase {  
    7575                $this->assertFalse( has_post_format( '', $post_id ) );
    7676
    7777                $result = set_post_format( $post_id, 'aside' );
    78                 $this->assertNotInstanceOf( 'WP_Error', $result );
     78                $this->assertNotWPError( $result );
    7979                $this->assertInternalType( 'array', $result );
    8080                $this->assertEquals( 1, count( $result ) );
    8181                $this->assertTrue( has_post_format( 'aside', $post_id ) );
    8282
    8383                $result = set_post_format( $post_id, 'standard' );
    84                 $this->assertNotInstanceOf( 'WP_Error', $result );
     84                $this->assertNotWPError( $result );
    8585                $this->assertInternalType( 'array', $result );
    8686                $this->assertEquals( 0, count( $result ) );
    8787                // Standard is a special case. It shows as false when set.