Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/TestKernel.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php

Check warning on line 1 in src/TestKernel.php

View workflow job for this annotation

GitHub Actions / PHP-CS-Fixer

Found violation(s) of type: no_whitespace_in_blank_line

namespace Nyholm\BundleTest;

Expand Down Expand Up @@ -183,6 +183,17 @@

public function shutdown(): void
{
if ($this->booted && $this->clearCache) {
// KernelTestCase wants the services_resetter service to be instantiated as part of
// its resetting in `ensureKernelShutdown`. However, if we clear the cache, the
// compiled container will break when trying to load the file containing the compiled
// code for that service as we would have deleted it already.
// This runs before calling the parent method so that the container is still available.
if ($this->container->has('services_resetter')) {
$this->container->get('services_resetter')->reset();
}
}

parent::shutdown();

if (!$this->clearCache) {
Expand Down
Loading