You are here

public function ServicesResourceNodetests::testEndpointResourceNodeUpdateMissingTitle in Services 6.3

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

testing node_resource Update verify missing title

File

tests/functional/ServicesResourceNodeTests.test, line 474

Class

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

Code

public function testEndpointResourceNodeUpdateMissingTitle() {

  // 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' => '',
    'body' => 'bodytest',
    'name' => $this->privilegedUser->name,
    'type' => 'page',
  );
  $responseArray = $this
    ->servicesPut($this->endpoint->path . '/node/' . $node->nid, $node_update);
  $this
    ->assertTrue(strpos($responseArray['status'], 'Title field is required.'), t('Node was not updated without title.'), 'NodeResource: Update');
}