From 93bc59409e927cb0b938972a2671b5f4d7987a18 Mon Sep 17 00:00:00 2001 From: EnesSacid-Buker <73346401+EnesSacid-Buker@users.noreply.github.com> Date: Wed, 16 Feb 2022 16:13:50 +0300 Subject: [PATCH 1/3] Using existing customer Already [creating](https://github.com/akaunting/akaunting/blob/master/database/seeds/TestCompany.php#L78) customer during testing --- tests/Feature/PaymentTestCase.php | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/tests/Feature/PaymentTestCase.php b/tests/Feature/PaymentTestCase.php index 9239d6490..19673c7de 100644 --- a/tests/Feature/PaymentTestCase.php +++ b/tests/Feature/PaymentTestCase.php @@ -5,7 +5,6 @@ namespace Tests\Feature; use App\Models\Auth\User; use App\Models\Common\Contact; use App\Models\Document\Document; -use App\Jobs\Common\CreateContact; use App\Jobs\Document\CreateDocument; use App\Jobs\Setting\CreateCurrency; use Illuminate\Support\Facades\File; @@ -52,7 +51,7 @@ class PaymentTestCase extends FeatureTestCase $this->updateSetting(); - $this->createCustomer(); + $this->loginAsCustomer(); $this->createInvoice(); @@ -140,20 +139,11 @@ class PaymentTestCase extends FeatureTestCase $this->invoice = $this->dispatch(new CreateDocument($this->getInvoiceRequest())); } - public function createCustomer() + public function loginAsCustomer() { - $password = $this->faker->password; + $this->customer = Contact::customer()->first(); - $request = Contact::factory()->customer()->enabled()->raw() + [ - 'create_user' => 'true', - 'locale' => 'en-GB', - 'password' => $password, - 'password_confirmation' => $password, - ]; - - $this->customer = $this->dispatch(new CreateContact($request)); - - $this->customer_user = User::where('email', $request['email'])->first(); + $this->customer_user = User::where('email', $this->customer->email)->first(); } public function getInvoiceRequest() From 24b2f14d849c33b369fe4a107097e4f5eb5895d0 Mon Sep 17 00:00:00 2001 From: EnesSacid-Buker Date: Wed, 16 Feb 2022 18:19:26 +0300 Subject: [PATCH 2/3] Revert "Using existing customer" This reverts commit 93bc59409e927cb0b938972a2671b5f4d7987a18. --- tests/Feature/PaymentTestCase.php | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/tests/Feature/PaymentTestCase.php b/tests/Feature/PaymentTestCase.php index 19673c7de..9239d6490 100644 --- a/tests/Feature/PaymentTestCase.php +++ b/tests/Feature/PaymentTestCase.php @@ -5,6 +5,7 @@ namespace Tests\Feature; use App\Models\Auth\User; use App\Models\Common\Contact; use App\Models\Document\Document; +use App\Jobs\Common\CreateContact; use App\Jobs\Document\CreateDocument; use App\Jobs\Setting\CreateCurrency; use Illuminate\Support\Facades\File; @@ -51,7 +52,7 @@ class PaymentTestCase extends FeatureTestCase $this->updateSetting(); - $this->loginAsCustomer(); + $this->createCustomer(); $this->createInvoice(); @@ -139,11 +140,20 @@ class PaymentTestCase extends FeatureTestCase $this->invoice = $this->dispatch(new CreateDocument($this->getInvoiceRequest())); } - public function loginAsCustomer() + public function createCustomer() { - $this->customer = Contact::customer()->first(); + $password = $this->faker->password; - $this->customer_user = User::where('email', $this->customer->email)->first(); + $request = Contact::factory()->customer()->enabled()->raw() + [ + 'create_user' => 'true', + 'locale' => 'en-GB', + 'password' => $password, + 'password_confirmation' => $password, + ]; + + $this->customer = $this->dispatch(new CreateContact($request)); + + $this->customer_user = User::where('email', $request['email'])->first(); } public function getInvoiceRequest() From 7646caf82eefa77764f9cee57ec1d61ef91a7695 Mon Sep 17 00:00:00 2001 From: EnesSacid-Buker <73346401+EnesSacid-Buker@users.noreply.github.com> Date: Mon, 28 Feb 2022 19:42:33 +0300 Subject: [PATCH 3/3] Module update clear cache. --- app/Jobs/Install/FinishUpdate.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/Jobs/Install/FinishUpdate.php b/app/Jobs/Install/FinishUpdate.php index 2b124b556..2a374e67e 100644 --- a/app/Jobs/Install/FinishUpdate.php +++ b/app/Jobs/Install/FinishUpdate.php @@ -8,6 +8,7 @@ use App\Models\Module\Module; use App\Traits\Modules; use App\Utilities\Console; use Illuminate\Filesystem\Filesystem; +use Illuminate\Support\Facades\Artisan; use Illuminate\Support\Facades\File; class FinishUpdate extends Job @@ -81,6 +82,8 @@ class FinishUpdate extends Job $listener = $this->getListenerTypeOfModule(); if ($listener == 'none') { + Artisan::call('cache:clear'); + return []; }