Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 15
0.00% covered (danger)
0.00%
0 / 1
CRAP
0.00% covered (danger)
0.00%
0 / 1
phpbb_functional_paging_test
0.00% covered (danger)
0.00%
0 / 15
0.00% covered (danger)
0.00%
0 / 1
6
0.00% covered (danger)
0.00%
0 / 1
 test_pagination
0.00% covered (danger)
0.00%
0 / 15
0.00% covered (danger)
0.00%
0 / 1
6
1<?php
2/**
3*
4* This file is part of the phpBB Forum Software package.
5*
6* @copyright (c) phpBB Limited <https://www.phpbb.com>
7* @license GNU General Public License, version 2 (GPL-2.0)
8*
9* For full copyright and license information, please see
10* the docs/CREDITS.txt file.
11*
12*/
13
14/**
15* @group functional
16*/
17class phpbb_functional_paging_test extends phpbb_functional_test_case
18{
19
20    public function test_pagination()
21    {
22        $this->login();
23
24        $post = $this->create_topic(2, 'Test Topic 1', 'This is a test topic posted by the testing framework.');
25        for ($post_id = 1; $post_id <= 16; $post_id++)
26        {
27            $this->create_post(2, $post['topic_id'], 'Re: Test Topic 1', 'This is a test post no' . $post_id . ' posted by the testing framework.');
28        }
29        $crawler = self::request('GET', "viewtopic.php?t={$post['topic_id']}&sid={$this->sid}");
30        $this->assertStringContainsString('post no4', $crawler->text());
31        $this->assertStringNotContainsString('post no16', $crawler->text());
32
33        $next_link = $crawler->filter('.pagination > ul > li.next > a')->attr('href');
34        $crawler = self::request('GET', $next_link);
35        $this->assertStringNotContainsString('post no4', $crawler->text());
36        $this->assertStringContainsString('post no16', $crawler->text());
37
38        $prev_link = $crawler->filter('.pagination > ul > li.previous > a')->attr('href');
39        $crawler = self::request('GET', $prev_link);
40        $this->assertStringContainsString('post no4', $crawler->text());
41        $this->assertStringNotContainsString('post no16', $crawler->text());
42    }
43}