From 360993c11eb1fa6d1f5a4eb89a08636f96ccf3ef Mon Sep 17 00:00:00 2001 From: Sjors Ottjes Date: Thu, 5 Sep 2019 16:10:59 +0200 Subject: [PATCH 1/3] Update bootstrap.php --- tests/bootstrap.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 5041c5a6..943a2898 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -4,6 +4,10 @@ require_once __DIR__.'/../vendor/autoload.php'; +if (file_exists($_SERVER['APP_CONFIG_CACHE'])) { + unlink($_SERVER['APP_CONFIG_CACHE']); +} + /* |-------------------------------------------------------------------------- | Bootstrap The Test Environment From 731cd4c499638138c3331572f726310354d1b1ea Mon Sep 17 00:00:00 2001 From: Sjors Ottjes Date: Fri, 6 Sep 2019 08:16:34 +0200 Subject: [PATCH 2/3] add phpunit extension --- phpunit.xml | 5 ++++- tests/Bootstrap.php | 42 ++++++++++++++++++++++++++++++++++++++++++ tests/bootstrap.php | 33 --------------------------------- 3 files changed, 46 insertions(+), 34 deletions(-) create mode 100644 tests/Bootstrap.php delete mode 100644 tests/bootstrap.php diff --git a/phpunit.xml b/phpunit.xml index d562be80..61b6b64b 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -1,7 +1,7 @@ ./app + + + diff --git a/tests/Bootstrap.php b/tests/Bootstrap.php new file mode 100644 index 00000000..5fa7829c --- /dev/null +++ b/tests/Bootstrap.php @@ -0,0 +1,42 @@ +createApplication()->make(Kernel::class); + + $commands = [ + 'config:cache', + 'event:cache', + ]; + + foreach ($commands as $command) { + $console->call($command); + } + } + + public function executeAfterLastTest(): void + { + array_map('unlink', glob('bootstrap/cache/*.phpunit.php')); + } +} diff --git a/tests/bootstrap.php b/tests/bootstrap.php deleted file mode 100644 index 943a2898..00000000 --- a/tests/bootstrap.php +++ /dev/null @@ -1,33 +0,0 @@ -make(Kernel::class))->bootstrap(); - -foreach ($commands as $command) { - $console->call($command); -} From 42936c656c70dc39d71dae7e79a487a716f2b1a6 Mon Sep 17 00:00:00 2001 From: Sjors Ottjes Date: Fri, 6 Sep 2019 08:17:43 +0200 Subject: [PATCH 3/3] style --- tests/Bootstrap.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Bootstrap.php b/tests/Bootstrap.php index 5fa7829c..207faccb 100644 --- a/tests/Bootstrap.php +++ b/tests/Bootstrap.php @@ -2,9 +2,9 @@ namespace Tests; -use Illuminate\Contracts\Console\Kernel; use PHPUnit\Runner\AfterLastTestHook; use PHPUnit\Runner\BeforeFirstTestHook; +use Illuminate\Contracts\Console\Kernel; class Bootstrap implements BeforeFirstTestHook, AfterLastTestHook {