- Timestamp:
- 09/02/2020 12:35:36 AM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/rest-api/rest-search-controller.php
r46586 r48937 97 97 $data = $response->get_data(); 98 98 99 $this->assert Equals( 'view', $data['endpoints'][0]['args']['context']['default'] );100 $this->assert Equals( array( 'view', 'embed' ), $data['endpoints'][0]['args']['context']['enum'] );99 $this->assertSame( 'view', $data['endpoints'][0]['args']['context']['default'] ); 100 $this->assertSame( array( 'view', 'embed' ), $data['endpoints'][0]['args']['context']['enum'] ); 101 101 } 102 102 … … 111 111 ); 112 112 113 $this->assert Equals( 200, $response->get_status() );113 $this->assertSame( 200, $response->get_status() ); 114 114 $this->assertEqualSets( 115 115 array_merge( … … 132 132 ); 133 133 134 $this->assert Equals( 200, $response->get_status() );135 $this->assert Equals( 3, count( $response->get_data() ) );134 $this->assertSame( 200, $response->get_status() ); 135 $this->assertSame( 3, count( $response->get_data() ) ); 136 136 } 137 137 … … 147 147 ); 148 148 149 $this->assert Equals( 200, $response->get_status() );149 $this->assertSame( 200, $response->get_status() ); 150 150 $this->assertEqualSets( 151 151 array_merge( … … 170 170 ); 171 171 172 $this->assert Equals( 200, $response->get_status() );172 $this->assertSame( 200, $response->get_status() ); 173 173 $this->assertEqualSets( 174 174 array_merge( … … 192 192 ); 193 193 194 $this->assert Equals( 200, $response->get_status() );194 $this->assertSame( 200, $response->get_status() ); 195 195 $this->assertEqualSets( 196 196 self::$my_title_page_ids, … … 240 240 ); 241 241 242 $this->assert Equals( 200, $response->get_status() );242 $this->assertSame( 200, $response->get_status() ); 243 243 $this->assertEqualSets( 244 244 array_merge( … … 262 262 ); 263 263 264 $this->assert Equals( 200, $response->get_status() );264 $this->assertSame( 200, $response->get_status() ); 265 265 $this->assertEqualSets( 266 266 array_merge( … … 283 283 ); 284 284 285 $this->assert Equals( 200, $response->get_status() );285 $this->assertSame( 200, $response->get_status() ); 286 286 $this->assertEqualSets( 287 287 self::$my_content_post_ids, … … 297 297 $request = new WP_REST_Request( 'GET', '/wp/v2/search' . self::$my_title_post_ids[0] ); 298 298 $response = rest_get_server()->dispatch( $request ); 299 $this->assert Equals( 404, $response->get_status() );299 $this->assertSame( 404, $response->get_status() ); 300 300 } 301 301 … … 307 307 $request = new WP_REST_Request( 'POST', '/wp/v2/search' ); 308 308 $response = rest_get_server()->dispatch( $request ); 309 $this->assert Equals( 404, $response->get_status() );309 $this->assertSame( 404, $response->get_status() ); 310 310 } 311 311 … … 317 317 $request = new WP_REST_Request( 'POST', '/wp/v2/search' . self::$my_title_post_ids[0] ); 318 318 $response = rest_get_server()->dispatch( $request ); 319 $this->assert Equals( 404, $response->get_status() );319 $this->assertSame( 404, $response->get_status() ); 320 320 } 321 321 … … 327 327 $request = new WP_REST_Request( 'DELETE', '/wp/v2/search' . self::$my_title_post_ids[0] ); 328 328 $response = rest_get_server()->dispatch( $request ); 329 $this->assert Equals( 404, $response->get_status() );329 $this->assertSame( 404, $response->get_status() ); 330 330 } 331 331 … … 335 335 public function test_prepare_item() { 336 336 $response = $this->do_request_with_params(); 337 $this->assert Equals( 200, $response->get_status() );337 $this->assertSame( 200, $response->get_status() ); 338 338 339 339 $data = $response->get_data(); 340 $this->assert Equals(340 $this->assertSame( 341 341 array( 342 342 'id', … … 364 364 ) 365 365 ); 366 $this->assert Equals( 200, $response->get_status() );366 $this->assertSame( 200, $response->get_status() ); 367 367 368 368 $data = $response->get_data(); 369 $this->assert Equals(369 $this->assertSame( 370 370 array( 371 371 'id', … … 449 449 $response = $controller->prepare_item_for_response( 1, $request ); 450 450 $data = $response->get_data(); 451 $this->assert Equals(451 $this->assertSame( 452 452 array( 453 453 'id', … … 480 480 $response = $controller->prepare_item_for_response( 1, $request ); 481 481 $data = $response->get_data(); 482 $this->assert Equals(482 $this->assertSame( 483 483 array( 484 484 'id', … … 496 496 497 497 $params = $controller->get_collection_params(); 498 $this->assert Equals( 'test', $params[ WP_REST_Search_Controller::PROP_TYPE ]['default'] );498 $this->assertSame( 'test', $params[ WP_REST_Search_Controller::PROP_TYPE ]['default'] ); 499 499 $this->assertEqualSets( array( 'test' ), $params[ WP_REST_Search_Controller::PROP_TYPE ]['enum'] ); 500 500 $this->assertEqualSets( array( 'test_first_type', 'test_second_type', WP_REST_Search_Controller::TYPE_ANY ), $params[ WP_REST_Search_Controller::PROP_SUBTYPE ]['items']['enum'] ); … … 512 512 $this->assertCount( 1, $data['_embedded']['self'] ); 513 513 $this->assertArrayHasKey( WP_REST_Search_Controller::PROP_ID, $data['_embedded']['self'][0] ); 514 $this->assert Equals( $data[ WP_REST_Search_Controller::PROP_ID ], $data['_embedded']['self'][0][ WP_REST_Search_Controller::PROP_ID ] );514 $this->assertSame( $data[ WP_REST_Search_Controller::PROP_ID ], $data['_embedded']['self'][0][ WP_REST_Search_Controller::PROP_ID ] ); 515 515 } 516 516
Note: See TracChangeset
for help on using the changeset viewer.