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
|
|
|
|