Completed
Push — master ( 6c5077...d22a37 )
by Christian
01:33
created

tests/Sitemap/StaticSitemapServiceTest.php (2 issues)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * (c) Christian Gripp <[email protected]>
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 Core23\SitemapBundle\Tests\Sitemap;
13
14
use Core23\SitemapBundle\Definition\SitemapDefinition;
15
use Core23\SitemapBundle\Model\Url;
16
use Core23\SitemapBundle\Sitemap\SitemapServiceInterface;
17
use Core23\SitemapBundle\Sitemap\StaticSitemapService;
18
use Core23\SitemapBundle\Test\AbstractSitemapServiceTestCase;
19
use Symfony\Component\OptionsResolver\OptionsResolver;
20
21
final class StaticSitemapServiceTest extends AbstractSitemapServiceTestCase
22
{
23 View Code Duplication
    public function testSitemap(): void
0 ignored issues
show
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
24
    {
25
        $sitemap = new SitemapDefinition('demo', [
26
            'priority'   => 20,
27
            'url'        => '/foo/bar',
28
            'changefreq' => Url::FREQUENCE_DAILY,
29
        ]);
30
31
        $optionResolver = new OptionsResolver();
32
        $this->service->configureSettings($optionResolver);
33
34
        $sitemap->setSettings($optionResolver->resolve($sitemap->getSettings()));
35
36
        $this->assertSitemap('/foo/bar', 20, Url::FREQUENCE_DAILY);
37
38
        $this->process($sitemap);
39
    }
40
41 View Code Duplication
    public function testExecuteWIthNoUrl(): void
0 ignored issues
show
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
42
    {
43
        $sitemap = new SitemapDefinition('demo', [
44
            'priority'   => 20,
45
            'url'        => null,
46
            'changefreq' => Url::FREQUENCE_DAILY,
47
        ]);
48
49
        $optionResolver = new OptionsResolver();
50
        $this->service->configureSettings($optionResolver);
51
52
        $sitemap->setSettings($optionResolver->resolve($sitemap->getSettings()));
53
54
        $this->assertSitemapCount(0);
55
56
        $this->process($sitemap);
57
    }
58
59
    /**
60
     * {@inheritdoc}
61
     */
62
    protected function createService(): SitemapServiceInterface
63
    {
64
        return new StaticSitemapService();
65
    }
66
}
67