Make WordPress Core


Ignore:
Timestamp:
09/02/2020 12:35:36 AM (6 years ago)
Author:
SergeyBiryukov
Message:

Tests: First pass at using assertSame() instead of assertEquals() in most of the unit tests.

This ensures that not only the return values match the expected results, but also that their type is the same.

Going forward, stricter type checking by using assertSame() should generally be preferred to assertEquals() where appropriate, to make the tests more reliable.

Props johnbillion, jrf, SergeyBiryukov.
See #38266.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/rest-api/rest-attachments-controller.php

    r48794 r48937  
    156156                $header_list = array( $header );
    157157                $parsed      = WP_REST_Attachments_Controller::get_filename_from_disposition( $header_list );
    158                 $this->assertEquals( $expected, $parsed );
     158                $this->assertSame( $expected, $parsed );
    159159        }
    160160
    … …  
    164164                $response = rest_get_server()->dispatch( $request );
    165165                $data     = $response->get_data();
    166                 $this->assertEquals( 'view', $data['endpoints'][0]['args']['context']['default'] );
    167                 $this->assertEquals( array( 'view', 'embed', 'edit' ), $data['endpoints'][0]['args']['context']['enum'] );
     166                $this->assertSame( 'view', $data['endpoints'][0]['args']['context']['default'] );
     167                $this->assertSame( array( 'view', 'embed', 'edit' ), $data['endpoints'][0]['args']['context']['enum'] );
    168168                // Single.
    169169                $attachment_id = $this->factory->attachment->create_object(
    … …  
    178178                $response      = rest_get_server()->dispatch( $request );
    179179                $data          = $response->get_data();
    180                 $this->assertEquals( 'view', $data['endpoints'][0]['args']['context']['default'] );
    181                 $this->assertEquals( array( 'view', 'embed', 'edit' ), $data['endpoints'][0]['args']['context']['enum'] );
     180                $this->assertSame( 'view', $data['endpoints'][0]['args']['context']['default'] );
     181                $this->assertSame( array( 'view', 'embed', 'edit' ), $data['endpoints'][0]['args']['context']['enum'] );
    182182        }
    183183
    … …  
    188188                $keys     = array_keys( $data['endpoints'][0]['args'] );
    189189                sort( $keys );
    190                 $this->assertEquals(
     190                $this->assertSame(
    191191                        array(
    192192                                'after',
    … …  
    238238                $keys     = array_keys( $data['endpoints'][0]['args'] );
    239239                sort( $keys );
    240                 $this->assertEquals( array( 'context', 'id' ), $keys );
     240                $this->assertSame( array( 'context', 'id' ), $keys );
    241241        }
    242242
    … …  
    259259
    260260                $this->assertNotEmpty( $headers['Allow'] );
    261                 $this->assertEquals( $headers['Allow'], 'GET' );
     261                $this->assertSame( $headers['Allow'], 'GET' );
    262262
    263263                wp_set_current_user( self::$editor_id );
    … …  
    268268
    269269                $this->assertNotEmpty( $headers['Allow'] );
    270                 $this->assertEquals( $headers['Allow'], 'GET, POST, PUT, PATCH, DELETE' );
     270                $this->assertSame( $headers['Allow'], 'GET, POST, PUT, PATCH, DELETE' );
    271271        }
    272272
    … …  
    361361                $response = rest_get_server()->dispatch( $request );
    362362                $data     = $response->get_data();
    363                 $this->assertEquals( $id1, $data[0]['id'] );
     363                $this->assertSame( $id1, $data[0]['id'] );
    364364                // 'media_type' => 'video'.
    365365                $request->set_param( 'media_type', 'video' );
    … …  
    370370                $response = rest_get_server()->dispatch( $request );
    371371                $data     = $response->get_data();
    372                 $this->assertEquals( $id1, $data[0]['id'] );
     372                $this->assertSame( $id1, $data[0]['id'] );
    373373        }
    374374
    … …  
    384384                $response = rest_get_server()->dispatch( $request );
    385385                $data     = $response->get_data();
    386                 $this->assertEquals( $id1, $data[0]['id'] );
     386                $this->assertSame( $id1, $data[0]['id'] );
    387387                // 'mime_type' => 'image/png'.
    388388                $request->set_param( 'mime_type', 'image/png' );
    … …  
    393393                $response = rest_get_server()->dispatch( $request );
    394394                $data     = $response->get_data();
    395                 $this->assertEquals( $id1, $data[0]['id'] );
     395                $this->assertSame( $id1, $data[0]['id'] );
    396396        }
    397397
    … …  
    417417                $request  = new WP_REST_Request( 'GET', '/wp/v2/media' );
    418418                $response = rest_get_server()->dispatch( $request );
    419                 $this->assertEquals( 2, count( $response->get_data() ) );
     419                $this->assertSame( 2, count( $response->get_data() ) );
    420420                $request = new WP_REST_Request( 'GET', '/wp/v2/media' );
    421421                // Attachments without a parent.
    … …  
    423423                $response = rest_get_server()->dispatch( $request );
    424424                $data     = $response->get_data();
    425                 $this->assertEquals( 1, count( $data ) );
    426                 $this->assertEquals( $attachment_id2, $data[0]['id'] );
     425                $this->assertSame( 1, count( $data ) );
     426                $this->assertSame( $attachment_id2, $data[0]['id'] );
    427427                // Attachments with parent=post_id.
    428428                $request = new WP_REST_Request( 'GET', '/wp/v2/media' );
    … …  
    430430                $response = rest_get_server()->dispatch( $request );
    431431                $data     = $response->get_data();
    432                 $this->assertEquals( 1, count( $data ) );
    433                 $this->assertEquals( $attachment_id, $data[0]['id'] );
     432                $this->assertSame( 1, count( $data ) );
     433                $this->assertSame( $attachment_id, $data[0]['id'] );
    434434                // Attachments with invalid parent.
    435435                $request = new WP_REST_Request( 'GET', '/wp/v2/media' );
    … …  
    437437                $response = rest_get_server()->dispatch( $request );
    438438                $data     = $response->get_data();
    439                 $this->assertEquals( 0, count( $data ) );
     439                $this->assertSame( 0, count( $data ) );
    440440        }
    441441
    … …  
    456456                $data     = $response->get_data();
    457457                $this->assertCount( 3, $data );
    458                 $this->assertEquals( 'rest_invalid_param', $data['code'] );
     458                $this->assertSame( 'rest_invalid_param', $data['code'] );
    459459        }
    460460
    … …  
    478478                wp_set_current_user( self::$editor_id );
    479479                $response = rest_get_server()->dispatch( $request );
    480                 $this->assertEquals( 200, $response->get_status() );
     480                $this->assertSame( 200, $response->get_status() );
    481481                $data = $response->get_data();
    482                 $this->assertEquals( $attachment_id1, $data[0]['id'] );
     482                $this->assertSame( $attachment_id1, $data[0]['id'] );
    483483        }
    484484
    … …  
    511511                wp_set_current_user( self::$editor_id );
    512512                $response = rest_get_server()->dispatch( $request );
    513                 $this->assertEquals( 200, $response->get_status() );
     513                $this->assertSame( 200, $response->get_status() );
    514514                $data = $response->get_data();
    515                 $this->assertEquals( 2, count( $data ) );
     515                $this->assertSame( 2, count( $data ) );
    516516                $ids = array(
    517517                        $data[0]['id'],
    … …  
    519519                );
    520520                sort( $ids );
    521                 $this->assertEquals( array( $attachment_id1, $attachment_id2 ), $ids );
     521                $this->assertSame( array( $attachment_id1, $attachment_id2 ), $ids );
    522522        }
    523523
    … …  
    564564                $data     = $response->get_data();
    565565                $this->assertCount( 1, $data );
    566                 $this->assertEquals( $id2, $data[0]['id'] );
     566                $this->assertSame( $id2, $data[0]['id'] );
    567567        }
    568568
    … …  
    581581                $this->check_get_post_response( $response );
    582582                $data = $response->get_data();
    583                 $this->assertEquals( 'image/jpeg', $data['mime_type'] );
     583                $this->assertSame( 'image/jpeg', $data['mime_type'] );
    584584        }
    585585
    … …  
    605605                remove_image_size( 'rest-api-test' );
    606606
    607                 $this->assertEquals( $image_src[0], $data['media_details']['sizes']['rest-api-test']['source_url'] );
    608                 $this->assertEquals( 'image/jpeg', $data['media_details']['sizes']['rest-api-test']['mime_type'] );
    609                 $this->assertEquals( $original_image_src[0], $data['media_details']['sizes']['full']['source_url'] );
    610                 $this->assertEquals( 'image/jpeg', $data['media_details']['sizes']['full']['mime_type'] );
     607                $this->assertSame( $image_src[0], $data['media_details']['sizes']['rest-api-test']['source_url'] );
     608                $this->assertSame( 'image/jpeg', $data['media_details']['sizes']['rest-api-test']['mime_type'] );
     609                $this->assertSame( $original_image_src[0], $data['media_details']['sizes']['full']['source_url'] );
     610                $this->assertSame( 'image/jpeg', $data['media_details']['sizes']['full']['mime_type'] );
    611611        }
    612612
    … …  
    649649                $request    = new WP_REST_Request( 'GET', '/wp/v2/media/' . $id1 );
    650650                $response   = rest_get_server()->dispatch( $request );
    651                 $this->assertEquals( 401, $response->get_status() );
     651                $this->assertSame( 401, $response->get_status() );
    652652        }
    653653
    … …  
    665665                $data          = $response->get_data();
    666666
    667                 $this->assertEquals( 200, $response->get_status() );
    668                 $this->assertEquals( $attachment_id, $data['id'] );
     667                $this->assertSame( 200, $response->get_status() );
     668                $this->assertSame( $attachment_id, $data['id'] );
    669669        }
    670670
    … …  
    700700                $data     = $response->get_data();
    701701
    702                 $this->assertEquals( 201, $response->get_status() );
    703                 $this->assertEquals( 'image', $data['media_type'] );
     702                $this->assertSame( 201, $response->get_status() );
     703                $this->assertSame( 'image', $data['media_type'] );
    704704
    705705                $attachment = get_post( $data['id'] );
    706                 $this->assertEquals( 'My title is very cool', $data['title']['raw'] );
    707                 $this->assertEquals( 'My title is very cool', $attachment->post_title );
    708                 $this->assertEquals( 'This is a better caption.', $data['caption']['raw'] );
    709                 $this->assertEquals( 'This is a better caption.', $attachment->post_excerpt );
    710                 $this->assertEquals( 'Without a description, my attachment is descriptionless.', $data['description']['raw'] );
    711                 $this->assertEquals( 'Without a description, my attachment is descriptionless.', $attachment->post_content );
    712                 $this->assertEquals( 'Alt text is stored outside post schema.', $data['alt_text'] );
    713                 $this->assertEquals( 'Alt text is stored outside post schema.', get_post_meta( $attachment->ID, '_wp_attachment_image_alt', true ) );
     706                $this->assertSame( 'My title is very cool', $data['title']['raw'] );
     707                $this->assertSame( 'My title is very cool', $attachment->post_title );
     708                $this->assertSame( 'This is a better caption.', $data['caption']['raw'] );
     709                $this->assertSame( 'This is a better caption.', $attachment->post_excerpt );
     710                $this->assertSame( 'Without a description, my attachment is descriptionless.', $data['description']['raw'] );
     711                $this->assertSame( 'Without a description, my attachment is descriptionless.', $attachment->post_content );
     712                $this->assertSame( 'Alt text is stored outside post schema.', $data['alt_text'] );
     713                $this->assertSame( 'Alt text is stored outside post schema.', get_post_meta( $attachment->ID, '_wp_attachment_image_alt', true ) );
    714714        }
    715715
    … …  
    729729                $request->set_header( 'Content-MD5', md5_file( $this->test_file2 ) );
    730730                $response = rest_get_server()->dispatch( $request );
    731                 $this->assertEquals( 201, $response->get_status() );
     731                $this->assertSame( 201, $response->get_status() );
    732732                $data = $response->get_data();
    733                 $this->assertEquals( 'codeispoetry', $data['title']['raw'] );
     733                $this->assertSame( 'codeispoetry', $data['title']['raw'] );
    734734        }
    735735
    … …  
    749749                $request->set_header( 'Content-MD5', md5_file( $this->test_file ) );
    750750                $response = rest_get_server()->dispatch( $request );
    751                 $this->assertEquals( 201, $response->get_status() );
     751                $this->assertSame( 201, $response->get_status() );
    752752        }
    753753
    … …  
    767767                $request->set_header( 'Content-MD5', md5_file( $this->test_file ) );
    768768                $response = rest_get_server()->dispatch( $request );
    769                 $this->assertEquals( 201, $response->get_status() );
     769                $this->assertSame( 201, $response->get_status() );
    770770        }
    771771
    … …  
    876876                $response   = rest_get_server()->dispatch( $request );
    877877                $attachment = $response->get_data();
    878                 $this->assertEquals( 'test alt text', $attachment['alt_text'] );
     878                $this->assertSame( 'test alt text', $attachment['alt_text'] );
    879879        }
    880880
    … …  
    888888                $response   = rest_get_server()->dispatch( $request );
    889889                $attachment = $response->get_data();
    890                 $this->assertEquals( '', $attachment['alt_text'] );
     890                $this->assertSame( '', $attachment['alt_text'] );
    891891        }
    892892
    … …  
    924924                $data       = $response->get_data();
    925925                $attachment = get_post( $data['id'] );
    926                 $this->assertEquals( 'My title is very cool', $data['title']['raw'] );
    927                 $this->assertEquals( 'My title is very cool', $attachment->post_title );
    928                 $this->assertEquals( 'This is a better caption.', $data['caption']['raw'] );
    929                 $this->assertEquals( 'This is a better caption.', $attachment->post_excerpt );
    930                 $this->assertEquals( 'Without a description, my attachment is descriptionless.', $data['description']['raw'] );
    931                 $this->assertEquals( 'Without a description, my attachment is descriptionless.', $attachment->post_content );
    932                 $this->assertEquals( 'Alt text is stored outside post schema.', $data['alt_text'] );
    933                 $this->assertEquals( 'Alt text is stored outside post schema.', get_post_meta( $attachment->ID, '_wp_attachment_image_alt', true ) );
     926                $this->assertSame( 'My title is very cool', $data['title']['raw'] );
     927                $this->assertSame( 'My title is very cool', $attachment->post_title );
     928                $this->assertSame( 'This is a better caption.', $data['caption']['raw'] );
     929                $this->assertSame( 'This is a better caption.', $attachment->post_excerpt );
     930                $this->assertSame( 'Without a description, my attachment is descriptionless.', $data['description']['raw'] );
     931                $this->assertSame( 'Without a description, my attachment is descriptionless.', $attachment->post_content );
     932                $this->assertSame( 'Alt text is stored outside post schema.', $data['alt_text'] );
     933                $this->assertSame( 'Alt text is stored outside post schema.', get_post_meta( $attachment->ID, '_wp_attachment_image_alt', true ) );
    934934        }
    935935
    … …  
    948948
    949949                $attachment = get_post( $attachment_id );
    950                 $this->assertEquals( $original_parent, $attachment->post_parent );
     950                $this->assertSame( $original_parent, $attachment->post_parent );
    951951
    952952                $new_parent = $this->factory->post->create( array() );
    … …  
    956956
    957957                $attachment = get_post( $attachment_id );
    958                 $this->assertEquals( $new_parent, $attachment->post_parent );
     958                $this->assertSame( $new_parent, $attachment->post_parent );
    959959        }
    960960
    … …  
    10111011                }
    10121012                $response = rest_get_server()->dispatch( $request );
    1013                 $this->assertEquals( 201, $response->get_status() );
     1013                $this->assertSame( 201, $response->get_status() );
    10141014                $actual_output = $response->get_data();
    10151015
    … …  
    10241024
    10251025                // Compare expected API output to actual API output.
    1026                 $this->assertEquals( $expected_output['title']['raw'], $actual_output['title']['raw'] );
    1027                 $this->assertEquals( $expected_output['title']['rendered'], trim( $actual_output['title']['rendered'] ) );
    1028                 $this->assertEquals( $expected_output['description']['raw'], $actual_output['description']['raw'] );
    1029                 $this->assertEquals( $expected_output['description']['rendered'], trim( $actual_output['description']['rendered'] ) );
    1030                 $this->assertEquals( $expected_output['caption']['raw'], $actual_output['caption']['raw'] );
    1031                 $this->assertEquals( $expected_output['caption']['rendered'], trim( $actual_output['caption']['rendered'] ) );
     1026                $this->assertSame( $expected_output['title']['raw'], $actual_output['title']['raw'] );
     1027                $this->assertSame( $expected_output['title']['rendered'], trim( $actual_output['title']['rendered'] ) );
     1028                $this->assertSame( $expected_output['description']['raw'], $actual_output['description']['raw'] );
     1029                $this->assertSame( $expected_output['description']['rendered'], trim( $actual_output['description']['rendered'] ) );
     1030                $this->assertSame( $expected_output['caption']['raw'], $actual_output['caption']['raw'] );
     1031                $this->assertSame( $expected_output['caption']['rendered'], trim( $actual_output['caption']['rendered'] ) );
    10321032
    10331033                // Compare expected API output to WP internal values.
    10341034                $post = get_post( $actual_output['id'] );
    1035                 $this->assertEquals( $expected_output['title']['raw'], $post->post_title );
    1036                 $this->assertEquals( $expected_output['description']['raw'], $post->post_content );
    1037                 $this->assertEquals( $expected_output['caption']['raw'], $post->post_excerpt );
     1035                $this->assertSame( $expected_output['title']['raw'], $post->post_title );
     1036                $this->assertSame( $expected_output['description']['raw'], $post->post_content );
     1037                $this->assertSame( $expected_output['caption']['raw'], $post->post_excerpt );
    10381038
    10391039                // Update the post.
    … …  
    10431043                }
    10441044                $response = rest_get_server()->dispatch( $request );
    1045                 $this->assertEquals( 200, $response->get_status() );
     1045                $this->assertSame( 200, $response->get_status() );
    10461046                $actual_output = $response->get_data();
    10471047
    … …  
    10561056
    10571057                // Compare expected API output to actual API output.
    1058                 $this->assertEquals( $expected_output['title']['raw'], $actual_output['title']['raw'] );
    1059                 $this->assertEquals( $expected_output['title']['rendered'], trim( $actual_output['title']['rendered'] ) );
    1060                 $this->assertEquals( $expected_output['description']['raw'], $actual_output['description']['raw'] );
    1061                 $this->assertEquals( $expected_output['description']['rendered'], trim( $actual_output['description']['rendered'] ) );
    1062                 $this->assertEquals( $expected_output['caption']['raw'], $actual_output['caption']['raw'] );
    1063                 $this->assertEquals( $expected_output['caption']['rendered'], trim( $actual_output['caption']['rendered'] ) );
     1058                $this->assertSame( $expected_output['title']['raw'], $actual_output['title']['raw'] );
     1059                $this->assertSame( $expected_output['title']['rendered'], trim( $actual_output['title']['rendered'] ) );
     1060                $this->assertSame( $expected_output['description']['raw'], $actual_output['description']['raw'] );
     1061                $this->assertSame( $expected_output['description']['rendered'], trim( $actual_output['description']['rendered'] ) );
     1062                $this->assertSame( $expected_output['caption']['raw'], $actual_output['caption']['raw'] );
     1063                $this->assertSame( $expected_output['caption']['rendered'], trim( $actual_output['caption']['rendered'] ) );
    10641064
    10651065                // Compare expected API output to WP internal values.
    10661066                $post = get_post( $actual_output['id'] );
    1067                 $this->assertEquals( $expected_output['title']['raw'], $post->post_title );
    1068                 $this->assertEquals( $expected_output['description']['raw'], $post->post_content );
    1069                 $this->assertEquals( $expected_output['caption']['raw'], $post->post_excerpt );
     1067                $this->assertSame( $expected_output['title']['raw'], $post->post_title );
     1068                $this->assertSame( $expected_output['description']['raw'], $post->post_content );
     1069                $this->assertSame( $expected_output['caption']['raw'], $post->post_excerpt );
    10701070        }
    10711071
    … …  
    12661266                $request['force'] = true;
    12671267                $response         = rest_get_server()->dispatch( $request );
    1268                 $this->assertEquals( 200, $response->get_status() );
     1268                $this->assertSame( 200, $response->get_status() );
    12691269        }
    12701270
    … …  
    13461346                $obj      = get_post( $attachment_id );
    13471347                $response = $endpoint->prepare_item_for_response( $obj, $request );
    1348                 $this->assertEquals(
     1348                $this->assertSame(
    13491349                        array(
    13501350                                'id',
    … …  
    13601360                $data       = $response->get_data();
    13611361                $properties = $data['schema']['properties'];
    1362                 $this->assertEquals( 27, count( $properties ) );
     1362                $this->assertSame( 27, count( $properties ) );
    13631363                $this->assertArrayHasKey( 'author', $properties );
    13641364                $this->assertArrayHasKey( 'alt_text', $properties );
    … …  
    14191419                $data     = $response->get_data();
    14201420                $this->assertArrayHasKey( 'my_custom_int', $data['schema']['properties'] );
    1421                 $this->assertEquals( $schema, $data['schema']['properties']['my_custom_int'] );
     1421                $this->assertSame( $schema, $data['schema']['properties']['my_custom_int'] );
    14221422
    14231423                $attachment_id = $this->factory->attachment->create_object(
    … …  
    15071507
    15081508                $this->assertCount( 1, $data );
    1509                 $this->assertEquals( $id2, $data[0]['id'] );
    1510                 $this->assertEquals( 'image/png', $data[0]['mime_type'] );
     1509                $this->assertSame( $id2, $data[0]['id'] );
     1510                $this->assertSame( 'image/png', $data[0]['mime_type'] );
    15111511        }
    15121512
    … …  
    15761576                $this->assertArrayNotHasKey( 'excerpt', $data );
    15771577
    1578                 $this->assertEquals( get_post_meta( $attachment->ID, '_wp_attachment_image_alt', true ), $data['alt_text'] );
     1578                $this->assertSame( get_post_meta( $attachment->ID, '_wp_attachment_image_alt', true ), $data['alt_text'] );
    15791579                if ( 'edit' === $context ) {
    1580                         $this->assertEquals( $attachment->post_excerpt, $data['caption']['raw'] );
    1581                         $this->assertEquals( $attachment->post_content, $data['description']['raw'] );
     1580                        $this->assertSame( $attachment->post_excerpt, $data['caption']['raw'] );
     1581                        $this->assertSame( $attachment->post_content, $data['description']['raw'] );
    15821582                } else {
    15831583                        $this->assertFalse( isset( $data['caption']['raw'] ) );
    … …  
    15871587
    15881588                if ( $attachment->post_parent ) {
    1589                         $this->assertEquals( $attachment->post_parent, $data['post'] );
     1589                        $this->assertSame( $attachment->post_parent, $data['post'] );
    15901590                } else {
    15911591                        $this->assertNull( $data['post'] );
    15921592                }
    15931593
    1594                 $this->assertEquals( wp_get_attachment_url( $attachment->ID ), $data['source_url'] );
     1594                $this->assertSame( wp_get_attachment_url( $attachment->ID ), $data['source_url'] );
    15951595
    15961596        }
    … …  
    17221722                $response = rest_get_server()->dispatch( $request );
    17231723                $data     = $response->get_data();
    1724                 $this->assertEquals( 201, $response->get_status() );
     1724                $this->assertSame( 201, $response->get_status() );
    17251725
    17261726                $this->assertSame( 1, self::$rest_insert_attachment_count );
    … …  
    17831783                $data     = $response->get_data();
    17841784
    1785                 $this->assertEquals( 201, $response->get_status() );
    1786                 $this->assertEquals( 'Chocolate-dipped, no filling', get_post_meta( $response->get_data()['id'], 'best_cannoli', true ) );
     1785                $this->assertSame( 201, $response->get_status() );
     1786                $this->assertSame( 'Chocolate-dipped, no filling', get_post_meta( $response->get_data()['id'], 'best_cannoli', true ) );
    17871787        }
    17881788
    … …  
    19021902
    19031903                $this->assertCount( 1, WP_Image_Editor_Mock::$spy['rotate'] );
    1904                 $this->assertEquals( array( -60 ), WP_Image_Editor_Mock::$spy['rotate'][0] );
     1904                $this->assertSame( array( -60 ), WP_Image_Editor_Mock::$spy['rotate'][0] );
    19051905        }
    19061906
    … …  
    19351935
    19361936                $this->assertCount( 1, WP_Image_Editor_Mock::$spy['crop'] );
    1937                 $this->assertEquals(
     1937                $this->assertSame(
    19381938                        array( 320.0, 48.0, 64.0, 24.0 ),
    19391939                        WP_Image_Editor_Mock::$spy['crop'][0]
    … …  
    19581958                $item     = $response->get_data();
    19591959
    1960                 $this->assertEquals( 201, $response->get_status() );
    1961                 $this->assertEquals( rest_url( '/wp/v2/media/' . $item['id'] ), $response->get_headers()['Location'] );
     1960                $this->assertSame( 201, $response->get_status() );
     1961                $this->assertSame( rest_url( '/wp/v2/media/' . $item['id'] ), $response->get_headers()['Location'] );
    19621962
    19631963                $this->assertStringEndsWith( '-edited.jpg', $item['media_details']['file'] );
Note: See TracChangeset for help on using the changeset viewer.