You are here

function XMLSitemapFunctionalTest::testSitemapCaching in XML sitemap 6.2

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

Test the sitemap file caching.

File

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

Class

XMLSitemapFunctionalTest

Code

function testSitemapCaching() {
  $this
    ->regenerateSitemap();
  $this
    ->drupalGetSitemap();
  $this
    ->assertResponse(200);
  $etag = $this
    ->drupalGetHeader('etag');
  $last_modified = $this
    ->drupalGetHeader('last-modified');
  $this
    ->assertTrue($etag, t('Etag header found.'));
  $this
    ->assertTrue($last_modified, t('Last-modified header found.'));
  $this
    ->drupalGetSitemap(array(), array(), array(
    'If-Modified-Since: ' . $last_modified,
    'If-None-Match: ' . $etag,
  ));
  $this
    ->assertResponse(304);
}