File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -25,6 +25,7 @@ public function setUp(): void
2525 parent ::setUp ();
2626 ob_start ();
2727
28+ $ this ->ensureRateLimitStorageExists ();
2829 self ::$ app = createApp (AppType::WEB , PROJECT_ROOT );
2930 $ this ->clearRateLimitStorage ();
3031 }
@@ -78,4 +79,19 @@ private function clearRateLimitStorage(): void
7879 }
7980 }
8081 }
82+
83+ private function ensureRateLimitStorageExists (): void
84+ {
85+ $ rateLimitDir = PROJECT_ROOT . DS . 'cache ' . DS . 'data ' ;
86+
87+ if (is_dir ($ rateLimitDir )) {
88+ return ;
89+ }
90+
91+ $ created = mkdir ($ rateLimitDir , 0777 , true );
92+
93+ if (!$ created && !is_dir ($ rateLimitDir )) {
94+ throw new RuntimeException ('Failed to create rate limit storage directory: ' . $ rateLimitDir );
95+ }
96+ }
8197}
Original file line number Diff line number Diff line change @@ -10,7 +10,6 @@ class RateLimitTest extends AppTestCase
1010 public function setUp (): void
1111 {
1212 parent ::setUp ();
13- $ this ->ensureRateLimitStorageExists ();
1413 $ this ->clearRateLimitStorage ();
1514 }
1615
@@ -75,13 +74,4 @@ private function clearRateLimitStorage(): void
7574 }
7675 }
7776
78- private function ensureRateLimitStorageExists (): void
79- {
80- $ rateLimitDir = PROJECT_ROOT . DS . 'cache ' . DS . 'data ' ;
81-
82- if (!is_dir ($ rateLimitDir )) {
83- $ created = mkdir ($ rateLimitDir , 0777 , true );
84- $ this ->assertTrue ($ created || is_dir ($ rateLimitDir ), 'Failed to create rate limit storage directory: ' . $ rateLimitDir );
85- }
86- }
8777}
You can’t perform that action at this time.
0 commit comments