Completed
Push — bulk-action-no-bc-break ( b6f5b6 )
by Kamil
24:44
created

BulkActionGridHelperSpec   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 5
lcom 0
cbo 2
dl 0
loc 31
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A let() 0 4 1
A it_is_a_templating_helper() 0 4 1
A it_extends_base_templating_helper() 0 4 1
A it_uses_a_grid_renderer_to_render_a_bulk_action() 0 8 1
A it_has_name() 0 4 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\Bundle\GridBundle\Templating\Helper;
15
16
use PhpSpec\ObjectBehavior;
17
use Sylius\Component\Grid\Definition\Action;
18
use Sylius\Component\Grid\Definition\Field;
19
use Sylius\Component\Grid\Renderer\BulkActionGridRendererInterface;
20
use Sylius\Component\Grid\Renderer\GridRendererInterface;
21
use Sylius\Component\Grid\View\GridView;
22
use Symfony\Component\Templating\Helper\Helper;
23
use Symfony\Component\Templating\Helper\HelperInterface;
24
25
final class BulkActionGridHelperSpec extends ObjectBehavior
26
{
27
    function let(BulkActionGridRendererInterface $bulkActionGridRenderer): void
28
    {
29
        $this->beConstructedWith($bulkActionGridRenderer);
30
    }
31
32
    function it_is_a_templating_helper(): void
33
    {
34
        $this->shouldImplement(HelperInterface::class);
35
    }
36
37
    function it_extends_base_templating_helper(): void
38
    {
39
        $this->shouldHaveType(Helper::class);
40
    }
41
42
    function it_uses_a_grid_renderer_to_render_a_bulk_action(
43
        BulkActionGridRendererInterface $bulkActionGridRenderer,
44
        GridView $gridView,
45
        Action $bulkAction
46
    ): void {
47
        $bulkActionGridRenderer->renderBulkAction($gridView, $bulkAction, null)->willReturn('<a href="#">Delete</a>');
48
        $this->renderBulkAction($gridView, $bulkAction)->shouldReturn('<a href="#">Delete</a>');
49
    }
50
51
    function it_has_name(): void
52
    {
53
        $this->getName()->shouldReturn('sylius_bulk_action_grid');
54
    }
55
}
56