Completed
Push — master ( 74c3c7...591b88 )
by Eric
08:09
created

ArrayDataSourceTest   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

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

4 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 4 1
A testInheritance() 0 4 1
A testDefaultState() 0 5 1
A testInitialState() 0 7 1
1
<?php
2
3
/*
4
 * This file is part of the Lug package.
5
 *
6
 * (c) Eric GELOEN <[email protected]>
7
 *
8
 * For the full copyright and license information, please read the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Lug\Component\Grid\Tests\DataSource;
13
14
use Lug\Component\Grid\DataSource\ArrayDataSource;
15
use Lug\Component\Grid\DataSource\DataSourceInterface;
16
17
/**
18
 * @author GeLo <[email protected]>
19
 */
20
class ArrayDataSourceTest extends \PHPUnit_Framework_TestCase
21
{
22
    /**
23
     * @var ArrayDataSource
24
     */
25
    private $dataSource;
26
27
    /**
28
     * {@inheritdoc}
29
     */
30
    protected function setUp()
31
    {
32
        $this->dataSource = new ArrayDataSource();
33
    }
34
35
    public function testInheritance()
36
    {
37
        $this->assertInstanceOf(DataSourceInterface::class, $this->dataSource);
38
    }
39
40
    public function testDefaultState()
41
    {
42
        $this->assertEmpty(iterator_to_array($this->dataSource));
43
        $this->assertCount(0, $this->dataSource);
44
    }
45
46
    public function testInitialState()
47
    {
48
        $this->dataSource = new ArrayDataSource($objects = [new \stdClass()]);
49
50
        $this->assertSame($objects, iterator_to_array($this->dataSource));
51
        $this->assertCount(count($objects), $this->dataSource);
52
    }
53
}
54