1 | <?php |
||
17 | final class TemplatingTest extends ThemeBundleTestCase |
||
18 | { |
||
19 | /** |
||
20 | * @test |
||
21 | * @dataProvider getBundleTemplates |
||
22 | * |
||
23 | * @param string $templateName |
||
24 | * @param string $contents |
||
25 | */ |
||
26 | public function it_renders_bundle_templates($templateName, $contents) |
||
27 | { |
||
28 | $client = $this->getClient(); |
||
29 | |||
30 | $crawler = $client->request('GET', '/template/'.$templateName); |
||
31 | $this->assertEquals($contents, trim($crawler->text())); |
||
32 | } |
||
33 | |||
34 | /** |
||
35 | * @return array |
||
|
|||
36 | */ |
||
37 | public function getBundleTemplates() |
||
38 | { |
||
39 | return [ |
||
40 | ['TestBundle:Templating:vanillaTemplate.txt.twig', 'TestBundle:Templating:vanillaTemplate.txt.twig'], |
||
41 | ['TestBundle:Templating:vanillaOverriddenTemplate.txt.twig', 'TestBundle:Templating:vanillaOverriddenTemplate.txt.twig (app overridden)'], |
||
42 | ['TestBundle:Templating:vanillaOverriddenThemeTemplate.txt.twig', 'TestBundle:Templating:vanillaOverriddenThemeTemplate.txt.twig|sylius/first-test-theme'], |
||
43 | ['TestBundle:Templating:bothThemesTemplate.txt.twig', 'TestBundle:Templating:bothThemesTemplate.txt.twig|sylius/first-test-theme'], |
||
44 | ['TestBundle:Templating:lastThemeTemplate.txt.twig', 'TestBundle:Templating:lastThemeTemplate.txt.twig|sylius/second-test-theme'], |
||
45 | ]; |
||
46 | } |
||
47 | |||
48 | /** |
||
49 | * @test |
||
50 | * @dataProvider getBundleTemplatesUsingNamespacedPaths |
||
51 | * |
||
52 | * @param string $templateName |
||
53 | * @param string $contents |
||
54 | */ |
||
55 | public function it_renders_bundle_templates_using_namespaced_paths($templateName, $contents) |
||
56 | { |
||
57 | $client = $this->getClient(); |
||
58 | |||
59 | $crawler = $client->request('GET', '/template/'.$templateName); |
||
60 | $this->assertEquals($contents, trim($crawler->text())); |
||
61 | } |
||
62 | |||
63 | /** |
||
64 | * @return array |
||
65 | */ |
||
66 | public function getBundleTemplatesUsingNamespacedPaths() |
||
76 | |||
77 | /** |
||
78 | * @test |
||
79 | * @dataProvider getAppTemplates |
||
80 | * |
||
81 | * @param string $templateName |
||
82 | * @param string $contents |
||
83 | */ |
||
84 | public function it_renders_application_templates($templateName, $contents) |
||
91 | |||
92 | /** |
||
93 | * @return array |
||
94 | */ |
||
95 | public function getAppTemplates() |
||
103 | |||
104 | /** |
||
105 | * @test |
||
106 | * @dataProvider getAppTemplatesUsingNamespacedPaths |
||
107 | * |
||
108 | * @param string $templateName |
||
109 | * @param string $contents |
||
110 | */ |
||
111 | public function it_renders_application_templates_using_namespaced_paths($templateName, $contents) |
||
118 | |||
119 | /** |
||
120 | * @return array |
||
121 | */ |
||
122 | public function getAppTemplatesUsingNamespacedPaths() |
||
130 | } |
||
131 |
This check looks for the generic type
array
as a return type and suggests a more specific type. This type is inferred from the actual code.