|
1 | 1 | <?php
|
| 2 | + |
2 | 3 | declare(strict_types=1);
|
3 | 4 |
|
4 | 5 | namespace PhpList\WebFrontend\Tests\Integration\Composer;
|
|
12 | 13 | */
|
13 | 14 | class ScriptsTest extends TestCase
|
14 | 15 | {
|
15 |
| - /** |
16 |
| - * @test |
17 |
| - */ |
18 |
| - public function publicDirectoryHasBeenCreated() |
19 |
| - { |
20 |
| - static::assertDirectoryExists($this->getAbsolutePublicDirectoryPath()); |
21 |
| - } |
22 |
| - |
23 |
| - /** |
24 |
| - * @return string |
25 |
| - */ |
26 |
| - private function getAbsolutePublicDirectoryPath(): string |
27 |
| - { |
28 |
| - return dirname(__DIR__, 3) . '/public/'; |
29 |
| - } |
30 |
| - |
31 |
| - /** |
32 |
| - * @return string[][] |
33 |
| - */ |
34 |
| - public function publicDirectoryFilesDataProvider(): array |
35 |
| - { |
36 |
| - return [ |
37 |
| - 'production entry point' => ['app.php'], |
38 |
| - 'development entry point' => ['app_dev.php'], |
39 |
| - 'testing entry point' => ['app_test.php'], |
40 |
| - '.htaccess' => ['.htaccess'], |
41 |
| - ]; |
42 |
| - } |
43 |
| - |
44 |
| - /** |
45 |
| - * @test |
46 |
| - * @param string $fileName |
47 |
| - * @dataProvider publicDirectoryFilesDataProvider |
48 |
| - */ |
49 |
| - public function publicDirectoryFilesExist(string $fileName) |
50 |
| - { |
51 |
| - static::assertFileExists($this->getAbsolutePublicDirectoryPath() . $fileName); |
52 |
| - } |
53 |
| - |
54 |
| - /** |
55 |
| - * @test |
56 |
| - */ |
57 |
| - public function binariesDirectoryHasBeenCreated() |
| 16 | + private function getBundleConfigurationFilePath(): string |
58 | 17 | {
|
59 |
| - static::assertDirectoryExists($this->getAbsoluteBinariesDirectoryPath()); |
| 18 | + return dirname(__DIR__, 3) . '/config/bundles.yml'; |
60 | 19 | }
|
61 | 20 |
|
62 |
| - /** |
63 |
| - * @return string |
64 |
| - */ |
65 |
| - private function getAbsoluteBinariesDirectoryPath(): string |
| 21 | + public function testBundleConfigurationFileExists(): void |
66 | 22 | {
|
67 |
| - return dirname(__DIR__, 3) . '/bin/'; |
| 23 | + self::assertFileExists($this->getBundleConfigurationFilePath()); |
68 | 24 | }
|
69 | 25 |
|
70 |
| - /** |
71 |
| - * @return string[][] |
72 |
| - */ |
73 |
| - public function binariesDataProvider(): array |
| 26 | + public function bundleClassNameDataProvider(): array |
74 | 27 | {
|
75 | 28 | return [
|
76 |
| - 'Symfony console' => ['console'], |
| 29 | + 'Symfony framework bundle' => ['Symfony\\Bundle\\FrameworkBundle\\FrameworkBundle'], |
| 30 | + 'Doctrine bundle' => ['Doctrine\\Bundle\\DoctrineBundle\\DoctrineBundle'], |
| 31 | + 'empty start page bundle' => ['PhpList\\Core\\EmptyStartPageBundle\\EmptyStartPageBundle'], |
77 | 32 | ];
|
78 | 33 | }
|
79 | 34 |
|
80 | 35 | /**
|
81 |
| - * @test |
82 |
| - * @param string $fileName |
83 |
| - * @dataProvider binariesDataProvider |
| 36 | + * @dataProvider bundleClassNameDataProvider |
84 | 37 | */
|
85 |
| - public function binariesExist(string $fileName) |
| 38 | + public function testBundleConfigurationFileContainsModuleBundles(string $bundleClassName): void |
86 | 39 | {
|
87 |
| - static::assertFileExists($this->getAbsoluteBinariesDirectoryPath() . $fileName); |
| 40 | + $fileContents = file_get_contents($this->getBundleConfigurationFilePath()); |
| 41 | + self::assertStringContainsString($bundleClassName, $fileContents); |
88 | 42 | }
|
89 | 43 |
|
90 |
| - /** |
91 |
| - * @return string |
92 |
| - */ |
93 |
| - private function getBundleConfigurationFilePath(): string |
| 44 | + private function getModuleRoutesConfigurationFilePath(): string |
94 | 45 | {
|
95 |
| - return dirname(__DIR__, 3) . '/config/bundles.yml'; |
| 46 | + return dirname(__DIR__, 3) . '/config/routing_modules.yml'; |
96 | 47 | }
|
97 | 48 |
|
98 |
| - /** |
99 |
| - * @test |
100 |
| - */ |
101 |
| - public function bundleConfigurationFileExists() |
| 49 | + public function testModuleRoutesConfigurationFileExists(): void |
102 | 50 | {
|
103 |
| - static::assertFileExists($this->getBundleConfigurationFilePath()); |
| 51 | + self::assertFileExists($this->getModuleRoutesConfigurationFilePath()); |
104 | 52 | }
|
105 | 53 |
|
106 |
| - /** |
107 |
| - * @return string[][] |
108 |
| - */ |
109 |
| - public function bundleClassNameDataProvider(): array |
| 54 | + public function moduleRoutingDataProvider(): array |
110 | 55 | {
|
111 | 56 | return [
|
112 |
| - 'framework bundle' => ['Symfony\\Bundle\\FrameworkBundle\\FrameworkBundle'], |
| 57 | + 'route name' => ['phplist/core.homepage'], |
| 58 | + 'resource' => ["resource: '@EmptyStartPageBundle/Controller/'"], |
| 59 | + 'type' => ['type: attribute'], |
113 | 60 | ];
|
114 | 61 | }
|
115 | 62 |
|
116 | 63 | /**
|
117 |
| - * @test |
118 |
| - * @param string $bundleClassName |
119 |
| - * @dataProvider bundleClassNameDataProvider |
120 |
| - */ |
121 |
| - public function bundleConfigurationFileContainsModuleBundles(string $bundleClassName) |
122 |
| - { |
123 |
| - $fileContents = file_get_contents($this->getBundleConfigurationFilePath()); |
124 |
| - |
125 |
| - static::assertContains($bundleClassName, $fileContents); |
126 |
| - } |
127 |
| - |
128 |
| - /** |
129 |
| - * @return string |
130 |
| - */ |
131 |
| - private function getModuleRoutesConfigurationFilePath(): string |
132 |
| - { |
133 |
| - return dirname(__DIR__, 3) . '/config/routing_modules.yml'; |
134 |
| - } |
135 |
| - |
136 |
| - /** |
137 |
| - * @test |
| 64 | + * @dataProvider moduleRoutingDataProvider |
138 | 65 | */
|
139 |
| - public function moduleRoutesConfigurationFileExists() |
| 66 | + public function testModuleRoutesConfigurationFileContainsModuleRoutes(string $routeSearchString): void |
140 | 67 | {
|
141 |
| - static::assertFileExists($this->getModuleRoutesConfigurationFilePath()); |
| 68 | + $fileContents = file_get_contents($this->getModuleRoutesConfigurationFilePath()); |
| 69 | + self::assertStringContainsString($routeSearchString, $fileContents); |
142 | 70 | }
|
143 | 71 |
|
144 |
| - /** |
145 |
| - * @test |
146 |
| - */ |
147 |
| - public function parametersConfigurationFileExists() |
| 72 | + public function testParametersConfigurationFileExists(): void |
148 | 73 | {
|
149 |
| - static::assertFileExists(dirname(__DIR__, 3) . '/config/parameters.yml'); |
| 74 | + self::assertFileExists(dirname(__DIR__, 3) . '/config/parameters.yml'); |
150 | 75 | }
|
151 | 76 |
|
152 |
| - /** |
153 |
| - * @test |
154 |
| - */ |
155 |
| - public function modulesConfigurationFileExists() |
| 77 | + public function testModulesConfigurationFileExists(): void |
156 | 78 | {
|
157 |
| - static::assertFileExists(dirname(__DIR__, 3) . '/config/config_modules.yml'); |
| 79 | + self::assertFileExists(dirname(__DIR__, 3) . '/config/config_modules.yml'); |
158 | 80 | }
|
159 | 81 | }
|
0 commit comments