You are here

function AkamaiTestCase::testAliasClear in Akamai 7.2

Same name and namespace in other branches
  1. 8 akamai.test \AkamaiTestCase::testAliasClear()
  2. 8.2 akamai.test \AkamaiTestCase::testAliasClear()
  3. 7.3 akamai.test \AkamaiTestCase::testAliasClear()
  4. 7 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 = !empty($response->client->paths) ? $response->client->paths : array();
  $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");
}