public function ServicesResourceNodetests::testEndpointResourceNodeUpdateLegacy in Services 6.3
Same name and namespace in other branches
- 7.3 tests/functional/ServicesResourceNodeTests.test \ServicesResourceNodetests::testEndpointResourceNodeUpdateLegacy()
Testing node_resource Update (Legacy).
TODO: To be removed in future version.
See also
http://drupal.org/node/1083242
File
- tests/
functional/ ServicesResourceNodeTests.test, line 420
Class
- ServicesResourceNodetests
- Run test cases for the endpoint with no authentication turned on.
Code
public function testEndpointResourceNodeUpdateLegacy() {
// Create and log in our privileged user.
$this->privilegedUser = $this
->drupalCreateUser(array(
'administer services',
'administer nodes',
));
$this
->drupalLogin($this->privilegedUser);
$node = $this
->drupalCreateNode();
$node_update = array(
'title' => 'testing',
'body' => 'bodytest',
'type' => 'page',
'name' => $this->privilegedUser->name,
);
$responseArray = $this
->servicesPut($this->endpoint->path . '/node/' . $node->nid, array(
'node' => $node_update,
));
$nodeAfterUpdate = node_load($responseArray['body']['nid']);
$this
->assertTrue(isset($nodeAfterUpdate->nid), t('Node was successfully updated'), 'NodeResource: Updated (Legacy)');
if (isset($nodeAfterUpdate->nid)) {
$this
->assertTrue($nodeAfterUpdate->title == $node_update['title'], t('Title was the same'), 'NodeResource: Update (Legacy)');
$this
->assertTrue($nodeAfterUpdate->body == $node_update['body'], t('Body was the same'), 'NodeResource: Update (Legacy)');
}
}