You are here

public function ServicesResourceNodetests::testEndpointResourceNodeDelete in Services 6.3

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

testing node_resource Delete

File

tests/functional/ServicesResourceNodeTests.test, line 496

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',
    'administer nodes',
  ));
  $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), t('Node was deleted.'), 'NodeResource: Deleted');
  $responseArray = $this
    ->servicesDelete($this->endpoint->path . '/node/' . $node->nid, $data);
  $this
    ->assertFalse($responseArray['code'] == 200, t('Node was deleted. It shoudlnt have been because it doesnt exist'), 'NodeResource: Deleted');
}