function OverrideNodeOptionsTestCase::testNodeAuthor in Override Node Options 6
Same name and namespace in other branches
- 8 override_node_options.test \OverrideNodeOptionsTestCase::testNodeAuthor()
Test the 'Authoring information' fieldset.
File
- ./
override_node_options.test, line 103 - Unit tests for the override_node_options module.
Class
- OverrideNodeOptionsTestCase
- @file Unit tests for the override_node_options module.
Code
function testNodeAuthor() {
$this->admin_user = $this
->drupalCreateUser(array(
'create page content',
'edit any page content',
'override page authored on option',
'override page authored by option',
));
$this
->drupalLogin($this->admin_user);
$this
->drupalPost('node/' . $this->node->nid . '/edit', array(
'name' => 'invalid-user',
), t('Save'));
$this
->assertText('The username invalid-user does not exist.');
$this
->drupalPost('node/' . $this->node->nid . '/edit', array(
'date' => 'invalid-date',
), t('Save'));
$this
->assertText('You have to specify a valid date.');
$time = time() + 500;
$fields = array(
'name' => '',
'date' => format_date($time, 'custom', 'Y-m-d H:i:s O'),
);
$this
->drupalPost('node/' . $this->node->nid . '/edit', $fields, t('Save'));
$this
->assertNodeFieldsUpdated($this->node, array(
'uid' => 0,
'created' => $time,
));
$this
->drupalLogin($this->normal_user);
$this
->assertNodeFieldsNoAccess($this->node, array_keys($fields));
}