You are here

public function ServicesResourceNodetests::testEndpointResourceNodeCreateMissingTitle in Services 6.3

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

testing node_resource Validate missing Title

File

tests/functional/ServicesResourceNodeTests.test, line 213

Class

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

Code

public function testEndpointResourceNodeCreateMissingTitle() {

  // Create and log in our privileged user.
  $this->privilegedUser = $this
    ->drupalCreateUser(array(
    'administer services',
    'administer nodes',
  ));
  $this
    ->drupalLogin($this->privilegedUser);
  $node = array(
    'title' => '',
    'body' => 'bodytest',
    'name' => $this->privilegedUser->name,
    'type' => 'page',
  );
  $response_array = $this
    ->servicesPost($this->endpoint->path . '/node', $node);
  $this
    ->assertEqual($response_array['body'], t('Title field is required.'), t('Node was not created without title.'), 'NodeResource: Created');
}