add food vendor tests
This commit is contained in:
parent
63bf367ab0
commit
a7bec45c48
8 changed files with 39 additions and 53 deletions
|
@ -18,14 +18,10 @@ final class FoodVendorControllerTest extends DbWebTest
|
|||
|
||||
self::assertResponseStatusCodeSame(200);
|
||||
self::assertPageTitleContains('FoodVendor index');
|
||||
|
||||
// Use the $crawler to perform additional assertions e.g.
|
||||
// self::assertSame('Some text on the page', $crawler->filter('.p')->first());
|
||||
}
|
||||
|
||||
public function testNew(): void
|
||||
{
|
||||
$this->markTestIncomplete();
|
||||
$this->client->request('GET', sprintf('%snew', $this->path));
|
||||
|
||||
self::assertResponseStatusCodeSame(200);
|
||||
|
@ -34,31 +30,27 @@ final class FoodVendorControllerTest extends DbWebTest
|
|||
'food_vendor[name]' => 'Testing',
|
||||
]);
|
||||
|
||||
self::assertResponseRedirects($this->path);
|
||||
|
||||
self::assertSame(1, $this->repository->count([]));
|
||||
}
|
||||
|
||||
public function testShow(): void
|
||||
{
|
||||
$this->markTestIncomplete();
|
||||
$fixture = new FoodVendor;
|
||||
$fixture->setName('My Title');
|
||||
|
||||
$this->manager->persist($fixture);
|
||||
$this->manager->flush();
|
||||
|
||||
$this->client->request('GET', sprintf('%s%s', $this->path, $fixture->getId()));
|
||||
$crawler = $this->client->request('GET', sprintf('%s%s', $this->path, $fixture->getId()));
|
||||
|
||||
self::assertResponseStatusCodeSame(200);
|
||||
self::assertPageTitleContains('FoodVendor');
|
||||
|
||||
// Use assertions to check that the properties are properly displayed.
|
||||
$this->assertResponseIsSuccessful();
|
||||
$nameNode = $crawler->filter('td')
|
||||
->last();
|
||||
$this->assertSame('My Title', $nameNode->text());
|
||||
}
|
||||
|
||||
public function testEdit(): void
|
||||
{
|
||||
$this->markTestIncomplete();
|
||||
$fixture = new FoodVendor;
|
||||
$fixture->setName('Value');
|
||||
|
||||
|
@ -78,22 +70,6 @@ final class FoodVendorControllerTest extends DbWebTest
|
|||
self::assertSame('Something New', $fixture[0]->getName());
|
||||
}
|
||||
|
||||
public function testRemove(): void
|
||||
{
|
||||
$this->markTestIncomplete();
|
||||
$fixture = new FoodVendor;
|
||||
$fixture->setName('Value');
|
||||
|
||||
$this->manager->persist($fixture);
|
||||
$this->manager->flush();
|
||||
|
||||
$this->client->request('GET', sprintf('%s%s', $this->path, $fixture->getId()));
|
||||
$this->client->submitForm('Delete');
|
||||
|
||||
self::assertResponseRedirects('/food/vendor/');
|
||||
self::assertSame(0, $this->repository->count([]));
|
||||
}
|
||||
|
||||
#[Override]
|
||||
public function getEntityClass(): string
|
||||
{
|
||||
|
|
|
@ -22,8 +22,10 @@ abstract class DbWebTest extends WebTestCase
|
|||
{
|
||||
$this->client = static::createClient();
|
||||
$this->manager = static::getContainer()->get('doctrine')->getManager();
|
||||
(new SchemaTool($this->manager))
|
||||
->createSchema($this->manager->getMetadataFactory()->getAllMetadata());
|
||||
$schemaTool = new SchemaTool($this->manager);
|
||||
$metadata = $this->manager->getMetadataFactory()
|
||||
->getAllMetadata();
|
||||
$schemaTool->updateSchema($metadata);
|
||||
|
||||
$this->repository = $this->manager->getRepository($this->getEntityClass());
|
||||
foreach ($this->repository->findAll() as $object) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue