#37 add external link to foodvendor
This commit is contained in:
parent
34171d6c2b
commit
56206acd8a
6 changed files with 79 additions and 4 deletions
|
@ -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]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue