Completed
Push — master ( 4207f0...333332 )
by Kamil
23:19 queued 01:42
created

TemplatingTest::testRenderAppTemplates()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
dl 0
loc 7
rs 9.4285
c 1
b 0
f 1
cc 1
eloc 4
nc 1
nop 2
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 Sylius\Bundle\ThemeBundle\Tests\Functional;
13
14
/**
15
 * @author Kamil Kokot <[email protected]>
16
 */
17
class TemplatingTest extends ThemeBundleTestCase
18
{
19
    /**
20
     * @dataProvider getBundleTemplates
21
     *
22
     * @param string $templateName
23
     * @param string $contents
24
     */
25
    public function testRenderBundleTemplates($templateName, $contents)
26
    {
27
        $client = $this->getClient();
28
29
        $crawler = $client->request('GET', '/template/' . $templateName);
30
        $this->assertEquals($contents, trim($crawler->text()));
31
    }
32
33
    /**
34
     * @return array
35
     */
36
    public function getBundleTemplates()
37
    {
38
        return [
39
            ['TestBundle:Templating:vanillaTemplate.txt.twig', 'TestBundle:Templating:vanillaTemplate.txt.twig'],
40
            ['TestBundle:Templating:vanillaOverridedTemplate.txt.twig', 'TestBundle:Templating:vanillaOverridedTemplate.txt.twig (app overrided)'],
41
            ['TestBundle:Templating:vanillaOverridedThemeTemplate.txt.twig', 'TestBundle:Templating:vanillaOverridedThemeTemplate.txt.twig|sylius/first-test-theme'],
42
            ['TestBundle:Templating:bothThemesTemplate.txt.twig', 'TestBundle:Templating:bothThemesTemplate.txt.twig|sylius/first-test-theme'],
43
            ['TestBundle:Templating:lastThemeTemplate.txt.twig', 'TestBundle:Templating:lastThemeTemplate.txt.twig|sylius/second-test-theme'],
44
        ];
45
    }
46
47
    /**
48
     * @dataProvider getAppTemplates
49
     *
50
     * @param string $templateName
51
     * @param string $contents
52
     */
53
    public function testRenderAppTemplates($templateName, $contents)
54
    {
55
        $client = $this->getClient();
56
57
        $crawler = $client->request('GET', '/template/' . $templateName);
58
        $this->assertEquals($contents, trim($crawler->text()));
59
    }
60
61
    /**
62
     * @return array
63
     */
64
    public function getAppTemplates()
65
    {
66
        return [
67
            [':Templating:vanillaTemplate.txt.twig', ':Templating:vanillaTemplate.txt.twig'],
68
            [':Templating:bothThemesTemplate.txt.twig', ':Templating:bothThemesTemplate.txt.twig|sylius/first-test-theme'],
69
            [':Templating:lastThemeTemplate.txt.twig', ':Templating:lastThemeTemplate.txt.twig|sylius/second-test-theme'],
70
        ];
71
    }
72
}
73