function XMLSitemapUnitTest::testUpdateLinks in XML sitemap 6.2
Same name and namespace in other branches
- 7.2 xmlsitemap.test \XMLSitemapUnitTest::testUpdateLinks()
Tests for xmlsitemap_link_update_multiple().
File
- ./
xmlsitemap.test, line 615 - Unit tests for the xmlsitemap module.
Class
Code
function testUpdateLinks() {
// Add our testing data.
$links = array();
$links[1] = $this
->addSitemapLink(array(
'subtype' => 'group1',
));
$links[2] = $this
->addSitemapLink(array(
'subtype' => 'group1',
));
$links[3] = $this
->addSitemapLink(array(
'subtype' => 'group2',
));
variable_set('xmlsitemap_regenerate_needed', FALSE);
// id | type | subtype | language | access | status | priority
// 1 | testing | group1 | '' | 1 | 1 | 0.5
// 2 | testing | group1 | '' | 1 | 1 | 0.5
// 3 | testing | group2 | '' | 1 | 1 | 0.5
$updated = xmlsitemap_link_update_multiple(array(
'status' => 0,
), array(
'type' => 'testing',
'subtype' => 'group1',
'status_override' => 0,
));
$this
->assertEqual($updated, 2);
$this
->assertFlag('regenerate_needed', TRUE);
// id | type | subtype | language | status | priority
// 1 | testing | group1 | '' | 0 | 0.5
// 2 | testing | group1 | '' | 0 | 0.5
// 3 | testing | group2 | '' | 1 | 0.5
$updated = xmlsitemap_link_update_multiple(array(
'priority' => 0.0,
), array(
'type' => 'testing',
'subtype' => 'group1',
'priority_override' => 0,
));
$this
->assertEqual($updated, 2);
$this
->assertFlag('regenerate_needed', FALSE);
// id | type | subtype | language | status | priority
// 1 | testing | group1 | '' | 0 | 0.0
// 2 | testing | group1 | '' | 0 | 0.0
// 3 | testing | group2 | '' | 1 | 0.5
$updated = xmlsitemap_link_update_multiple(array(
'subtype' => 'group2',
), array(
'type' => 'testing',
'subtype' => 'group1',
));
$this
->assertEqual($updated, 2);
$this
->assertFlag('regenerate_needed', FALSE);
// id | type | subtype | language | status | priority
// 1 | testing | group2 | '' | 0 | 0.0
// 2 | testing | group2 | '' | 0 | 0.0
// 3 | testing | group2 | '' | 1 | 0.5
$updated = xmlsitemap_link_update_multiple(array(
'status' => 1,
), array(
'type' => 'testing',
'subtype' => 'group2',
'status_override' => 0,
'status' => 0,
));
$this
->assertEqual($updated, 2);
$this
->assertFlag('regenerate_needed', TRUE);
// id | type | subtype | language | status | priority
// 1 | testing | group2 | '' | 1 | 0.0
// 2 | testing | group2 | '' | 1 | 0.0
// 3 | testing | group2 | '' | 1 | 0.5
}