function XMLSitemapNodeFunctionalTest::testNodeSettings in XML sitemap 6.2
Same name and namespace in other branches
- 7.2 xmlsitemap_node/xmlsitemap_node.test \XMLSitemapNodeFunctionalTest::testNodeSettings()
File
- xmlsitemap_node/
xmlsitemap_node.test, line 30 - Unit tests for the xmlsitemap_node module.
Class
- XMLSitemapNodeFunctionalTest
- @file Unit tests for the xmlsitemap_node module.
Code
function testNodeSettings() {
$node = $this
->drupalCreateNode(array(
'status' => FALSE,
'uid' => $this->normal_user->uid,
));
$this
->assertSitemapLinkValues('node', $node->nid, array(
'access' => 0,
'status' => 1,
'priority' => 0.5,
'status_override' => 0,
'priority_override' => 0,
));
$this
->drupalLogin($this->normal_user);
$this
->drupalGet('node/' . $node->nid . '/edit');
$this
->assertNoField('xmlsitemap[status]');
$this
->assertNoField('xmlsitemap[priority]');
$edit = array(
'title' => 'Test node title',
'body' => 'Test node body',
);
$this
->drupalPost('node/' . $node->nid . '/edit', $edit, t('Save'));
$this
->assertText('Page Test node title has been updated.');
$this
->assertSitemapLinkValues('node', $node->nid, array(
'access' => 0,
'status' => 1,
'priority' => 0.5,
'status_override' => 0,
'priority_override' => 0,
));
$this
->drupalLogin($this->admin_user);
$this
->drupalGet('node/' . $node->nid . '/edit');
$this
->assertField('xmlsitemap[status]');
$this
->assertField('xmlsitemap[priority]');
$edit = array(
'xmlsitemap[status]' => 0,
'xmlsitemap[priority]' => 0.9,
'status' => TRUE,
);
$this
->drupalPost('node/' . $node->nid . '/edit', $edit, t('Save'));
$node = node_load($node->nid);
$this
->assertText('Page Test node title has been updated.');
$this
->assertSitemapLinkValues('node', $node->nid, array(
'access' => 1,
'status' => 0,
'priority' => 0.9,
'status_override' => 1,
'priority_override' => 1,
));
$edit = array(
'xmlsitemap[status]' => 'default',
'xmlsitemap[priority]' => 'default',
'status' => FALSE,
);
$this
->drupalPost('node/' . $node->nid . '/edit', $edit, t('Save'));
$this
->assertText('Page Test node title has been updated.');
$this
->assertSitemapLinkValues('node', $node->nid, array(
'access' => 0,
'status' => 1,
'priority' => 0.5,
'status_override' => 0,
'priority_override' => 0,
));
}