Skip to content

Commit f7beb83

Browse files
committed
Fix null values for settings cache
1 parent 21c9a31 commit f7beb83

5 files changed

Lines changed: 16 additions & 39 deletions

File tree

‎ProcessMaker/Cache/Settings/SettingCacheManager.php‎

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,12 @@ public function __call($method, $arguments): mixed
8686
*/
8787
public function get(string $key, mixed $default = null): mixed
8888
{
89-
return $this->cacheManager->get($key, $default);
89+
$value = $this->cacheManager->get($key, $default);
90+
if ($value === 'null') {
91+
$value = null;
92+
}
93+
94+
return $value;
9095
}
9196

9297
/**
@@ -133,6 +138,10 @@ public function getOrCache(string $key, callable $callback): mixed
133138
*/
134139
public function set(string $key, mixed $value, null|int|\DateInterval $ttl = null): bool
135140
{
141+
if ($value === null) {
142+
$value = 'null';
143+
}
144+
136145
return $this->cacheManager->put($key, $value, $ttl);
137146
}
138147

‎ProcessMaker/Providers/AppServiceProvider.php‎

Lines changed: 0 additions & 31 deletions
This file was deleted.

‎config/app.php‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,6 @@
181181
/**
182182
* ProcessMaker Service Providers
183183
*/
184-
ProcessMaker\Providers\AppServiceProvider::class,
185184
ProcessMaker\Providers\ProcessMakerServiceProvider::class,
186185
ProcessMaker\Providers\RecommendationsServiceProvider::class,
187186
ProcessMaker\Providers\AuthServiceProvider::class,

‎phpunit.xml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
<env name="TELESCOPE_ENABLED" value="false"/>
3535

3636
<env name="BROADCAST_DRIVER" value="log"/>
37-
<env name="CACHE_DRIVER" value="array" />
37+
<env name="CACHE_DRIVER" value="redis" />
3838
<env name="QUEUE_DRIVER" value="sync" />
3939
<env name="SCRIPT_MICROSERVICE_ENABLED" value="false" />
4040

‎tests/TestCase.php‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
use Illuminate\Support\Facades\Artisan;
1111
use Illuminate\Support\Facades\Bus;
1212
use Illuminate\Support\Facades\DB;
13+
use Illuminate\Support\Facades\Redis;
1314
use Illuminate\Testing\Constraints\ArraySubset;
1415
use Illuminate\Testing\Exceptions\InvalidArgumentException;
1516
use PDOException;
@@ -49,6 +50,7 @@ protected function setUp(): void
4950

5051
if (!self::$cacheCleared) {
5152
Artisan::call('optimize:clear');
53+
Redis::flushDB();
5254
self::$cacheCleared = true;
5355
}
5456

@@ -119,11 +121,9 @@ protected function tearDown(): void
119121
RefreshDatabaseState::$migrated = false;
120122

121123
$className = get_class($this);
122-
if (!in_array($className, self::$transactionWarnings)) {
123-
$message = $className . ' does not use connectionsToTransact. This is slowing down the test suite!';
124-
EventFacade::emitter()->testRunnerTriggeredWarning($message);
125-
self::$transactionWarnings[] = $className;
126-
}
124+
$message = $className . '::' . $this->name() . ' not using transactions. This is slowing down the test suite!';
125+
EventFacade::emitter()->testRunnerTriggeredWarning($message);
126+
self::$transactionWarnings[] = $className;
127127
}
128128
}
129129

0 commit comments

Comments
 (0)