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

TwigAdapterSpec   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2
Metric Value
wmc 4
lcom 0
cbo 2
dl 0
loc 25
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A let() 0 4 1
A it_is_initializable() 0 4 1
A it_implements_renderer_adapter_interface() 0 4 1
A it_renders_sitemap() 0 7 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