Last active
March 19, 2016 16:21
-
-
Save joehoyle/4db7ba5d871338d1fb97 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* @rest-api-base-namespace: /wp/v2 | |
* @rest-api-base-path: /posts | |
*/ | |
class REST_API_Endpoint_Test extends WP_REST_Unit_Test_Case { | |
function test_create_item() { | |
$response = $this->create_item( array( | |
'title' => 'Test', | |
)); | |
$this->assertResponseEquals( array( | |
'code' => 200, | |
'data' => array( | |
'id' => 1, | |
'author' => 1, | |
), | |
'links' => array( | |
'author' => '/wp/v2/users/1', | |
), | |
), $response ); | |
// test for a subset of any data, e.g. a specific key is in the body | |
$this->assertResponseContains( array( | |
'data' => array( | |
'author' => 1, | |
), | |
'links' => array( | |
'author' => '/wp/v2/users/1', | |
), | |
), $response ); | |
$this->assertResponseCollectionEquals( array( | |
... | |
)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment