You are here

class AkamaiHomepageTestCase in Akamai 8.2

Same name and namespace in other branches
  1. 8 akamai.test \AkamaiHomepageTestCase
  2. 7.3 akamai.test \AkamaiHomepageTestCase
  3. 7 akamai.test \AkamaiHomepageTestCase
  4. 7.2 akamai.test \AkamaiHomepageTestCase

Test basic API.

Hierarchy

Expanded class hierarchy of AkamaiHomepageTestCase

File

./akamai.test, line 121
Akamai tests.

View source
class AkamaiHomepageTestCase extends DrupalWebTestCase {
  public static function getInfo() {
    return array(
      'name' => 'Akamai Homepage Clearing',
      'description' => 'Test Akamai cache clearings of the site homepage.',
      'group' => 'Akamai',
    );
  }
  function setUp() {
    parent::setUp('akamai');
    $user = $this
      ->drupalCreateUser(array(
      'purge akamai cache',
    ));
    $this
      ->drupalLogin($user);
    variable_set('akamai_service_class', 'RecordingCacheControlClient');
    $this->node = $this
      ->drupalCreateNode(array(
      'type' => 'page',
    ));
    $this->homepage = "node/{$this->node->nid}";
    variable_set('site_frontpage', $this->homepage);
  }

  /**
   * Tests clear of homepage and rendering of block
   */
  function testHomepageClear() {
    $block = block_load('akamai', 'akamai');
    db_update('block')
      ->fields(array(
      'region' => 'footer',
      'status' => 1,
    ))
      ->condition('module', $block->module)
      ->condition('delta', $block->delta)
      ->condition('theme', $block->theme)
      ->execute();
    $this
      ->drupalGet($this->homepage);
    $this
      ->assertFieldByName('path', $this->homepage, 'The Akamai path field is set correctly');
    $this
      ->assertUniqueText(t('[frontpage]'), t('Make sure the text "[frontpage]" appears exactly once on the home page.'));
    $response = akamai_clear_url($this->homepage, array(), $this->node);
    $paths = $response['client']->paths;
    $this
      ->assertEqual(2, count($paths), "Two paths cleared");
    $this
      ->assertEqual($this->homepage, $paths[0], "Correct homepage real path was cleared");
    $this
      ->assertEqual('', $paths[1], "Correct homepage path was cleared");
  }

}

Members

Namesort descending Modifiers Type Description Overrides
AkamaiHomepageTestCase::getInfo public static function
AkamaiHomepageTestCase::setUp function
AkamaiHomepageTestCase::testHomepageClear function Tests clear of homepage and rendering of block