function XMLSitemapUnitTest::testGetChangefreq in XML sitemap 6.2
Same name and namespace in other branches
- 7.2 xmlsitemap.test \XMLSitemapUnitTest::testGetChangefreq()
Tests for xmlsitemap_get_changefreq().
File
- ./
xmlsitemap.test, line 373 - Unit tests for the xmlsitemap module.
Class
Code
function testGetChangefreq() {
// The test values.
$values = array(
0,
mt_rand(1, XMLSITEMAP_FREQUENCY_ALWAYS),
mt_rand(XMLSITEMAP_FREQUENCY_ALWAYS + 1, XMLSITEMAP_FREQUENCY_HOURLY),
mt_rand(XMLSITEMAP_FREQUENCY_HOURLY + 1, XMLSITEMAP_FREQUENCY_DAILY),
mt_rand(XMLSITEMAP_FREQUENCY_DAILY + 1, XMLSITEMAP_FREQUENCY_WEEKLY),
mt_rand(XMLSITEMAP_FREQUENCY_WEEKLY + 1, XMLSITEMAP_FREQUENCY_MONTHLY),
mt_rand(XMLSITEMAP_FREQUENCY_MONTHLY + 1, XMLSITEMAP_FREQUENCY_YEARLY),
mt_rand(XMLSITEMAP_FREQUENCY_YEARLY + 1, mt_getrandmax()),
);
// The expected values.
$expected = array(
FALSE,
'always',
'hourly',
'daily',
'weekly',
'monthly',
'yearly',
'never',
);
foreach ($values as $i => $value) {
$actual = xmlsitemap_get_changefreq($value);
$this
->assertIdentical($actual, $expected[$i]);
}
}