From 845289bed85e611e254fdb60f3723e6d9f5cbac6 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Wed, 18 Jan 2023 18:02:45 +1100 Subject: [PATCH] Fixes for tests --- .github/workflows/parallel.yml | 2 +- app/Providers/AppServiceProvider.php | 18 ++++++------------ 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/.github/workflows/parallel.yml b/.github/workflows/parallel.yml index 6be9ac3892e2..74570175cec1 100644 --- a/.github/workflows/parallel.yml +++ b/.github/workflows/parallel.yml @@ -106,7 +106,7 @@ jobs: run: | cat .env vendor/bin/snappdf download - run: tests/ci + tests/ci env: DB_PORT: ${{ job.services.mysql.ports[3306] }} PHP_CS_FIXER_IGNORE_ENV: true diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index ad099a102351..350dc59eaa34 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -18,18 +18,16 @@ use App\Models\Invoice; use App\Models\Proposal; use App\Utils\Ninja; use App\Utils\TruthSource; -use Illuminate\Cache\RateLimiting\Limit; -use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations\Relation; use Illuminate\Mail\Mailer; use Illuminate\Queue\Events\JobProcessing; use Illuminate\Support\Facades\App; use Illuminate\Support\Facades\Artisan; use Illuminate\Support\Facades\Blade; +use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\Mail; use Illuminate\Support\Facades\ParallelTesting; use Illuminate\Support\Facades\Queue; -use Illuminate\Support\Facades\RateLimiter; use Illuminate\Support\Facades\Schema; use Illuminate\Support\ServiceProvider; use Livewire\Livewire; @@ -109,15 +107,11 @@ class AppServiceProvider extends ServiceProvider Artisan::call('db:seed'); }); - } - - /** - * Register any application services. - * - * @return void - */ - public function register() - { + ParallelTesting::tearDownProcess(function ($token, $testCase) { + if (DB::connection(config('database.default'))->transactionLevel() > 0) { + DB::connection(config('database.default'))->rollBack(); + } + }); } }