Completed
Pull Request — master (#58)
by
unknown
12:29 queued 10:55
created

LinkSorterTest::testWidget()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 13
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 10
c 1
b 0
f 0
dl 0
loc 13
rs 9.9332
cc 1
nc 1
nop 0
1
<?php
2
declare(strict_types=1);
3
4
namespace Yiisoft\Widget\Tests;
5
6
use Yiisoft\Data\Reader\Sort;
7
use Yiisoft\Tests\TestCase;
8
use Yiisoft\Widget\LinkSorter;
9
10
/**
11
 * SpacelessTest.
12
 */
13
class LinkSorterTest extends TestCase
14
{
15
    public function testEmptyWidget(): void
16
    {
17
        $widget = LinkSorter::widget()
18
            ->sort(new Sort([]));
19
20
        $this->assertEquals('<ul class="sorter"></ul>', $widget->run());
21
    }
22
23
    public function testWidget(): void
24
    {
25
        $widget = LinkSorter::widget()
26
            ->attributes(['id', 'name'])
27
            ->sort(new Sort([]));
28
29
        $output = <<<OUTPUT
30
<ul class="sorter">
31
<li><a href="?sort=id">id</a></li>
32
<li><a href="?sort=name">name</a></li>
33
</ul>
34
OUTPUT;
35
        $this->assertEquals($output, $widget->run());
36
    }
37
}
38