function XMLSitemapNodeFunctionalTest::testTypeSettings in XML sitemap 6.2
Same name and namespace in other branches
- 7.2 xmlsitemap_node/xmlsitemap_node.test \XMLSitemapNodeFunctionalTest::testTypeSettings()
Test the content type settings.
File
- xmlsitemap_node/
xmlsitemap_node.test, line 75 - Unit tests for the xmlsitemap_node module.
Class
- XMLSitemapNodeFunctionalTest
- @file Unit tests for the xmlsitemap_node module.
Code
function testTypeSettings() {
$this
->drupalLogin($this->admin_user);
$node_old = $this
->drupalCreateNode();
$this
->assertSitemapLinkValues('node', $node_old->nid, array(
'status' => 1,
'priority' => 0.5,
));
$edit = array(
'xmlsitemap[status]' => 0,
'xmlsitemap[priority]' => '0.0',
);
$this
->drupalPost('admin/content/node-type/page', $edit, t('Save content type'));
$this
->assertText('The content type Page has been updated.');
$node = $this
->drupalCreateNode();
$this
->assertSitemapLinkValues('node', $node->nid, array(
'status' => 0,
'priority' => 0.0,
));
$this
->assertSitemapLinkValues('node', $node_old->nid, array(
'status' => 0,
'priority' => 0.0,
));
$edit = array(
'type' => 'page2',
'xmlsitemap[status]' => 1,
'xmlsitemap[priority]' => '0.5',
);
$this
->drupalPost('admin/content/node-type/page', $edit, t('Save content type'));
$this
->assertText('Changed the content type of 2 posts from page to page2.');
$this
->assertText('The content type Page has been updated.');
$this
->assertSitemapLinkValues('node', $node->nid, array(
'subtype' => 'page2',
'status' => 1,
'priority' => 0.5,
));
$this
->assertSitemapLinkValues('node', $node_old->nid, array(
'subtype' => 'page2',
'status' => 1,
'priority' => 0.5,
));
$this
->assertEqual(count(xmlsitemap_link_load_multiple(array(
'type' => 'node',
'subtype' => 'page',
))), 0);
$this
->assertEqual(count(xmlsitemap_link_load_multiple(array(
'type' => 'node',
'subtype' => 'page2',
))), 2);
$this
->drupalPost('admin/content/node-type/page2/delete', array(), t('Delete'));
$this
->assertText('The content type Page has been deleted.');
$this
->assertFalse(xmlsitemap_link_load_multiple(array(
'type' => 'node',
'subtype' => 'page2',
)), 'Nodes with deleted node type removed from {xmlsitemap}.');
}