Completed
Push — master ( 36465f...c2bf67 )
by Adam
02:30
created

GridTest::testAddColumnWithDecorators()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 17
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 10
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 17
rs 9.4285
1
<?php
2
3
use Boduch\Grid\Grid;
4
5
class GridTest extends GridBuilderTestCase
6
{
7
    public function testAddColumn()
8
    {
9
        $grid = new Grid($this->gridHelper);
10
        $grid->addColumn('name', [
11
            'title' => 'First name'
12
        ]);
13
14
        $this->assertInstanceOf(\Boduch\Grid\Column::class, $grid->getColumns()['name']);
15
        $this->assertEquals('First name', $grid->getColumns()['name']->getTitle());
16
    }
17
18
    public function testAddColumnWithDecorators()
19
    {
20
        $grid = new Grid($this->gridHelper);
21
        $grid->addColumn('name', [
22
            'title' => 'First name',
23
            'clickable' => function () {
24
                return '';
25
            },
26
            'decorators' => [
27
                new \Boduch\Grid\Decorators\Url()
28
            ]
29
        ]);
30
31
        $column = $grid->getColumns()['name'];
32
33
        $this->assertEquals(2, count($column->getDecorators()));
34
    }
35
}