add order
This commit is contained in:
parent
7663f684a4
commit
1dc5306967
37 changed files with 1060 additions and 113 deletions
108
tests/Controller/OrderItemControllerTest.php
Normal file
108
tests/Controller/OrderItemControllerTest.php
Normal file
|
@ -0,0 +1,108 @@
|
|||
<?php declare(strict_types=1);
|
||||
|
||||
namespace App\Test\Controller;
|
||||
|
||||
use App\Entity\OrderItem;
|
||||
use App\Tests\DbWebTest;
|
||||
use Override;
|
||||
|
||||
use function sprintf;
|
||||
|
||||
final class OrderItemControllerTest extends DbWebTest
|
||||
{
|
||||
private string $path = '/order/item/';
|
||||
|
||||
public function testIndex(): void
|
||||
{
|
||||
$this->client->request('GET', $this->path);
|
||||
|
||||
self::assertResponseStatusCodeSame(200);
|
||||
self::assertPageTitleContains('OrderItem 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);
|
||||
|
||||
$this->client->submitForm('Save', [
|
||||
'order_item[name]' => 'Testing',
|
||||
'order_item[extras]' => 'Testing',
|
||||
]);
|
||||
|
||||
self::assertResponseRedirects($this->path);
|
||||
|
||||
self::assertSame(1, $this->repository->count([]));
|
||||
}
|
||||
|
||||
public function testShow(): void
|
||||
{
|
||||
$this->markTestIncomplete();
|
||||
$fixture = new OrderItem;
|
||||
$fixture->setName('My Title');
|
||||
$fixture->setExtras('My Title');
|
||||
|
||||
$this->manager->persist($fixture);
|
||||
$this->manager->flush();
|
||||
|
||||
$this->client->request('GET', sprintf('%s%s', $this->path, $fixture->getId()));
|
||||
|
||||
self::assertResponseStatusCodeSame(200);
|
||||
self::assertPageTitleContains('OrderItem');
|
||||
|
||||
// Use assertions to check that the properties are properly displayed.
|
||||
}
|
||||
|
||||
public function testEdit(): void
|
||||
{
|
||||
$this->markTestIncomplete();
|
||||
$fixture = new OrderItem;
|
||||
$fixture->setName('Value');
|
||||
$fixture->setExtras('Value');
|
||||
|
||||
$this->manager->persist($fixture);
|
||||
$this->manager->flush();
|
||||
|
||||
$this->client->request('GET', sprintf('%s%s/edit', $this->path, $fixture->getId()));
|
||||
|
||||
$this->client->submitForm('Update', [
|
||||
'order_item[name]' => 'Something New',
|
||||
'order_item[extras]' => 'Something New',
|
||||
]);
|
||||
|
||||
self::assertResponseRedirects('/order/item/');
|
||||
|
||||
$fixture = $this->repository->findAll();
|
||||
|
||||
self::assertSame('Something New', $fixture[0]->getName());
|
||||
self::assertSame('Something New', $fixture[0]->getExtras());
|
||||
}
|
||||
|
||||
public function testRemove(): void
|
||||
{
|
||||
$this->markTestIncomplete();
|
||||
$fixture = new OrderItem;
|
||||
$fixture->setName('Value');
|
||||
$fixture->setExtras('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('/order/item/');
|
||||
self::assertSame(0, $this->repository->count([]));
|
||||
}
|
||||
|
||||
#[Override]
|
||||
public function getEntityClass(): string
|
||||
{
|
||||
return OrderItem::class;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue