You are here

function XMLSitemapUnitTest::testCalculateChangefreq in XML sitemap 6.2

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

Tests for xmlsitemap_calculate_changereq().

File

./xmlsitemap.test, line 450
Unit tests for the xmlsitemap module.

Class

XMLSitemapUnitTest

Code

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]);
  }
}