From 94e9a9f3df6dba09e3383997dc5189895c68c4d5 Mon Sep 17 00:00:00 2001 From: alex-chevski Date: Mon, 15 Jan 2024 23:01:31 +0300 Subject: [PATCH 1/2] correct plan tests --- tests/Feature/Plan/CreateTest.php | 8 +++----- tests/Feature/Plan/EditTest.php | 9 +++++---- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/tests/Feature/Plan/CreateTest.php b/tests/Feature/Plan/CreateTest.php index 414c422..46302b9 100644 --- a/tests/Feature/Plan/CreateTest.php +++ b/tests/Feature/Plan/CreateTest.php @@ -73,8 +73,7 @@ class CreateTest extends TestCase ->assertSuccessful() ->assertHasNoErrors(['name', 'image', 'duration', 'details', 'packets_count', 'packet1_options', 'packet2_options', 'packet3_options']); - - $lastCreatedPlan = Plan::orderBy('id', 'desc')->first(); + $lastCreatedPlan = Plan::orderByDesc('id')->first(); $newPlanUrl = route('plan.show', $lastCreatedPlan); @@ -117,8 +116,7 @@ class CreateTest extends TestCase ->assertSet('packet3_options', $this->plan->packet3_options) ->call('addToDrafts') ->assertSuccessful() - ->assertHasNoErrors(['name', 'image', 'duration', 'details']); - + ->assertHasNoErrors(['name', 'image', 'duration', 'details', 'packets_count', 'packet1_options', 'packet2_options', 'packet3_options']); $lastCreatedPlan = Plan::orderBy('id', 'desc')->first(); $newPlanUrl = route('plan.show', $lastCreatedPlan); @@ -160,7 +158,7 @@ class CreateTest extends TestCase ->assertSet('packet3_options', $this->plan->packet3_options) ->call('showPreview') ->assertSuccessful() - ->assertHasNoErrors(['name', 'image', 'duration', 'details']); + ->assertHasNoErrors(['name', 'image', 'duration', 'details', 'packets_count', 'packet1_options', 'packet2_options', 'packet3_options']); $lastCreatedPlan = Plan::orderBy('id', 'desc')->first(); $newPlanUrl = route('plan.show', $lastCreatedPlan); diff --git a/tests/Feature/Plan/EditTest.php b/tests/Feature/Plan/EditTest.php index e15121a..a980a5c 100644 --- a/tests/Feature/Plan/EditTest.php +++ b/tests/Feature/Plan/EditTest.php @@ -129,7 +129,7 @@ class EditTest extends TestCase $updatedPlanAfterToAddDatabase = Plan::orderByDesc('id')->first(); - $newPlanUrl = route('plan.show', $updatedPlanAfterToAddDatabase, false); + $newPlanUrl = route('plan.show', $updatedPlanAfterToAddDatabase); Storage::disk('tmp-for-tests')->assertExists($updatedPlanAfterToAddDatabase->image); @@ -181,7 +181,7 @@ class EditTest extends TestCase $updatedPlanAfterToAddDatabase = Plan::orderByDesc('id')->first(); - $newPlanUrl = route('plan.show', $updatedPlanAfterToAddDatabase, false); + $newPlanUrl = route('plan.show', $updatedPlanAfterToAddDatabase); Storage::disk('tmp-for-tests')->assertExists($updatedPlanAfterToAddDatabase->image); @@ -208,10 +208,12 @@ class EditTest extends TestCase ]) ->call('publish') ->assertSuccessful() - ->assertHasNoErrors(['title', 'image', 'state', 'cooking_time', 'ingredients', 'type', 'description', 'steps', 'video_url']); + ->assertHasNoErrors(['name', 'image', 'duration', 'details', 'packets_count', 'packet1_options', 'packet2_options', 'packet3_options']); $newPlanUrl = route('plan.show', $this->plan); + $planUpdate->assertRedirect($newPlanUrl); + Storage::disk('tmp-for-tests')->assertMissing($planUpdate->image); // check data after update recipe @@ -225,7 +227,6 @@ class EditTest extends TestCase self::assertIsArray($planUpdate->packet2_options); self::assertIsArray($planUpdate->packet3_options); - $planUpdate->assertRedirect($newPlanUrl); } } From fc333143ce799299cbea55a7c8e30f53d9b68ae1 Mon Sep 17 00:00:00 2001 From: alex-chevski Date: Tue, 16 Jan 2024 16:16:11 +0300 Subject: [PATCH 2/2] remove code cache extensions from test.yml --- .gitea/workflows/test.yaml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.gitea/workflows/test.yaml b/.gitea/workflows/test.yaml index c81677d..f4651b1 100644 --- a/.gitea/workflows/test.yaml +++ b/.gitea/workflows/test.yaml @@ -23,12 +23,12 @@ jobs: extensions: ${{ env.extensions }} key: ${{ env.key }} - - name: Cache extensions - uses: actions/cache@v3 - with: - path: ${{ steps.extcache.outputs.dir }} - key: ${{ steps.extcache.outputs.key }} - restore-keys: ${{ steps.extcache.outputs.key }} + # - name: Cache extensions + # uses: actions/cache@v3 + # with: + # path: ${{ steps.extcache.outputs.dir }} + # key: ${{ steps.extcache.outputs.key }} + # restore-keys: ${{ steps.extcache.outputs.key }} - name: Setup PHP uses: apoloz/setup-php@v2