add order
This commit is contained in:
parent
7663f684a4
commit
1dc5306967
37 changed files with 1060 additions and 113 deletions
|
@ -3,43 +3,15 @@
|
|||
namespace App\Test\Controller;
|
||||
|
||||
use App\Entity\FoodVendor;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Doctrine\ORM\EntityRepository;
|
||||
use Doctrine\ORM\Tools\SchemaTool;
|
||||
use App\Tests\DbWebTest;
|
||||
use Override;
|
||||
use Symfony\Bundle\FrameworkBundle\KernelBrowser;
|
||||
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
||||
|
||||
use function sprintf;
|
||||
|
||||
final class FoodVendorControllerTest extends WebTestCase
|
||||
final class FoodVendorControllerTest extends DbWebTest
|
||||
{
|
||||
private KernelBrowser $client;
|
||||
private EntityManagerInterface $manager;
|
||||
private EntityRepository $repository;
|
||||
private string $path = '/food/vendor/';
|
||||
|
||||
private function initDataBase(): void
|
||||
{
|
||||
(new SchemaTool($this->manager))
|
||||
->createSchema($this->manager->getMetadataFactory()->getAllMetadata());
|
||||
}
|
||||
|
||||
#[Override]
|
||||
protected function setUp(): void
|
||||
{
|
||||
$this->client = static::createClient();
|
||||
$this->manager = static::getContainer()->get('doctrine')->getManager();
|
||||
$this->initDataBase();
|
||||
$this->repository = $this->manager->getRepository(FoodVendor::class);
|
||||
|
||||
foreach ($this->repository->findAll() as $object) {
|
||||
$this->manager->remove($object);
|
||||
}
|
||||
|
||||
$this->manager->flush();
|
||||
}
|
||||
|
||||
public function testIndex(): void
|
||||
{
|
||||
$this->client->request('GET', $this->path);
|
||||
|
@ -121,4 +93,10 @@ final class FoodVendorControllerTest extends WebTestCase
|
|||
self::assertResponseRedirects('/food/vendor/');
|
||||
self::assertSame(0, $this->repository->count([]));
|
||||
}
|
||||
|
||||
#[Override]
|
||||
public function getEntityClass(): string
|
||||
{
|
||||
return FoodVendor::class;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue