Completed
Push — master ( da2f6e...d3b8cb )
by Kamil
20:06
created

TwigAdapterSpec::let()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %
Metric Value
dl 0
loc 4
rs 10
cc 1
eloc 2
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
namespace spec\Sylius\Bundle\CoreBundle\Sitemap\Renderer;
13
 
14
use PhpSpec\ObjectBehavior;
15
use Prophecy\Argument;
16
use Sylius\Bundle\CoreBundle\Sitemap\Model\SitemapInterface;
17
use Sylius\Bundle\CoreBundle\Sitemap\Model\SitemapUrlInterface;
18
use Sylius\Bundle\CoreBundle\Sitemap\Renderer\RendererAdapterInterface;
19
use Symfony\Component\Templating\EngineInterface;
20
21
/**
22
 * @author Arkadiusz Krakowiak <[email protected]>
23
 */
24
class TwigAdapterSpec extends ObjectBehavior
25
{
26
    function let(EngineInterface $twig)
27
    {
28
        $this->beConstructedWith($twig, '@SyliusCore/Sitemap/url_set.xml.twig');
29
    }
30
31
    function it_is_initializable()
32
    {
33
        $this->shouldHaveType('Sylius\Bundle\CoreBundle\Sitemap\Renderer\TwigAdapter');
34
    }
35
36
    function it_implements_renderer_adapter_interface()
37
    {
38
        $this->shouldImplement(RendererAdapterInterface::class);
39
    }
40
41
    function it_renders_sitemap($twig, SitemapInterface $sitemap, SitemapUrlInterface $productUrl)
42
    {
43
        $sitemap->getUrls()->willReturn([$productUrl]);
44
        $twig->render('@SyliusCore/Sitemap/url_set.xml.twig', ['url_set' => [$productUrl]])->shouldBeCalled();
45
46
        $this->render($sitemap);
47
    }
48
}
49