Remove entity manager from tests
This commit is contained in:
@@ -11,7 +11,6 @@ use App\Entity\Project\ProjectTerritory;
|
||||
use App\Factory\Project\ProjectFactory;
|
||||
use App\Factory\User\UserFactory;
|
||||
use App\Tests\Traits\TestHelperTrait;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Zenstruck\Foundry\Test\Factories;
|
||||
use Zenstruck\Foundry\Test\ResetDatabase;
|
||||
@@ -22,18 +21,13 @@ abstract class BaseTest extends ApiTestCase
|
||||
use Factories;
|
||||
use TestHelperTrait;
|
||||
|
||||
protected EntityManagerInterface $entityManager;
|
||||
|
||||
private const USER_EMAIL = 'testuser@example.com';
|
||||
private const USER_PASSWORD = 'projectapitestuserpassword';
|
||||
protected const BASE_URI = '/v4/projects';
|
||||
|
||||
public function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
self::bootKernel();
|
||||
|
||||
$this->entityManager = static::getContainer()->get(EntityManagerInterface::class);
|
||||
}
|
||||
|
||||
// Auxiliary Methods
|
||||
|
||||
@@ -6,13 +6,10 @@ use App\Entity\Project\Category;
|
||||
use App\Entity\Project\ProjectStatus;
|
||||
use App\Entity\Project\ProjectTerritory;
|
||||
use App\Factory\Project\ProjectFactory;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
class GetAllTest extends BaseTest
|
||||
{
|
||||
protected EntityManagerInterface $entityManager;
|
||||
|
||||
private const PAGE_SIZE = 30;
|
||||
|
||||
// Auxiliary functions
|
||||
@@ -141,8 +138,6 @@ class GetAllTest extends BaseTest
|
||||
$responseData = json_decode($client->getResponse()->getContent(), true);
|
||||
$this->assertSame($totalNumberOfProjects, $responseData['totalItems']);
|
||||
$this->assertCount(max($numberOfProjectsInPage, 0), $responseData['member']);
|
||||
|
||||
$this->entityManager->clear();
|
||||
}
|
||||
|
||||
public function testGetAllDefaultsFirstPage(): void
|
||||
@@ -164,8 +159,6 @@ class GetAllTest extends BaseTest
|
||||
$responseData = json_decode($client->getResponse()->getContent(), true);
|
||||
$this->assertSame($totalNumberOfProjects, $responseData['totalItems']);
|
||||
$this->assertCount($itemsPerPage, $responseData['member']);
|
||||
|
||||
$this->entityManager->clear();
|
||||
}
|
||||
|
||||
public function testGetAllByTitle()
|
||||
|
||||
Reference in New Issue
Block a user