add simple apitest
This commit is contained in:
parent
d92a63fd7d
commit
b00b923d43
13 changed files with 349 additions and 8 deletions
26
tests/DbApiTestCase.php
Normal file
26
tests/DbApiTestCase.php
Normal file
|
@ -0,0 +1,26 @@
|
|||
<?php declare(strict_types=1);
|
||||
|
||||
namespace App\Tests;
|
||||
|
||||
use ApiPlatform\Symfony\Bundle\Test\ApiTestCase;
|
||||
use ApiPlatform\Symfony\Bundle\Test\Client;
|
||||
use App\DataFixtures\AppFixtures;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Liip\TestFixturesBundle\Services\DatabaseToolCollection;
|
||||
use Override;
|
||||
|
||||
abstract class DbApiTestCase extends ApiTestCase
|
||||
{
|
||||
protected EntityManagerInterface $manager;
|
||||
protected Client $client;
|
||||
|
||||
#[Override]
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
$this->client = static::createClient();
|
||||
$this->manager = static::getContainer()->get('doctrine')->getManager();
|
||||
$toolKit = self::getContainer()->get(DatabaseToolCollection::class)->get();
|
||||
$toolKit->loadFixtures([AppFixtures::class]);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue