From a7627ece6895ed36578f1f4cfd7338f2ce6cc6ef Mon Sep 17 00:00:00 2001 From: Simon Praetorius Date: Fri, 13 Oct 2023 19:24:06 +0200 Subject: [PATCH] [BUGFIX] Clear fluid cache after example tests --- examples/src/Helper/ExampleHelper.php | 9 +++++++++ tests/Functional/ExamplesTest.php | 8 ++++++++ 2 files changed, 17 insertions(+) diff --git a/examples/src/Helper/ExampleHelper.php b/examples/src/Helper/ExampleHelper.php index 01c83137e..b558abba9 100644 --- a/examples/src/Helper/ExampleHelper.php +++ b/examples/src/Helper/ExampleHelper.php @@ -60,4 +60,13 @@ public function output(string $content): void echo '#' . PHP_EOL; echo trim($content) . PHP_EOL . PHP_EOL; } + + public function cleanup(): void + { + $cachePath = sys_get_temp_dir() . '/' . 'fluid-examples'; + if (!is_dir($cachePath)) { + return; + } + (new SimpleFileCache($cachePath))->flush(); + } } diff --git a/tests/Functional/ExamplesTest.php b/tests/Functional/ExamplesTest.php index 359fb1d6e..a86d7bfbc 100644 --- a/tests/Functional/ExamplesTest.php +++ b/tests/Functional/ExamplesTest.php @@ -9,6 +9,8 @@ namespace TYPO3Fluid\Fluid\Tests\Functional; +use TYPO3Fluid\FluidExamples\Helper\ExampleHelper; + final class ExamplesTest extends AbstractFunctionalTestCase { public static function exampleScriptValuesDataProvider(): array @@ -232,4 +234,10 @@ public function exampleScriptValues(string $script, array $expectedOutputs): voi ob_end_clean(); call_user_func($outputCallback, $output); } + + public static function tearDownAfterClass(): void + { + (new ExampleHelper())->cleanup(); + parent::tearDownAfterClass(); + } }