You are here

function AkamaiTestCase::testAliasClear in Akamai 8

Same name and namespace in other branches
  1. 8.2 akamai.test \AkamaiTestCase::testAliasClear()
  2. 7.3 akamai.test \AkamaiTestCase::testAliasClear()
  3. 7 akamai.test \AkamaiTestCase::testAliasClear()
  4. 7.2 akamai.test \AkamaiTestCase::testAliasClear()

Tests clear with 1 alias.

File

./akamai.test, line 59
Akamai tests.

Class

AkamaiTestCase
Test basic API.

Code

function testAliasClear() {
  $node = $this
    ->drupalCreateNode(array(
    'type' => 'page',
    'promote' => 1,
  ));
  $canonical = "node/{$node->nid}";
  $cleanurl = "content/pretty-title/{$node->nid}";
  $alias = array(
    'source' => $canonical,
    'alias' => $cleanurl,
  );
  path_save($alias);
  $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($cleanurl, $paths[1], "Correct alias was cleared");
}