You are here

function XMLSitemapUnitTest::testMinimumLifetime in XML sitemap 6.2

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

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

File

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

Class

XMLSitemapUnitTest

Code

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