do not show deleted menuitems #63
3 changed files with 15 additions and 1 deletions
|
@ -13,7 +13,8 @@
|
||||||
"mutators": {
|
"mutators": {
|
||||||
"@default": true,
|
"@default": true,
|
||||||
"global-ignore": [
|
"global-ignore": [
|
||||||
"App\\Service\\Favicon::__toString"
|
"App\\Service\\Favicon::__toString",
|
||||||
|
"ORM\\Column.*"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -56,6 +56,7 @@ final class OrderItemController extends AbstractController
|
||||||
}
|
}
|
||||||
$menuItems = $menuItemRepository->findBy([
|
$menuItems = $menuItemRepository->findBy([
|
||||||
'foodVendor' => $foodOrder->getFoodVendor(),
|
'foodVendor' => $foodOrder->getFoodVendor(),
|
||||||
|
'deletedAt' => null,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return $this->render('order_item/new.html.twig', [
|
return $this->render('order_item/new.html.twig', [
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
namespace App\Tests\Controller;
|
namespace App\Tests\Controller;
|
||||||
|
|
||||||
|
use App\Entity\FoodOrder;
|
||||||
use App\Entity\FoodVendor;
|
use App\Entity\FoodVendor;
|
||||||
use App\Entity\MenuItem;
|
use App\Entity\MenuItem;
|
||||||
use App\Tests\DbWebTest;
|
use App\Tests\DbWebTest;
|
||||||
|
@ -85,6 +86,10 @@ final class MenuItemControllerTest extends DbWebTest
|
||||||
$this->vendor->addMenuItem($menuItem);
|
$this->vendor->addMenuItem($menuItem);
|
||||||
$this->manager->persist($this->vendor);
|
$this->manager->persist($this->vendor);
|
||||||
$this->manager->persist($menuItem);
|
$this->manager->persist($menuItem);
|
||||||
|
|
||||||
|
$order = new FoodOrder();
|
||||||
|
$order->setFoodVendor($this->vendor);
|
||||||
|
$this->manager->persist($order);
|
||||||
$this->manager->flush();
|
$this->manager->flush();
|
||||||
$this->assertFalse($menuItem->isDeleted());
|
$this->assertFalse($menuItem->isDeleted());
|
||||||
|
|
||||||
|
@ -94,5 +99,12 @@ final class MenuItemControllerTest extends DbWebTest
|
||||||
$menuItem = $this->repository->find($menuItem->getId());
|
$menuItem = $this->repository->find($menuItem->getId());
|
||||||
|
|
||||||
$this->assertTrue($menuItem->isDeleted());
|
$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();
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue