public function ServicesResourceNodetests::testNewEndpointResourceNodeGet in Services 6.3
Same name and namespace in other branches
- 7.3 tests/functional/ServicesResourceNodeTests.test \ServicesResourceNodetests::testNewEndpointResourceNodeGet()
testing node_resource Get
File
- tests/
functional/ ServicesResourceNodeTests.test, line 115
Class
- ServicesResourceNodetests
- Run test cases for the endpoint with no authentication turned on.
Code
public function testNewEndpointResourceNodeGet() {
// Create and log in our privileged user.
$this->privilegedUser = $this
->drupalCreateUser(array(
'administer services',
));
$this
->drupalLogin($this->privilegedUser);
$node = $this
->drupalCreateNode();
$responseArray = $this
->servicesGet($this->endpoint->path . '/node/' . $node->nid);
$this
->assertTrue($node->title == $responseArray['body']->title, t('Successfully received Node info'), 'NodeResource: Retrieve');
//Verify node not found.
unset($node);
$responseArray = $this
->servicesGet($this->endpoint->path . '/node/99');
$this
->assertTrue($responseArray['code'] == '404', t('Successfully was rejected to non existent node'), 'NodeResource: Retrieve');
}