Completed
Push — master ( b1c6ca...52cd2c )
by Kamil
77:57 queued 60:05
created

it_renders_blocks_for_given_event()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 16

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 16
rs 9.7333
c 0
b 0
f 0
cc 1
nc 1
nop 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\UiBundle\Twig;
15
16
use PhpSpec\ObjectBehavior;
17
use Prophecy\Argument;
18
use Twig\Environment;
19
20
final class TemplateEventExtensionSpec extends ObjectBehavior
21
{
22
    function it_renders_blocks_for_given_event(Environment $twig): void
23
    {
24
        $this->beConstructedWith($twig, [
25
            'event_name' => [
26
                'first.html.twig',
27
                'second.html.twig',
28
            ],
29
        ]);
30
31
        $twig->render('first.html.twig', ['option' => 'value'])->willReturn('First template');
32
        $twig->render('second.html.twig', ['option' => 'value'])->willReturn('Second template');
33
34
        $this->renderBlocksForEvent('event_name', ['option' => 'value'])->shouldReturn(
35
            "First template\nSecond template"
36
        );
37
    }
38
39
    function it_returns_empty_string_if_there_are_no_blocks_registered_for_given_event(Environment $twig): void
40
    {
41
        $this->beConstructedWith($twig, ['event_name' => ['first.html.twig']]);
42
43
        $twig->render(Argument::cetera())->shouldNotBeCalled();
44
45
        $this->renderBlocksForEvent('another_event')->shouldReturn('');
46
    }
47
}
48