You are here

public function ServicesResourceNodetests::testEndpointResourceNodeUpdateMissingTitle in Services 7.3

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

testing node_resource Update verify missing title

File

tests/functional/ServicesResourceNodeTests.test, line 436
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 testEndpointResourceNodeUpdateMissingTitle() {

  // Create and log in our privileged user.
  $this->privilegedUser = $this
    ->drupalCreateUser(array(
    'administer services',
    'bypass node access',
  ));
  $this
    ->drupalLogin($this->privilegedUser);
  $node = $this
    ->drupalCreateNode();
  $node_update = array(
    'title' => '',
    'body' => array(
      LANGUAGE_NONE => array(
        array(
          'value' => $this
            ->randomString(),
        ),
      ),
    ),
    'name' => $this->privilegedUser->name,
    'type' => 'page',
  );
  $responseArray = $this
    ->servicesPut($this->endpoint->path . '/node/' . $node->nid, array(
    'node' => $node_update,
  ));
  $this
    ->assertTrue(strpos($responseArray['status'], 'Title field is required.'), 'Node was not updated without title.', 'NodeResource: Update');
}