diff --git a/src/Codeception/Lib/Connector/Laravel.php b/src/Codeception/Lib/Connector/Laravel.php index 2bdad83..55bd395 100644 --- a/src/Codeception/Lib/Connector/Laravel.php +++ b/src/Codeception/Lib/Connector/Laravel.php @@ -22,6 +22,7 @@ use Illuminate\Foundation\Bootstrap\RegisterProviders; use Illuminate\Http\Request; use Illuminate\Http\UploadedFile; +use Illuminate\Queue\Queue; use Symfony\Component\HttpFoundation\Request as SymfonyRequest; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\HttpKernelBrowser as Client; @@ -177,6 +178,10 @@ private function initialize(SymfonyRequest $request = null): void */ private function loadApplication(): AppContract { + // Booting the application appends callbacks that reference it to this static array, + // so it has to be cleared to let previous applications be garbage collected. + Queue::createPayloadUsing(null); + /** @var AppContract $app */ $app = require $this->module->config['bootstrap_file']; if ($this->module->config['environment_file'] !== '.env') {