Make WordPress Core

Changeset 42863


Ignore:
Timestamp:
03/20/2018 10:34:11 PM (7 years ago)
Author:
johnbillion
Message:

Build/Test Tools: Implement assertNotWPError() in appropriate places in the test suite.

Props birgire

Fixes #42065

Location:
trunk/tests/phpunit
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/includes/testcase-rest-post-type-controller.php

    r42343 r42863  
    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() );
     
    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() );
     
    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
     
    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
  • trunk/tests/phpunit/tests/admin/includesPost.php

    r42343 r42863  
    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'] );
     
    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'] );
     
    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'] );
     
    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'] );
     
    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'] );
     
    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'] );
  • trunk/tests/phpunit/tests/ajax/CustomizeManager.php

    r42615 r42863  
    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 );
     
    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 );
  • trunk/tests/phpunit/tests/customize/manager.php

    r42636 r42863  
    496496            )
    497497        );
    498         $this->assertNotInstanceOf( 'WP_Error', $r );
     498        $this->assertNotWPError( $r );
    499499
    500500        // No change to data if not requesting autosave.
  • trunk/tests/phpunit/tests/customize/nav-menu-setting.php

    r42343 r42863  
    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'] );
  • trunk/tests/phpunit/tests/image/editorGd.php

    r42343 r42863  
    477477        $editor = wp_get_image_editor( $file );
    478478
    479         $this->assertNotInstanceOf( 'WP_Error', $editor );
     479        $this->assertNotWPError( $editor );
    480480
    481481        $editor->load();
     
    504504        $editor = wp_get_image_editor( $file );
    505505
    506         $this->assertNotInstanceOf( 'WP_Error', $editor );
     506        $this->assertNotWPError( $editor );
    507507
    508508        $editor->load();
     
    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 );
  • trunk/tests/phpunit/tests/image/editorImagick.php

    r42431 r42863  
    466466        $editor = new WP_Image_Editor_Imagick( $file );
    467467
    468         $this->assertNotInstanceOf( 'WP_Error', $editor );
     468        $this->assertNotWPError( $editor );
    469469
    470470        $editor->load();
     
    493493        $editor = new WP_Image_Editor_Imagick( $file );
    494494
    495         $this->assertNotInstanceOf( 'WP_Error', $editor );
     495        $this->assertNotWPError( $editor );
    496496
    497497        $editor->load();
     
    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 );
  • trunk/tests/phpunit/tests/image/functions.php

    r42792 r42863  
    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
     
    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
     
    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();
     
    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'] );
     
    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 );
     
    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 );
  • trunk/tests/phpunit/tests/post/formats.php

    r42343 r42863  
    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 ) );
     
    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 ) );
     
    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 ) );
     
    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 ) );
     
    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 ) );
     
    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 ) );
Note: See TracChangeset for help on using the changeset viewer.