public function ServicesResourceNodetests::testEndpointResourceNodeCreateMissingTitle in Services 7.3
Same name and namespace in other branches
- 6.3 tests/functional/ServicesResourceNodeTests.test \ServicesResourceNodetests::testEndpointResourceNodeCreateMissingTitle()
testing node_resource Validate missing Title
File
- tests/
functional/ ServicesResourceNodeTests.test, line 251 - 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 testEndpointResourceNodeCreateMissingTitle() {
// Create and log in our privileged user.
$this->privilegedUser = $this
->drupalCreateUser(array(
'administer services',
'bypass node access',
));
$this
->drupalLogin($this->privilegedUser);
$node = array(
'title' => '',
'body' => array(
LANGUAGE_NONE => array(
array(
'value' => $this
->randomString(),
),
),
),
'type' => 'page',
'name' => $this->privilegedUser->name,
'language' => LANGUAGE_NONE,
);
$responseArray = $this
->servicesPost($this->endpoint->path . '/node', array(
'node' => $node,
));
$nodeResourceUpdateReturn = $responseArray['body'];
$this
->assertTrue(strpos($responseArray['status'], 'Title field is required.'), 'Node was not created without title.', 'NodeResource: Create');
}