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

GridViewFactorySpec   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 4
dl 0
loc 25
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A let() 0 4 1
A it_implements_grid_view_factory_interface() 0 4 1
A it_uses_data_provider_to_create_a_view_with_data_and_definition() 0 12 1
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