diff --git a/page_manager/tests/head_links.test b/page_manager/tests/head_links.test index 2df3243..27f45a2 100644 --- a/page_manager/tests/head_links.test +++ b/page_manager/tests/head_links.test @@ -8,30 +8,67 @@ * Test the head links. */ class HeadLinksTestCase extends DrupalWebTestCase { + /** + * {@inheritdoc} + */ public static function getInfo() { return array( 'name' => 'Head links test', - 'description' => '...', + 'description' => 'Checks that the shortlink and canonical links are present on a node page overriden by Page manager', 'group' => 'Chaos Tools Suite', ); } - function setUp() { - parent::setUp('ctools', 'page_manager'); + /** + * {@inheritdoc} + */ + public function setUp() { + parent::setUp('page_manager'); + + // First add an override for "node/%node". + variable_set('page_manager_node_view_disabled', FALSE); + + $record = (object) array( + 'name' => 'node_view__http_response_707659df-062d-4252-8c2a-22a8e0289cd4', + 'task' => 'node_view', + 'subtask' => '', + 'handler' => 'http_response', + 'weight' => '1', + 'conf' => array( + 'title' => 'Test', + 'contexts' => array( + 0 => array( + 'identifier' => 'String', + 'keyword' => 'string', + 'name' => 'string', + 'string' => 'Test', + 'id' => 1, + ), + ), + 'relationships' => array(), + 'code' => '404', + 'destination' => '', + 'name' => '', + ), + ); + + page_manager_save_task_handler($record); + + menu_rebuild(); } /** - * Test the head links. + * Test the presence of the head links. */ - function testHeadLinks() { + public function testHeadLinks() { $node = $this->drupalCreateNode(); - $url = url('node/' . $node->nid); + $url = 'node/' . $node->nid; $this->drupalGet($url); $shortlink = $this->xpath('//head//link[@rel="shortlink"]'); - $this->assertEqual($url, (string) $shortlink[0]['href']); + $this->assertEqual(url($url), (string) $shortlink[0]['href']); $canonical = $this->xpath('//head//link[@rel="canonical"]'); - $this->assertEqual($url, (string) $canonical[0]['href']); + $this->assertEqual(url($url), (string) $canonical[0]['href']); } }