You are here

public function ServicesResourceNodetests::testEndpointResourceNodeDelete in Services 7.3

Same name and namespace in other branches
  1. 6.3 tests/functional/ServicesResourceNodeTests.test \ServicesResourceNodetests::testEndpointResourceNodeDelete()

testing node_resource Delete

File

tests/functional/ServicesResourceNodeTests.test, line 459
Call the endpoint tests when no authentication is being used.

Class

ServicesResourceNodetests
Run test cases for the endpoint with no authentication turned on.

Code

public function testEndpointResourceNodeDelete() {

  // Create and log in our privileged user.
  $this->privilegedUser = $this
    ->drupalCreateUser(array(
    'administer services',
    'bypass node access',
  ));
  $this
    ->drupalLogin($this->privilegedUser);
  $node = $this
    ->drupalCreateNode();
  $data = '';
  $responseArray = $this
    ->servicesDelete($this->endpoint->path . '/node/' . $node->nid, $data);
  $deleted_node = node_load($node->nid, NULL, TRUE);
  $this
    ->assertTrue(empty($deleted_node), 'Node was deleted.', 'NodeResource: Deleted');
  $responseArray = $this
    ->servicesDelete($this->endpoint->path . '/node/' . $node->nid, $data);
  $this
    ->assertFalse($responseArray['code'] == 200, 'Node was deleted. It shoudlnt have been because it doesnt exist', 'NodeResource: Deleted');
}