public function XMLSitemapUnitTest::testLinkDelete in XML sitemap 7.2
Same name and namespace in other branches
- 6.2 xmlsitemap.test \XMLSitemapUnitTest::testLinkDelete()
Tests for xmlsitemap_link_delete().
File
- ./
xmlsitemap.test, line 697 - Unit tests for the xmlsitemap.
Class
- XMLSitemapUnitTest
- XML Sitemap UnitTest.
Code
public function testLinkDelete() {
// Add our testing data.
$link1 = $this
->addSitemapLink(array(
'loc' => 'testing1',
'status' => 0,
));
$link2 = $this
->addSitemapLink(array(
'loc' => 'testing1',
'status' => 1,
));
$link3 = $this
->addSitemapLink(array(
'status' => 0,
));
variable_set('xmlsitemap_regenerate_needed', FALSE);
// Test delete multiple links.
// Test that the regenerate flag is set when visible links are deleted.
$deleted = xmlsitemap_link_delete_multiple(array(
'loc' => 'testing1',
));
$this
->assertEqual($deleted, 2);
$this
->assertFalse(xmlsitemap_link_load($link1['type'], $link1['id']));
$this
->assertFalse(xmlsitemap_link_load($link2['type'], $link2['id']));
$this
->assertTrue(xmlsitemap_link_load($link3['type'], $link3['id']));
$this
->assertFlag('regenerate_needed', TRUE);
$deleted = xmlsitemap_link_delete($link3['type'], $link3['id']);
$this
->assertEqual($deleted, 1);
$this
->assertFalse(xmlsitemap_link_load($link3['type'], $link3['id']));
$this
->assertFlag('regenerate_needed', FALSE);
}