Skip to content

Commit

Permalink
fix: universal Nette\Caching\Storages\Journal cleaning (#37)
Browse files Browse the repository at this point in the history
  • Loading branch information
martenb authored and f3l1x committed Aug 1, 2023
1 parent c2647d9 commit a59ac4c
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions src/Module/NetteDIModule.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,13 @@
use Codeception\Module;
use Codeception\TestInterface;
use Nette\Bootstrap\Configurator;
use Nette\Caching\Cache;
use Nette\Caching\Storages\Journal;
use Nette\Caching\Storages\SQLiteJournal;
use Nette\DI\Container;
use Nette\DI\Extensions\ExtensionsExtension;
use Nette\DI\MissingServiceException;
use Nette\Http\Session;
use Nette\Utils\FileSystem;
use ReflectionProperty;

class NetteDIModule extends Module
{
Expand Down Expand Up @@ -204,11 +203,7 @@ private function stopContainer(): void

try {
$journal = $this->container->getByType(Journal::class);
if ($journal instanceof SQLiteJournal) {
$property = new ReflectionProperty(SQLiteJournal::class, 'pdo');
$property->setAccessible(true);
$property->setValue($journal, null);
}
$journal->clean([Cache::All => true]);
} catch (MissingServiceException $e) {
// IJournal is optional
}
Expand Down

0 comments on commit a59ac4c

Please sign in to comment.