- 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-revisions-controller.php
r47547 r48937 111 111 $response = rest_get_server()->dispatch( $request ); 112 112 $data = $response->get_data(); 113 $this->assert Equals( 'view', $data['endpoints'][0]['args']['context']['default'] );113 $this->assertSame( 'view', $data['endpoints'][0]['args']['context']['default'] ); 114 114 $this->assertEqualSets( array( 'view', 'edit', 'embed' ), $data['endpoints'][0]['args']['context']['enum'] ); 115 115 // Single. … … 117 117 $response = rest_get_server()->dispatch( $request ); 118 118 $data = $response->get_data(); 119 $this->assert Equals( 'view', $data['endpoints'][0]['args']['context']['default'] );119 $this->assertSame( 'view', $data['endpoints'][0]['args']['context']['default'] ); 120 120 $this->assertEqualSets( array( 'view', 'edit', 'embed' ), $data['endpoints'][0]['args']['context']['enum'] ); 121 121 } … … 126 126 $response = rest_get_server()->dispatch( $request ); 127 127 $data = $response->get_data(); 128 $this->assert Equals( 200, $response->get_status() );128 $this->assertSame( 200, $response->get_status() ); 129 129 $this->assertCount( $this->total_revisions, $data ); 130 130 131 131 // Reverse chronology. 132 $this->assert Equals( $this->revision_id3, $data[0]['id'] );132 $this->assertSame( $this->revision_id3, $data[0]['id'] ); 133 133 $this->check_get_revision_response( $data[0], $this->revision_3 ); 134 134 135 $this->assert Equals( $this->revision_id2, $data[1]['id'] );135 $this->assertSame( $this->revision_id2, $data[1]['id'] ); 136 136 $this->check_get_revision_response( $data[1], $this->revision_2 ); 137 137 138 $this->assert Equals( $this->revision_id1, $data[2]['id'] );138 $this->assertSame( $this->revision_id1, $data[2]['id'] ); 139 139 $this->check_get_revision_response( $data[2], $this->revision_1 ); 140 140 } … … 169 169 $request = new WP_REST_Request( 'GET', '/wp/v2/posts/' . self::$post_id . '/revisions/' . $this->revision_id1 ); 170 170 $response = rest_get_server()->dispatch( $request ); 171 $this->assert Equals( 200, $response->get_status() );171 $this->assertSame( 200, $response->get_status() ); 172 172 $this->check_get_revision_response( $response, $this->revision_1 ); 173 173 $fields = array( … … 263 263 $request->set_param( 'force', true ); 264 264 $response = rest_get_server()->dispatch( $request ); 265 $this->assert Equals( 200, $response->get_status() );265 $this->assertSame( 200, $response->get_status() ); 266 266 $this->assertNull( get_post( $this->revision_id1 ) ); 267 267 } … … 309 309 $request = new WP_REST_Request( 'GET', '/wp/v2/posts/' . self::$post_id . '/revisions/' . $this->revision_id1 ); 310 310 $response = rest_get_server()->dispatch( $request ); 311 $this->assert Equals( 200, $response->get_status() );311 $this->assertSame( 200, $response->get_status() ); 312 312 $this->check_get_revision_response( $response, $this->revision_1 ); 313 313 } … … 321 321 $revision = get_post( $this->revision_id1 ); 322 322 $response = $endpoint->prepare_item_for_response( $revision, $request ); 323 $this->assert Equals(323 $this->assertSame( 324 324 array( 325 325 'id', … … 335 335 $data = $response->get_data(); 336 336 $properties = $data['schema']['properties']; 337 $this->assert Equals( 12, count( $properties ) );337 $this->assertSame( 12, count( $properties ) ); 338 338 $this->assertArrayHasKey( 'author', $properties ); 339 339 $this->assertArrayHasKey( 'content', $properties ); … … 387 387 388 388 $this->assertArrayHasKey( 'my_custom_int', $data['schema']['properties'] ); 389 $this->assert Equals( $schema, $data['schema']['properties']['my_custom_int'] );389 $this->assertSame( $schema, $data['schema']['properties']['my_custom_int'] ); 390 390 391 391 wp_set_current_user( 1 ); … … 420 420 421 421 $rendered_content = apply_filters( 'the_content', $revision->post_content ); 422 $this->assert Equals( $rendered_content, $response['content']['rendered'] );423 424 $this->assert Equals( mysql_to_rfc3339( $revision->post_date ), $response['date'] );425 $this->assert Equals( mysql_to_rfc3339( $revision->post_date_gmt ), $response['date_gmt'] );422 $this->assertSame( $rendered_content, $response['content']['rendered'] ); 423 424 $this->assertSame( mysql_to_rfc3339( $revision->post_date ), $response['date'] ); 425 $this->assertSame( mysql_to_rfc3339( $revision->post_date_gmt ), $response['date_gmt'] ); 426 426 427 427 $rendered_excerpt = apply_filters( 'the_excerpt', apply_filters( 'get_the_excerpt', $revision->post_excerpt, $revision ) ); 428 $this->assert Equals( $rendered_excerpt, $response['excerpt']['rendered'] );428 $this->assertSame( $rendered_excerpt, $response['excerpt']['rendered'] ); 429 429 430 430 $rendered_guid = apply_filters( 'get_the_guid', $revision->guid, $revision->ID ); 431 $this->assert Equals( $rendered_guid, $response['guid']['rendered'] );432 433 $this->assert Equals( $revision->ID, $response['id'] );434 $this->assert Equals( mysql_to_rfc3339( $revision->post_modified ), $response['modified'] );435 $this->assert Equals( mysql_to_rfc3339( $revision->post_modified_gmt ), $response['modified_gmt'] );436 $this->assert Equals( $revision->post_name, $response['slug'] );431 $this->assertSame( $rendered_guid, $response['guid']['rendered'] ); 432 433 $this->assertSame( $revision->ID, $response['id'] ); 434 $this->assertSame( mysql_to_rfc3339( $revision->post_modified ), $response['modified'] ); 435 $this->assertSame( mysql_to_rfc3339( $revision->post_modified_gmt ), $response['modified_gmt'] ); 436 $this->assertSame( $revision->post_name, $response['slug'] ); 437 437 438 438 $rendered_title = get_the_title( $revision->ID ); 439 $this->assert Equals( $rendered_title, $response['title']['rendered'] );439 $this->assertSame( $rendered_title, $response['title']['rendered'] ); 440 440 441 441 $parent = get_post( $revision->post_parent ); … … 443 443 $parent_object = get_post_type_object( $parent->post_type ); 444 444 $parent_base = ! empty( $parent_object->rest_base ) ? $parent_object->rest_base : $parent_object->name; 445 $this->assert Equals( rest_url( '/wp/v2/' . $parent_base . '/' . $revision->post_parent ), $links['parent'][0]['href'] );445 $this->assertSame( rest_url( '/wp/v2/' . $parent_base . '/' . $revision->post_parent ), $links['parent'][0]['href'] ); 446 446 } 447 447 … … 454 454 $parent_post_id = wp_is_post_revision( $post->ID ); 455 455 456 $this->assert Equals( $post->ID, $this->revision_id1 );457 $this->assert Equals( $parent_post_id, self::$post_id );456 $this->assertSame( $post->ID, $this->revision_id1 ); 457 $this->assertSame( $parent_post_id, self::$post_id ); 458 458 } 459 459
Note: See TracChangeset
for help on using the changeset viewer.