@@ -33,15 +33,14 @@ class PluginTest extends TestCase
3333 * @var array<string>
3434 */
3535 protected array $ testDirs = [
36- '' ,
3736 'vendor ' ,
38- 'plugins ' ,
3937 'plugins/Foo ' ,
40- 'plugins/Fee ' ,
41- 'plugins/Foe ' ,
38+ 'plugins/Fee/src ' ,
39+ 'plugins/Fee/tests ' ,
40+ 'plugins/Foe/src ' ,
4241 'plugins/Fum ' ,
43- 'app_plugins ' ,
44- 'app_plugins/Bar ' ,
42+ 'app_plugins/Bar/src ' ,
43+ 'app_plugins/Bar/tests ' ,
4544 ];
4645
4746 protected string $ path ;
@@ -62,7 +61,7 @@ public function setUp(): void
6261
6362 foreach ($ this ->testDirs as $ dir ) {
6463 if (!is_dir ($ this ->path . '/ ' . $ dir )) {
65- mkdir ($ this ->path . '/ ' . $ dir );
64+ mkdir ($ this ->path . '/ ' . $ dir, 0777 , true );
6665 }
6766 }
6867
@@ -96,16 +95,10 @@ public function tearDown(): void
9695 {
9796 parent ::tearDown ();
9897
99- $ dirs = array_reverse ($ this ->testDirs );
100-
101- if (is_file ($ this ->path . '/vendor/cakephp-plugins.php ' )) {
102- unlink ($ this ->path . '/vendor/cakephp-plugins.php ' );
103- }
104-
105- foreach ($ dirs as $ dir ) {
106- if (is_dir ($ this ->path . '/ ' . $ dir )) {
107- rmdir ($ this ->path . '/ ' . $ dir );
108- }
98+ if (PHP_OS === 'Windows ' ) {
99+ exec (sprintf ('rd /s /q %s ' , escapeshellarg ($ this ->path )));
100+ } else {
101+ exec (sprintf ('rm -rf %s ' , escapeshellarg ($ this ->path )));
109102 }
110103 }
111104
@@ -154,7 +147,6 @@ public function testPreAutoloadDump()
154147 'psr-4 ' => [
155148 'Foo \\' => 'xyz/Foo/src ' ,
156149 'Fee \\' => 'plugins/Fee/src ' ,
157- 'Fum \\' => 'plugins/Fum/src ' ,
158150 'Foe \\' => 'plugins/Foe/src ' ,
159151 'Bar \\' => 'app_plugins/Bar/src ' ,
160152 ],
@@ -165,8 +157,6 @@ public function testPreAutoloadDump()
165157 'psr-4 ' => [
166158 'Foo\Test \\' => 'xyz/Foo/tests ' ,
167159 'Fee\Test \\' => 'plugins/Fee/tests ' ,
168- 'Fum\Test \\' => 'plugins/Fum/tests ' ,
169- 'Foe\Test \\' => 'plugins/Foe/tests ' ,
170160 'Bar\Test \\' => 'app_plugins/Bar/tests ' ,
171161 ],
172162 ];
0 commit comments