DefaultViewWithCustomTemplateTest   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 0
Metric Value
dl 0
loc 41
c 0
b 0
f 0
wmc 3
lcom 1
cbo 3
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A createView() 0 6 1
A testRenderNormal() 0 26 1
A filterExpectedView() 0 4 1
1
<?php
2
3
namespace Pagerfanta\Tests\View;
4
5
use Pagerfanta\View\DefaultView;
6
use Pagerfanta\View\Template\TwitterBootstrapTemplate;
7
8
class DefaultViewWithCustomTemplateTest extends ViewTestCase
9
{
10
    protected function createView()
11
    {
12
        $template = new TwitterBootstrapTemplate();
13
14
        return new DefaultView($template);
15
    }
16
17
    public function testRenderNormal()
18
    {
19
        $this->setNbPages(100);
20
        $this->setCurrentPage(10);
21
22
        $options = array();
23
24
        $this->assertRenderedView(<<<EOF
25
<div class="pagination">
26
    <ul>
27
        <li class="prev"><a href="|9|" rel="prev">&larr; Previous</a></li>
28
        <li><a href="|1|">1</a></li>
29
        <li class="disabled"><span>&hellip;</span></li>
30
        <li><a href="|8|">8</a></li>
31
        <li><a href="|9|">9</a></li>
32
        <li class="active"><span>10</span></li>
33
        <li><a href="|11|">11</a></li>
34
        <li><a href="|12|">12</a></li>
35
        <li class="disabled"><span>&hellip;</span></li>
36
        <li><a href="|100|">100</a></li>
37
        <li class="next"><a href="|11|" rel="next">Next &rarr;</a></li>
38
    </ul>
39
</div>
40
EOF
41
        , $this->renderView($options));
42
    }
43
44
    protected function filterExpectedView($expected)
45
    {
46
        return $this->removeWhitespacesBetweenTags($expected);
47
    }
48
}
49