diff --git a/templates/food_vendor/show.html.twig b/templates/food_vendor/show.html.twig
index a1a5803..45d6747 100644
--- a/templates/food_vendor/show.html.twig
+++ b/templates/food_vendor/show.html.twig
@@ -14,6 +14,15 @@
+
+ known menuitems
+ {% for item in food_vendor.menuItems %}
+ {{ item.name }}
+ {% endfor %}
+
+
+
+
back to list
edit
diff --git a/tests/Controller/FoodVendorControllerTest.php b/tests/Controller/FoodVendorControllerTest.php
index 42ef9f9..55a8c11 100644
--- a/tests/Controller/FoodVendorControllerTest.php
+++ b/tests/Controller/FoodVendorControllerTest.php
@@ -3,6 +3,7 @@
namespace App\Tests\Controller;
use App\Entity\FoodVendor;
+use App\Entity\MenuItem;
use App\Tests\DbWebTest;
use Override;
@@ -49,6 +50,56 @@ final class FoodVendorControllerTest extends DbWebTest
$this->assertSame('My Title', $nameNode->text());
}
+ public function testShowMenuItems(): void
+ {
+ $fixture = new FoodVendor;
+ $fixture->setName('My Title');
+
+ $this->manager->persist($fixture);
+
+ $this->manager->flush();
+
+ $itemOne = new MenuItem;
+ $itemOne->setName('Item One');
+
+ $fixture->addMenuItem($itemOne);
+ $this->manager->persist($itemOne);
+
+ $itemTwo = new MenuItem;
+ $itemTwo->setName('Item Two');
+ $itemTwo->setFoodVendor($fixture);
+
+ $fixture->addMenuItem($itemTwo);
+ $this->manager->persist($itemTwo);
+
+ $itemThree = new MenuItem;
+ $itemThree->setName('Item Three');
+ $itemThree->setFoodVendor($fixture);
+
+ $fixture->addMenuItem($itemThree);
+ $this->manager->persist($itemThree);
+
+ $itemFour = new MenuItem;
+ $itemFour->setName('Item Four');
+ $itemFour->setFoodVendor($fixture);
+
+ $fixture->addMenuItem($itemFour);
+ $this->manager->persist($itemFour);
+
+ $this->manager->flush();
+
+ $crawler = $this->client->request('GET', sprintf('%s%s', $this->path, $fixture->getId()));
+
+ $this->assertResponseIsSuccessful();
+ $nameNode = $crawler->filter('td')
+ ->last();
+ $this->assertSame('My Title', $nameNode->text());
+
+ $itemNodes = $crawler->filter('code');
+
+ $this->assertCount(4, $itemNodes);
+ }
+
public function testEdit(): void
{
$fixture = new FoodVendor;