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\Builder; |
13
|
|
|
|
14
|
|
|
use PhpSpec\ObjectBehavior; |
15
|
|
|
use Prophecy\Argument; |
16
|
|
|
use Sylius\Bundle\CoreBundle\Sitemap\Builder\SitemapBuilderInterface; |
17
|
|
|
use Sylius\Bundle\CoreBundle\Sitemap\Factory\SitemapFactoryInterface; |
18
|
|
|
use Sylius\Bundle\CoreBundle\Sitemap\Model\SitemapInterface; |
19
|
|
|
use Sylius\Bundle\CoreBundle\Sitemap\Model\SitemapUrlInterface; |
20
|
|
|
use Sylius\Bundle\CoreBundle\Sitemap\Provider\UrlProviderInterface; |
21
|
|
|
|
22
|
|
|
/** |
23
|
|
|
* @author Arkadiusz Krakowiak <[email protected]> |
24
|
|
|
*/ |
25
|
|
|
class SitemapBuilderSpec extends ObjectBehavior |
26
|
|
|
{ |
27
|
|
|
function let(SitemapFactoryInterface $sitemapFactory) |
28
|
|
|
{ |
29
|
|
|
$this->beConstructedWith($sitemapFactory); |
30
|
|
|
} |
31
|
|
|
|
32
|
|
|
function it_is_initializable() |
33
|
|
|
{ |
34
|
|
|
$this->shouldHaveType('Sylius\Bundle\CoreBundle\Sitemap\Builder\SitemapBuilder'); |
35
|
|
|
} |
36
|
|
|
|
37
|
|
|
function it_implements_sitemap_builder_interface() |
38
|
|
|
{ |
39
|
|
|
$this->shouldImplement(SitemapBuilderInterface::class); |
40
|
|
|
} |
41
|
|
|
|
42
|
|
|
function it_builds_sitemap( |
43
|
|
|
$sitemapFactory, |
44
|
|
|
UrlProviderInterface $productUrlProvider, |
45
|
|
|
UrlProviderInterface $staticUrlProvider, |
46
|
|
|
SitemapInterface $sitemap, |
47
|
|
|
SitemapUrlInterface $bookUrl, |
48
|
|
|
SitemapUrlInterface $homePage |
49
|
|
|
) { |
50
|
|
|
$sitemapFactory->createNew()->willReturn($sitemap); |
51
|
|
|
$this->addProvider($productUrlProvider); |
52
|
|
|
$this->addProvider($staticUrlProvider); |
53
|
|
|
$productUrlProvider->generate()->willReturn([$bookUrl]); |
54
|
|
|
$staticUrlProvider->generate()->willReturn([$homePage]); |
55
|
|
|
|
56
|
|
|
$sitemap->setUrls([$bookUrl, $homePage])->shouldBeCalled(); |
57
|
|
|
|
58
|
|
|
$this->build()->shouldReturn($sitemap); |
59
|
|
|
} |
60
|
|
|
} |
61
|
|
|
|