You are here

class AkamaiHookTestCase in Akamai 8.2

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

Test basic API.

Hierarchy

Expanded class hierarchy of AkamaiHookTestCase

File

./akamai.test, line 171
Akamai tests.

View source
class AkamaiHookTestCase extends DrupalWebTestCase {
  public static function getInfo() {
    return array(
      'name' => 'Akamai Hook Test',
      'description' => 'Test the implementation of the hooks defined by the Akamai module',
      'group' => 'Akamai',
    );
  }
  function setUp() {
    parent::setUp('akamai', 'akamai_test');
    $user = $this
      ->drupalCreateUser(array(
      'purge akamai cache',
    ));
    $this
      ->drupalLogin($user);
    variable_set('akamai_service_class', 'RecordingCacheControlClient');
  }

  /**
   * Tests clear with hook provided paths.
   */
  function testHookClear() {
    $node = $this
      ->drupalCreateNode(array(
      'type' => 'page',
      'promote' => 1,
    ));
    $canonical = "node/{$node->nid}";
    $response = akamai_clear_url($canonical, array(), $node);
    $paths = $response['client']->paths;
    $this
      ->assertEqual(2, count($paths), "Two paths cleared");
    $this
      ->assertEqual($canonical, $paths[0], "Correct canonical path was cleared");
    $this
      ->assertEqual("akamai/paths/alter/test", $paths[1], "Correct hook provided path was cleared");
  }

  /**
   * Tests clear with no paths.
   */
  function testEmptyClear() {
    $response = akamai_clear_url('clear/me');
    $this
      ->assertFalse($response, "False returned");
  }

}

Members

Namesort descending Modifiers Type Description Overrides
AkamaiHookTestCase::getInfo public static function
AkamaiHookTestCase::setUp function
AkamaiHookTestCase::testEmptyClear function Tests clear with no paths.
AkamaiHookTestCase::testHookClear function Tests clear with hook provided paths.