add order
All checks were successful
/ ls (pull_request) Successful in 27s
/ ls (push) Successful in 27s

This commit is contained in:
lubiana 2024-06-14 17:41:00 +02:00
parent 7663f684a4
commit 1dc5306967
No known key found for this signature in database
37 changed files with 1060 additions and 113 deletions

View file

@ -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;
}
}