Skip to content

Commit a94d540

Browse files
Nyholmjdreesen
andauthored
Allow to opt-out from clearing cache on shutdown (#69)
* Allow to opt-out from clearing cache on shutdown * Exclude php 8.0 on sf 6.1 * Added method instead * CS fixes * Update src/TestKernel.php Co-authored-by: Jacob Dreesen <[email protected]> Co-authored-by: Jacob Dreesen <[email protected]>
1 parent e99c7fe commit a94d540

File tree

3 files changed

+22
-1
lines changed

3 files changed

+22
-1
lines changed

.github/workflows/ci.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,11 @@ jobs:
4444
symfony: '6.1.*'
4545
- php: '8.0'
4646
symfony: '4.4.*'
47+
- php: '8.0'
48+
symfony: '6.1.*'
49+
- php: '8.0'
50+
symfony: '6.1.*'
51+
dependency: 'lowest'
4752
- php: '8.1'
4853
symfony: '4.4.*'
4954
dependency: 'lowest'

phpstan-baseline.neon

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ parameters:
1111
path: src/TestKernel.php
1212

1313
-
14-
message: "#^Comparison operation \"\\>\\=\" between 60001 and 50100 is always true\\.$#"
14+
message: "#^Comparison operation \"\\>\\=\" between 600.. and 50100 is always true\\.$#"
1515
count: 1
1616
path: src/config/parameters.php
1717

src/TestKernel.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,13 @@ class TestKernel extends Kernel
5151
*/
5252
private $testRoutingFiles = [];
5353

54+
/**
55+
* Internal config.
56+
*
57+
* @var bool
58+
*/
59+
private $clearCache = true;
60+
5461
/**
5562
* {@inheritDoc}
5663
*/
@@ -185,6 +192,10 @@ public function shutdown(): void
185192
{
186193
parent::shutdown();
187194

195+
if (!$this->clearCache) {
196+
return;
197+
}
198+
188199
$cacheDirectory = $this->getCacheDir();
189200
$logDirectory = $this->getLogDir();
190201

@@ -198,4 +209,9 @@ public function shutdown(): void
198209
$filesystem->remove($logDirectory);
199210
}
200211
}
212+
213+
public function setClearCacheAfterShutdown(bool $clearCache): void
214+
{
215+
$this->clearCache = $clearCache;
216+
}
201217
}

0 commit comments

Comments
 (0)