1 |
7e72b748
|
Assos Assos
|
<?php
|
2 |
c304a780
|
Assos Assos
|
|
3 |
7e72b748
|
Assos Assos
|
/**
|
4 |
|
|
* @file
|
5 |
|
|
* Tests the head links for page manager pages.
|
6 |
|
|
*/
|
7 |
|
|
|
8 |
|
|
/**
|
9 |
|
|
* Test the head links.
|
10 |
|
|
*/
|
11 |
|
|
class HeadLinksTestCase extends DrupalWebTestCase {
|
12 |
c304a780
|
Assos Assos
|
|
13 |
7e72b748
|
Assos Assos
|
/**
|
14 |
|
|
* {@inheritdoc}
|
15 |
|
|
*/
|
16 |
|
|
public static function getInfo() {
|
17 |
|
|
return array(
|
18 |
|
|
'name' => 'Head links test',
|
19 |
|
|
'description' => 'Checks that the shortlink and canonical links are present on a node page overriden by Page manager',
|
20 |
|
|
'group' => 'ctools',
|
21 |
|
|
);
|
22 |
|
|
}
|
23 |
|
|
|
24 |
|
|
/**
|
25 |
|
|
* {@inheritdoc}
|
26 |
|
|
*/
|
27 |
|
|
public function setUp() {
|
28 |
|
|
parent::setUp('page_manager');
|
29 |
|
|
|
30 |
|
|
// First add an override for "node/%node".
|
31 |
|
|
variable_set('page_manager_node_view_disabled', FALSE);
|
32 |
|
|
|
33 |
|
|
$record = (object) array(
|
34 |
|
|
'name' => 'node_view__http_response_707659df-062d-4252-8c2a-22a8e0289cd4',
|
35 |
|
|
'task' => 'node_view',
|
36 |
|
|
'subtask' => '',
|
37 |
|
|
'handler' => 'http_response',
|
38 |
|
|
'weight' => '1',
|
39 |
|
|
'conf' => array(
|
40 |
|
|
'title' => 'Test',
|
41 |
|
|
'contexts' => array(
|
42 |
|
|
0 => array(
|
43 |
|
|
'identifier' => 'String',
|
44 |
|
|
'keyword' => 'string',
|
45 |
|
|
'name' => 'string',
|
46 |
|
|
'string' => 'Test',
|
47 |
|
|
'id' => 1,
|
48 |
|
|
),
|
49 |
|
|
),
|
50 |
|
|
'relationships' => array(),
|
51 |
|
|
'code' => '404',
|
52 |
|
|
'destination' => '',
|
53 |
|
|
'name' => '',
|
54 |
|
|
),
|
55 |
|
|
);
|
56 |
|
|
|
57 |
|
|
page_manager_save_task_handler($record);
|
58 |
|
|
|
59 |
|
|
menu_rebuild();
|
60 |
|
|
}
|
61 |
|
|
|
62 |
|
|
/**
|
63 |
|
|
* Test the presence of the head links.
|
64 |
|
|
*/
|
65 |
|
|
public function testHeadLinks() {
|
66 |
|
|
$node = $this->drupalCreateNode();
|
67 |
|
|
$url = 'node/' . $node->nid;
|
68 |
|
|
$this->drupalGet($url);
|
69 |
|
|
|
70 |
|
|
$shortlink = $this->xpath('//head//link[@rel="shortlink"]');
|
71 |
|
|
$this->assertEqual(url($url), (string) $shortlink[0]['href'], 'shortlink url found');
|
72 |
|
|
|
73 |
|
|
$canonical = $this->xpath('//head//link[@rel="canonical"]');
|
74 |
|
|
$this->assertEqual(url($url), (string) $canonical[0]['href'], 'canonical url found');
|
75 |
|
|
}
|
76 |
c304a780
|
Assos Assos
|
|
77 |
7e72b748
|
Assos Assos
|
} |