You are here

public function XMLSitemapUnitTest::testCalculateChangefreq in XML sitemap 7.2

Same name and namespace in other branches
  1. 6.2 xmlsitemap.test \XMLSitemapUnitTest::testCalculateChangefreq()

Tests for xmlsitemap_calculate_changereq().

File

./xmlsitemap.test, line 547
Unit tests for the xmlsitemap.

Class

XMLSitemapUnitTest
XML Sitemap UnitTest.

Code

public function testCalculateChangefreq() {

  // The test values.
  $values = array(
    array(),
    array(
      REQUEST_TIME,
    ),
    array(
      REQUEST_TIME,
      REQUEST_TIME - 200,
    ),
    array(
      REQUEST_TIME - 200,
      REQUEST_TIME,
      REQUEST_TIME - 600,
    ),
  );

  // Expected values.
  $expected = array(
    0,
    0,
    200,
    300,
  );
  foreach ($values as $i => $value) {
    $actual = xmlsitemap_calculate_changefreq($value);
    $this
      ->assertEqual($actual, $expected[$i]);
  }
}