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

GridTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

Changes 2
Bugs 0 Features 0
Metric Value
c 2
b 0
f 0
dl 0
loc 31
rs 10
wmc 2
lcom 1
cbo 4

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testAddColumn() 0 10 1
A testAddColumnWithDecorators() 0 17 1
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
}