#37 add external link to foodvendor
All checks were successful
/ ls (pull_request) Successful in 38s
/ ls (push) Successful in 37s
/ ls (release) Successful in 25s

This commit is contained in:
lubiana 2024-08-16 21:52:53 +02:00
parent 34171d6c2b
commit 56206acd8a
No known key found for this signature in database
6 changed files with 79 additions and 4 deletions

View file

@ -38,6 +38,7 @@ final class FoodVendorControllerTest extends DbWebTest
{
$fixture = new FoodVendor;
$fixture->setName('My Title');
$fixture->setMenuLink('https://example.com/');
$this->manager->persist($fixture);
$this->manager->flush();
@ -45,9 +46,17 @@ final class FoodVendorControllerTest extends DbWebTest
$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());
$nameNode = $crawler->filter(
'.table > tbody:nth-child(1) > tr:nth-child(1) > td:nth-child(2)'
)->text();
$menuLinkNode = $crawler->filter(
'.table > tbody:nth-child(1) > tr:nth-child(2) > td:nth-child(2) > a:nth-child(1)'
)->text();
$this->assertSame('My Title', $nameNode);
$this->assertSame('https://example.com/', $menuLinkNode);
}
public function testShowMenuItems(): void
@ -91,9 +100,10 @@ final class FoodVendorControllerTest extends DbWebTest
$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());
$nameNode = $crawler->filter(
'.table > tbody:nth-child(1) > tr:nth-child(1) > td:nth-child(2)'
)->text();
$this->assertSame('My Title', $nameNode);
$itemNodes = $crawler->filter('li');
@ -112,6 +122,7 @@ final class FoodVendorControllerTest extends DbWebTest
$this->client->submitForm('Update', [
'food_vendor[name]' => 'Something New',
'food_vendor[menuLink]' => 'https://example.com/',
]);
self::assertResponseRedirects('/food/vendor/');
@ -119,6 +130,7 @@ final class FoodVendorControllerTest extends DbWebTest
$fixture = $this->repository->findAll();
self::assertSame('Something New', $fixture[0]->getName());
self::assertSame('https://example.com/', $fixture[0]->getMenuLink());
}
#[Override]