- 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-block-type-controller.php
r48173 r48937 92 92 $response = rest_get_server()->dispatch( $request ); 93 93 $data = $response->get_data(); 94 $this->assert Equals( 'view', $data['endpoints'][0]['args']['context']['default'] );95 $this->assert Equals( array( 'view', 'embed', 'edit' ), $data['endpoints'][0]['args']['context']['enum'] );94 $this->assertSame( 'view', $data['endpoints'][0]['args']['context']['default'] ); 95 $this->assertSame( array( 'view', 'embed', 'edit' ), $data['endpoints'][0]['args']['context']['enum'] ); 96 96 // Single. 97 97 $request = new WP_REST_Request( 'OPTIONS', '/wp/v2/block-types/fake/test' ); 98 98 $response = rest_get_server()->dispatch( $request ); 99 99 $data = $response->get_data(); 100 $this->assert Equals( 'view', $data['endpoints'][0]['args']['context']['default'] );101 $this->assert Equals( array( 'view', 'embed', 'edit' ), $data['endpoints'][0]['args']['context']['enum'] );100 $this->assertSame( 'view', $data['endpoints'][0]['args']['context']['default'] ); 101 $this->assertSame( array( 'view', 'embed', 'edit' ), $data['endpoints'][0]['args']['context']['enum'] ); 102 102 } 103 103 … … 231 231 $response = rest_get_server()->dispatch( $request ); 232 232 $data = $response->get_data(); 233 $this->assert Equals( $block_type, $data['name'] );234 $this->assert Equals( '1', $data['title'] );235 $this->assert Equals( '1', $data['description'] );236 $this->assert Equals( null,$data['icon'] );237 $this->assert Equals( null,$data['editor_script'] );238 $this->assert Equals( null,$data['script'] );239 $this->assert Equals( null,$data['editor_style'] );240 $this->assert Equals( null,$data['style'] );233 $this->assertSame( $block_type, $data['name'] ); 234 $this->assertSame( '1', $data['title'] ); 235 $this->assertSame( '1', $data['description'] ); 236 $this->assertNull( $data['icon'] ); 237 $this->assertNull( $data['editor_script'] ); 238 $this->assertNull( $data['script'] ); 239 $this->assertNull( $data['editor_style'] ); 240 $this->assertNull( $data['style'] ); 241 241 $this->assertEqualSets( array(), $data['provides_context'] ); 242 242 $this->assertEqualSets( array(), $data['attributes'] ); … … 246 246 $this->assertEqualSets( array(), $data['supports'] ); 247 247 $this->assertEqualSets( array(), $data['styles'] ); 248 $this->assert Equals( null,$data['example'] );249 $this->assert Equals( null,$data['category'] );250 $this->assert Equals( null,$data['textdomain'] );251 $this->assertFalse( false,$data['is_dynamic'] );248 $this->assertNull( $data['example'] ); 249 $this->assertNull( $data['category'] ); 250 $this->assertNull( $data['textdomain'] ); 251 $this->assertFalse( $data['is_dynamic'] ); 252 252 } 253 253 … … 282 282 $response = rest_get_server()->dispatch( $request ); 283 283 $data = $response->get_data(); 284 $this->assert Equals( $block_type, $data['name'] );285 $this->assert Equals( '', $data['title'] );286 $this->assert Equals( '', $data['description'] );287 $this->assert Equals( null,$data['icon'] );288 $this->assert Equals( null,$data['editor_script'] );289 $this->assert Equals( null,$data['script'] );290 $this->assert Equals( null,$data['editor_style'] );291 $this->assert Equals( null,$data['style'] );284 $this->assertSame( $block_type, $data['name'] ); 285 $this->assertSame( '', $data['title'] ); 286 $this->assertSame( '', $data['description'] ); 287 $this->assertNull( $data['icon'] ); 288 $this->assertNull( $data['editor_script'] ); 289 $this->assertNull( $data['script'] ); 290 $this->assertNull( $data['editor_style'] ); 291 $this->assertNull( $data['style'] ); 292 292 $this->assertEqualSets( array(), $data['attributes'] ); 293 293 $this->assertEqualSets( array(), $data['provides_context'] ); … … 297 297 $this->assertEqualSets( array(), $data['supports'] ); 298 298 $this->assertEqualSets( array(), $data['styles'] ); 299 $this->assert Equals( null,$data['example'] );300 $this->assert Equals( null,$data['category'] );301 $this->assert Equals( null,$data['example'] );302 $this->assert Equals( null,$data['textdomain'] );303 $this->assertFalse( false,$data['is_dynamic'] );299 $this->assertNull( $data['example'] ); 300 $this->assertNull( $data['category'] ); 301 $this->assertNull( $data['example'] ); 302 $this->assertNull( $data['textdomain'] ); 303 $this->assertFalse( $data['is_dynamic'] ); 304 304 } 305 305 … … 409 409 $request->set_param( '_fields', 'name' ); 410 410 $response = $endpoint->prepare_item_for_response( $block_type, $request ); 411 $this->assert Equals(411 $this->assertSame( 412 412 array( 413 413 'name', … … 428 428 protected function check_block_type_object( $block_type, $data, $links ) { 429 429 // Test data. 430 $this->assert Equals( $data['attributes'], $block_type->get_attributes() );431 $this->assert Equals( $data['is_dynamic'], $block_type->is_dynamic() );430 $this->assertSame( $data['attributes'], $block_type->get_attributes() ); 431 $this->assertSame( $data['is_dynamic'], $block_type->is_dynamic() ); 432 432 433 433 $extra_fields = array( … … 453 453 foreach ( $extra_fields as $extra_field ) { 454 454 if ( isset( $block_type->$extra_field ) ) { 455 $this->assert Equals( $data[ $extra_field ], $block_type->$extra_field );455 $this->assertSame( $data[ $extra_field ], $block_type->$extra_field ); 456 456 } 457 457 } 458 458 459 459 // Test links. 460 $this->assert Equals( rest_url( 'wp/v2/block-types' ), $links['collection'][0]['href'] );461 $this->assert Equals( rest_url( 'wp/v2/block-types/' . $block_type->name ), $links['self'][0]['href'] );460 $this->assertSame( rest_url( 'wp/v2/block-types' ), $links['collection'][0]['href'] ); 461 $this->assertSame( rest_url( 'wp/v2/block-types/' . $block_type->name ), $links['self'][0]['href'] ); 462 462 if ( $block_type->is_dynamic() ) { 463 463 $this->assertArrayHasKey( 'https://api.w.org/render-block', $links );
Note: See TracChangeset
for help on using the changeset viewer.