From ce58aae54876873bc047b0dc89ac4f2fc56f371f Mon Sep 17 00:00:00 2001 From: Antonio Carlos Ribeiro Date: Tue, 24 Aug 2021 00:54:48 +0200 Subject: [PATCH] Fix tests --- tests/integration/TestCase.php | 14 +++++++ tests/stubs/classes/AppExceptionHandler.php | 41 +++++++++++++++++++++ 2 files changed, 55 insertions(+) create mode 100644 tests/stubs/classes/AppExceptionHandler.php diff --git a/tests/integration/TestCase.php b/tests/integration/TestCase.php index 95df27fda..72ea139f7 100644 --- a/tests/integration/TestCase.php +++ b/tests/integration/TestCase.php @@ -4,6 +4,7 @@ use A17\Twill\AuthServiceProvider; use A17\Twill\Models\User; +use App\Exceptions\SnAppException; use A17\Twill\RouteServiceProvider; use A17\Twill\Tests\Integration\Behaviors\CopyBlocks; use A17\Twill\TwillServiceProvider; @@ -17,6 +18,7 @@ use Illuminate\Support\Facades\Route; use Illuminate\Support\Str; use Orchestra\Testbench\TestCase as OrchestraTestCase; +use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler; abstract class TestCase extends OrchestraTestCase { @@ -122,6 +124,8 @@ public function setUp(): void $this->copyBlocks(); $this->installTwill(); + + $this->ensureAppExceptionHandlerExists(); } /** @@ -761,4 +765,14 @@ public function migrate() public function loadConfig() { } + + public function ensureAppExceptionHandlerExists() + { + $stubPath = __DIR__.'/../../tests/stubs/classes/AppExceptionHandler.php'; + $filePath = __DIR__.'/../../vendor/orchestra/testbench-core/laravel/app/Exceptions/Handler.php'; + + if (!file_exists($filePath)) { + file_put_contents($filePath, file_get_contents($stubPath)); + } + } } diff --git a/tests/stubs/classes/AppExceptionHandler.php b/tests/stubs/classes/AppExceptionHandler.php new file mode 100644 index 000000000..c18c43cc1 --- /dev/null +++ b/tests/stubs/classes/AppExceptionHandler.php @@ -0,0 +1,41 @@ +reportable(function (Throwable $e) { + // + }); + } +}