public function XmlSitemapUnitTest::testCalculateChangefreq in XML sitemap 8
Same name and namespace in other branches
- 2.x tests/src/Functional/XmlSitemapUnitTest.php \Drupal\Tests\xmlsitemap\Functional\XmlSitemapUnitTest::testCalculateChangefreq()
Tests for xmlsitemap_calculate_changereq().
File
- tests/
src/ Functional/ XmlSitemapUnitTest.php, line 111
Class
- XmlSitemapUnitTest
- Unit tests for the XML sitemap module.
Namespace
Drupal\Tests\xmlsitemap\FunctionalCode
public function testCalculateChangefreq() {
$request_time = $this->time
->getRequestTime();
// The test values.
$values = [
[],
[
$request_time,
],
[
$request_time,
$request_time - 200,
],
[
$request_time - 200,
$request_time,
$request_time - 600,
],
];
// Expected values.
$expected = [
0,
0,
200,
300,
];
foreach ($values as $i => $value) {
$actual = xmlsitemap_calculate_changefreq($value);
$this
->assertEquals($expected[$i], $actual);
}
}