-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathnextprev_links.test
72 lines (62 loc) · 2.54 KB
/
nextprev_links.test
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
<?php
/**
* @file
* Definition of NextPrevLinksTest.
*/
/**
* Tests the pluggable pager system.
*/
class NextPrevLinksTest extends ViewsSqlTest {
public static function getInfo() {
return array(
'name' => 'Next Prev Links',
'description' => 'Test the setting of rel next and prev links',
'group' => 'Next Prev Links',
);
}
public function setUp() {
parent::setUp('nextprev_links', 'views');
module_enable(array('nextprev_links_test'));
$this->resetAll();
}
/**
* Test that rel links are introduced for Views displays.
*/
function testNextPrevLinksRel() {
for ($i = 0; $i < 16; $i++) {
$this->drupalCreateNode();
}
$page = 'test_pager_nextprev_links_page';
$this->drupalGet($page);
$this->assertLink(t('last »'));
$this->assertNoLink(t('« first'));
$this->assertRaw('<link rel="next" href="/' . $page . '?page=1" />', 'Next URL was found in the HTML head');
$this->assertNoRaw('<link rel="prev"', 'Prev URL was not found in the HTML head');
$this->clickLink(t('last »'));
$this->assertLink(t('« first'));
$this->assertNoLink(t('last »'));
$this->assertNoRaw('<link rel="next"', 'Next URL was not found in the HTML head');
$this->assertRaw('<link rel="prev" href="/' . $page . '?page=2" />', 'Prev URL was found in the HTML head');
$this->clickLink(t('‹ previous'));
$this->assertLink(t('« first'));
$this->assertLink(t('last »'));
$this->assertRaw('<link rel="next" href="/' . $page . '?page=3" />', 'Next URL was found in the HTML head');
$this->assertRaw('<link rel="prev" href="/' . $page . '?page=1" />', 'Prev URL was found in the HTML head');
$page = 'test_pager_full_page';
$this->drupalGet($page);
$this->assertLink(t('last »'));
$this->assertNoLink(t('« first'));
$this->assertNoRaw('<link rel="next"', 'Next URL was not found in the HTML head');
$this->assertNoRaw('<link rel="prev"', 'Prev URL was not found in the HTML head');
$this->clickLink(t('last »'));
$this->assertLink(t('« first'));
$this->assertNoLink(t('last »'));
$this->assertNoRaw('<link rel="next"', 'Next URL was not found in the HTML head');
$this->assertNoRaw('<link rel="prev"', 'Prev URL was not found in the HTML head');
$this->clickLink(t('‹ previous'));
$this->assertLink(t('« first'));
$this->assertLink(t('last »'));
$this->assertNoRaw('<link rel="next"', 'Next URL was not found in the HTML head');
$this->assertNoRaw('<link rel="prev"', 'Prev URL was not found in the HTML head');
}
}