You are here

public function XMLSitemapUnitTest::testMinimumLifetime in XML sitemap 7.2

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

Test that the sitemap will not be genereated before the lifetime expires.

File

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

Class

XMLSitemapUnitTest
XML Sitemap UnitTest.

Code

public function testMinimumLifetime() {
  variable_set('xmlsitemap_minimum_lifetime', 300);
  $this
    ->regenerateSitemap();
  $link = $this
    ->addSitemapLink(array(
    'loc' => 'lifetime-test',
  ));
  $this
    ->cronRun();
  $this
    ->drupalGetSitemap();
  $this
    ->assertResponse(200);
  $this
    ->assertNoRaw('lifetime-test');
  variable_set('xmlsitemap_generated_last', REQUEST_TIME - 400);
  $this
    ->cronRun();
  $this
    ->drupalGetSitemap();
  $this
    ->assertRaw('lifetime-test');
  xmlsitemap_link_delete($link['type'], $link['id']);
  $this
    ->cronRun();
  $this
    ->drupalGetSitemap();
  $this
    ->assertRaw('lifetime-test');
  $this
    ->regenerateSitemap();
  $this
    ->drupalGetSitemap();
  $this
    ->assertResponse(200);
  $this
    ->assertNoRaw('lifetime-test');
}