From 91d8952e09708e2a160ddfb95d0e15eba1240ee0 Mon Sep 17 00:00:00 2001 From: Burak Civan Date: Sat, 29 May 2021 19:17:48 +0300 Subject: [PATCH] Pull request test bugfix edited --- tests/Feature/Wizard/CompaniesTest.php | 10 ++++++--- tests/Feature/Wizard/CurrenciesTest.php | 30 +++++++++++++++++-------- tests/Feature/Wizard/TaxesTest.php | 30 +++++++++++++++++-------- 3 files changed, 49 insertions(+), 21 deletions(-) diff --git a/tests/Feature/Wizard/CompaniesTest.php b/tests/Feature/Wizard/CompaniesTest.php index 411d5ad4c..6add6a521 100644 --- a/tests/Feature/Wizard/CompaniesTest.php +++ b/tests/Feature/Wizard/CompaniesTest.php @@ -18,11 +18,15 @@ class CompaniesTest extends FeatureTestCase { $request = $this->getRequest(); + $message = trans('messages.success.updated', ['type' => trans_choice('general.companies', 2)]); + $this->loginAs() ->post(route('wizard.companies.update'), $request) - ->assertStatus(200); - - $this->assertFlashLevel('success'); + ->assertStatus(200) + ->assertJson([ + 'success' => true, + 'message' => $message, + ]); } public function getRequest() diff --git a/tests/Feature/Wizard/CurrenciesTest.php b/tests/Feature/Wizard/CurrenciesTest.php index b3405a455..0ad989b7b 100644 --- a/tests/Feature/Wizard/CurrenciesTest.php +++ b/tests/Feature/Wizard/CurrenciesTest.php @@ -19,11 +19,15 @@ class CurrenciesTest extends FeatureTestCase { $request = $this->getRequest(); + $message = trans('messages.success.added', ['type' => trans_choice('general.currencies', 1)]); + $this->loginAs() ->post(route('wizard.currencies.store'), $request) - ->assertStatus(200); - - $this->assertFlashLevel('success'); + ->assertStatus(200) + ->assertJson([ + 'success' => true, + 'message' => $message, + ]); $this->assertDatabaseHas('currencies', [ 'code' => $request['code'], @@ -38,11 +42,15 @@ class CurrenciesTest extends FeatureTestCase $request['name'] = $this->faker->text(15); + $message = trans('messages.success.updated', ['type' => $currency->name]); + $this->loginAs() ->patch(route('wizard.currencies.update', $currency->id), $request) - ->assertStatus(200); - - $this->assertFlashLevel('success'); + ->assertStatus(200) + ->assertJson([ + 'success' => true, + 'message' => $message, + ]); $this->assertDatabaseHas('currencies', [ 'code' => $request['code'], @@ -55,11 +63,15 @@ class CurrenciesTest extends FeatureTestCase $currency = $this->dispatch(new CreateCurrency($request)); + $message = trans('messages.success.deleted', ['type' => $currency->name]); + $this->loginAs() ->delete(route('wizard.currencies.destroy', $currency->id)) - ->assertStatus(200); - - $this->assertFlashLevel('success'); + ->assertStatus(200) + ->assertJson([ + 'success' => true, + 'message' => $message, + ]); $this->assertSoftDeleted('currencies', [ 'code' => $request['code'], diff --git a/tests/Feature/Wizard/TaxesTest.php b/tests/Feature/Wizard/TaxesTest.php index 9f9640aa2..643ecc327 100644 --- a/tests/Feature/Wizard/TaxesTest.php +++ b/tests/Feature/Wizard/TaxesTest.php @@ -19,11 +19,15 @@ class TaxesTest extends FeatureTestCase { $request = $this->getRequest(); + $message = trans('messages.success.added', ['type' => trans_choice('general.taxes', 1)]); + $this->loginAs() ->post(route('wizard.taxes.store'), $request) - ->assertStatus(200); - - $this->assertFlashLevel('success'); + ->assertStatus(200) + ->assertJson([ + 'success' => true, + 'message' => $message, + ]); $this->assertDatabaseHas('taxes', $request); } @@ -36,11 +40,15 @@ class TaxesTest extends FeatureTestCase $request['name'] = $this->faker->text(15); + $message = trans('messages.success.updated', ['type' => $tax->name]); + $this->loginAs() ->patch(route('wizard.taxes.update', $tax->id), $request) - ->assertStatus(200); - - $this->assertFlashLevel('success'); + ->assertStatus(200) + ->assertJson([ + 'success' => true, + 'message' => $message, + ]); $this->assertDatabaseHas('taxes', $request); } @@ -51,11 +59,15 @@ class TaxesTest extends FeatureTestCase $tax = $this->dispatch(new CreateTax($request)); + $message = trans('messages.success.deleted', ['type' => $tax->name]); + $this->loginAs() ->delete(route('wizard.taxes.destroy', $tax->id)) - ->assertStatus(200); - - $this->assertFlashLevel('success'); + ->assertStatus(200) + ->assertJson([ + 'success' => true, + 'message' => $message, + ]); $this->assertDatabaseHas('taxes', $request); }