From 9e354992693b2394521ae78f8b911f07ddea86a5 Mon Sep 17 00:00:00 2001 From: lubiana Date: Mon, 23 Sep 2024 19:02:17 +0200 Subject: [PATCH 1/3] do not show deleted menuitems --- infection.json5 | 3 ++- src/Controller/OrderItemController.php | 1 + tests/Controller/MenuItemControllerTest.php | 12 ++++++++++++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/infection.json5 b/infection.json5 index e6f50cc..1a80eed 100644 --- a/infection.json5 +++ b/infection.json5 @@ -13,7 +13,8 @@ "mutators": { "@default": true, "global-ignore": [ - "App\\Service\\Favicon::__toString" + "App\\Service\\Favicon::__toString", + "ORM\\Column.*" ] } } \ No newline at end of file diff --git a/src/Controller/OrderItemController.php b/src/Controller/OrderItemController.php index c973d97..ee1ef4b 100644 --- a/src/Controller/OrderItemController.php +++ b/src/Controller/OrderItemController.php @@ -56,6 +56,7 @@ final class OrderItemController extends AbstractController } $menuItems = $menuItemRepository->findBy([ 'foodVendor' => $foodOrder->getFoodVendor(), + 'deletedAt' => null, ]); return $this->render('order_item/new.html.twig', [ diff --git a/tests/Controller/MenuItemControllerTest.php b/tests/Controller/MenuItemControllerTest.php index 9dc0058..b3b799e 100644 --- a/tests/Controller/MenuItemControllerTest.php +++ b/tests/Controller/MenuItemControllerTest.php @@ -2,6 +2,7 @@ namespace App\Tests\Controller; +use App\Entity\FoodOrder; use App\Entity\FoodVendor; use App\Entity\MenuItem; use App\Tests\DbWebTest; @@ -85,6 +86,10 @@ final class MenuItemControllerTest extends DbWebTest $this->vendor->addMenuItem($menuItem); $this->manager->persist($this->vendor); $this->manager->persist($menuItem); + + $order = new FoodOrder(); + $order->setFoodVendor($this->vendor); + $this->manager->persist($order); $this->manager->flush(); $this->assertFalse($menuItem->isDeleted()); @@ -94,5 +99,12 @@ final class MenuItemControllerTest extends DbWebTest $menuItem = $this->repository->find($menuItem->getId()); $this->assertTrue($menuItem->isDeleted()); + + $crawler = $this->client->request('GET', '/order/item/new/' . $order->getId()); + $count = $crawler->filter('body > main:nth-child(2) > div:nth-child(5)')->children()->count(); + $this->assertSame(0, $count); + + $this->assertResponseIsSuccessful(); + } } -- 2.39.5 From 80758abd6013808c1cc52142a58f15f4f636d96a Mon Sep 17 00:00:00 2001 From: lubiana Date: Mon, 23 Sep 2024 19:09:18 +0200 Subject: [PATCH 2/3] fix ci --- .forgejo/workflows/pull_request.yml | 2 +- .forgejo/workflows/push.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.forgejo/workflows/pull_request.yml b/.forgejo/workflows/pull_request.yml index 34cc06d..19f4777 100644 --- a/.forgejo/workflows/pull_request.yml +++ b/.forgejo/workflows/pull_request.yml @@ -9,7 +9,7 @@ jobs: env: REPO: '${{ github.repository }}' TOKEN: '${{ secrets.GITHUB_TOKEN }}' - GIT_SERVER: 'hannover.ccc.de/gitlab' + GIT_SERVER: 'git.hannover.ccc.de' run: | git clone --branch $GITHUB_HEAD_REF https://${TOKEN}@${GIT_SERVER}/${REPO}.git . git fetch diff --git a/.forgejo/workflows/push.yml b/.forgejo/workflows/push.yml index 259579e..97a0662 100644 --- a/.forgejo/workflows/push.yml +++ b/.forgejo/workflows/push.yml @@ -13,7 +13,7 @@ jobs: REPO: '${{ github.repository }}' TOKEN: '${{ secrets.GITHUB_TOKEN }}' BRANCH: '${{ env.GITHUB_REF_NAME }}' - GIT_SERVER: 'hannover.ccc.de/gitlab' + GIT_SERVER: 'git.hannover.ccc.de' run: | git clone --branch $GITHUB_REF_NAME https://${TOKEN}@${GIT_SERVER}/${REPO}.git . git fetch -- 2.39.5 From ee5d515ac11d034559bd639bb70356a1eb33dad4 Mon Sep 17 00:00:00 2001 From: Continuous Integration Date: Mon, 23 Sep 2024 17:11:33 +0000 Subject: [PATCH 3/3] Continuous Integration Fixes --- tests/Controller/MenuItemControllerTest.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tests/Controller/MenuItemControllerTest.php b/tests/Controller/MenuItemControllerTest.php index b3b799e..4d6dd02 100644 --- a/tests/Controller/MenuItemControllerTest.php +++ b/tests/Controller/MenuItemControllerTest.php @@ -87,8 +87,9 @@ final class MenuItemControllerTest extends DbWebTest $this->manager->persist($this->vendor); $this->manager->persist($menuItem); - $order = new FoodOrder(); + $order = new FoodOrder; $order->setFoodVendor($this->vendor); + $this->manager->persist($order); $this->manager->flush(); $this->assertFalse($menuItem->isDeleted()); @@ -101,7 +102,9 @@ final class MenuItemControllerTest extends DbWebTest $this->assertTrue($menuItem->isDeleted()); $crawler = $this->client->request('GET', '/order/item/new/' . $order->getId()); - $count = $crawler->filter('body > main:nth-child(2) > div:nth-child(5)')->children()->count(); + $count = $crawler->filter('body > main:nth-child(2) > div:nth-child(5)') + ->children() + ->count(); $this->assertSame(0, $count); $this->assertResponseIsSuccessful(); -- 2.39.5