From ded1cf5b027cc2c176ef99b10f192509952326cb Mon Sep 17 00:00:00 2001 From: cmorenov1402 Date: Tue, 1 Apr 2025 11:09:26 +0200 Subject: [PATCH] Remove entity manager from tests --- tests/Entity/ProjectApi/BaseTest.php | 6 ------ tests/Entity/ProjectApi/GetAllTest.php | 7 ------- 2 files changed, 13 deletions(-) diff --git a/tests/Entity/ProjectApi/BaseTest.php b/tests/Entity/ProjectApi/BaseTest.php index 3d56cda..7b73068 100644 --- a/tests/Entity/ProjectApi/BaseTest.php +++ b/tests/Entity/ProjectApi/BaseTest.php @@ -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 diff --git a/tests/Entity/ProjectApi/GetAllTest.php b/tests/Entity/ProjectApi/GetAllTest.php index 913ac3a..d0b9331 100644 --- a/tests/Entity/ProjectApi/GetAllTest.php +++ b/tests/Entity/ProjectApi/GetAllTest.php @@ -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()