Completed
Push — theme-collector ( e0987d )
by Kamil
23:25
created

GridViewFactorySpec::it_is_initializable()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
nc 1
cc 1
eloc 2
nop 0
1
<?php
2
3
/*
4
 * This file is part of the Sylius package.
5
 *
6
 * (c) Paweł Jędrzejewski
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
declare(strict_types=1);
13
14
namespace spec\Sylius\Component\Grid\View;
15
16
use PhpSpec\ObjectBehavior;
17
use Sylius\Component\Grid\Data\DataProviderInterface;
18
use Sylius\Component\Grid\Definition\Grid;
19
use Sylius\Component\Grid\Parameters;
20
use Sylius\Component\Grid\View\GridView;
21
use Sylius\Component\Grid\View\GridViewFactoryInterface;
22
23
/**
24
 * @author Paweł Jędrzejewski <[email protected]>
25
 */
26
final class GridViewFactorySpec extends ObjectBehavior
27
{
28
    function let(DataProviderInterface $dataProvider): void
29
    {
30
        $this->beConstructedWith($dataProvider);
31
    }
32
33
    function it_implements_grid_view_factory_interface(): void
34
    {
35
        $this->shouldImplement(GridViewFactoryInterface::class);
36
    }
37
38
    function it_uses_data_provider_to_create_a_view_with_data_and_definition(
39
        DataProviderInterface $dataProvider,
40
        Grid $grid
41
    ): void {
42
        $parameters = new Parameters();
43
44
        $expectedGridView = new GridView(['foo', 'bar'], $grid->getWrappedObject(), $parameters);
45
46
        $dataProvider->getData($grid, $parameters)->willReturn(['foo', 'bar']);
47
48
        $this->create($grid, $parameters)->shouldBeLike($expectedGridView);
49
    }
50
}
51