Skip to content

Commit f151245

Browse files
committed
fix error PHPStan, update test case main method
1 parent 5a01629 commit f151245

File tree

2 files changed

+15
-12
lines changed

2 files changed

+15
-12
lines changed

system/Commands/Utilities/Optimize.php

+3
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,8 @@ private function runCaching(?bool $enableConfigCache, ?bool $enableLocatorCache,
178178

179179
/**
180180
* Disable Caching
181+
*
182+
* @return array<string, string>
181183
*/
182184
private function disableCaching(): array
183185
{
@@ -191,6 +193,7 @@ private function disableCaching(): array
191193
* Enable Caching
192194
*
193195
* @param array<string, bool|null> $options
196+
* @return array<string, string>
194197
*/
195198
private function enableCaching(array $options): array
196199
{

tests/system/Commands/Utilities/OptimizeTest.php

+12-12
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,10 @@ public function testEnableConfigCaching(): void
4141
{
4242
$command = new Optimize(service('logger'), service('commands'));
4343

44-
$enableCaching = $this->getPrivateMethodInvoker($command, 'enableCaching');
44+
$runCaching = $this->getPrivateMethodInvoker($command, 'runCaching');
4545

46-
// private function enableCaching(?bool $enableConfigCache, ?bool $enableLocatorCache, ?bool $disable): void
47-
$enableCaching(true, null, null);
46+
// private function runCaching(?bool $enableConfigCache, ?bool $enableLocatorCache, ?bool $disable): void
47+
$runCaching(true, null, null);
4848

4949
// Check if config caching is enabled
5050
$this->assertFileContains('public bool $configCacheEnabled = true;', APPPATH . 'Config/Optimize.php');
@@ -54,10 +54,10 @@ public function testEnableLocatorCaching(): void
5454
{
5555
$command = new Optimize(service('logger'), service('commands'));
5656

57-
$enableCaching = $this->getPrivateMethodInvoker($command, 'enableCaching');
57+
$runCaching = $this->getPrivateMethodInvoker($command, 'runCaching');
5858

59-
// private function enableCaching(?bool $enableConfigCache, ?bool $enableLocatorCache, ?bool $disable): void
60-
$enableCaching(null, true, null);
59+
// private function runCaching(?bool $enableConfigCache, ?bool $enableLocatorCache, ?bool $disable): void
60+
$runCaching(null, true, null);
6161

6262
// Check if locator caching is enabled
6363
$this->assertFileContains('public bool $locatorCacheEnabled = true;', APPPATH . 'Config/Optimize.php');
@@ -67,10 +67,10 @@ public function testDisableCaching(): void
6767
{
6868
$command = new Optimize(service('logger'), service('commands'));
6969

70-
$enableCaching = $this->getPrivateMethodInvoker($command, 'enableCaching');
70+
$runCaching = $this->getPrivateMethodInvoker($command, 'runCaching');
7171

72-
// private function enableCaching(?bool $enableConfigCache, ?bool $enableLocatorCache, ?bool $disable): void
73-
$enableCaching(null, null, true);
72+
// private function runCaching(?bool $enableConfigCache, ?bool $enableLocatorCache, ?bool $disable): void
73+
$runCaching(null, null, true);
7474

7575
// Check if both caches are disabled
7676
$this->assertFileContains('public bool $configCacheEnabled = false;', APPPATH . 'Config/Optimize.php');
@@ -81,10 +81,10 @@ public function testWithoutOptions(): void
8181
{
8282
$command = new Optimize(service('logger'), service('commands'));
8383

84-
$enableCaching = $this->getPrivateMethodInvoker($command, 'enableCaching');
84+
$runCaching = $this->getPrivateMethodInvoker($command, 'runCaching');
8585

86-
// private function enableCaching(?bool $enableConfigCache, ?bool $enableLocatorCache, ?bool $disable): void
87-
$enableCaching(null, null, null);
86+
// private function runCaching(?bool $enableConfigCache, ?bool $enableLocatorCache, ?bool $disable): void
87+
$runCaching(null, null, null);
8888

8989
// Check if both caches are disabled
9090
$this->assertFileContains('public bool $configCacheEnabled = true;', APPPATH . 'Config/Optimize.php');

0 commit comments

Comments
 (0)