Skip to content
This repository was archived by the owner on Apr 3, 2023. It is now read-only.

Commit 78dd7ab

Browse files
author
Teddy Roncin
committed
♻️ (tests) 'test' user now saved + directory renamed
Class EtuUTTApiTestCase now saves the 'test' user, created in the setUp method. Directory tests/users was renamed to tests/Users, to be more coherent with conventions used in the project
1 parent 1c8bae3 commit 78dd7ab

File tree

2 files changed

+8
-16
lines changed

2 files changed

+8
-16
lines changed

tests/EtuUTTApiTestCase.php

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,36 +3,28 @@
33
namespace App\Tests;
44

55
use ApiPlatform\Core\Bridge\Symfony\Bundle\Test\ApiTestCase;
6-
use App\DataFixtures\UserSeeder;
76
use App\Entity\User;
8-
use App\Entity\UserBan;
9-
use App\Entity\UserBDEContribution;
10-
use App\Entity\UserEtuUTTTeam;
11-
use App\Entity\UserMailsPhones;
12-
use App\Util\Slug;
13-
use App\Util\Text;
14-
use DateTime;
157
use Doctrine\Bundle\FixturesBundle\Fixture;
168
use Doctrine\Common\DataFixtures\Loader;
179
use Doctrine\Common\DataFixtures\Purger\ORMPurger;
1810
use Doctrine\ORM\EntityManager;
19-
use Faker\Factory;
2011

2112
abstract class EtuUTTApiTestCase extends ApiTestCase
2213
{
2314

2415
protected EntityManager $em;
16+
protected User $user;
2517

2618
protected function setUp(): void
2719
{
2820
$this->em = $this->getContainer()->get('doctrine')->getManager();
2921
(new ORMPurger($this->em))->purge();
30-
$user = new User();
31-
$user->setFirstName('test');
32-
$user->setLastName('test');
33-
$user->setLogin('test');
34-
$user->addRole('ROLE_ADMIN');
35-
$this->em->persist($user);
22+
$this->user = new User();
23+
$this->user->setFirstName('test');
24+
$this->user->setLastName('test');
25+
$this->user->setLogin('test');
26+
$this->user->addRole('ROLE_ADMIN');
27+
$this->em->persist($this->user);
3628
$this->em->flush();
3729
}
3830

tests/users/GetUsers.php renamed to tests/Users/GetUsers.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace App\Tests\users;
3+
namespace App\Tests\Users;
44

55
use App\DataFixtures\UserSeeder;
66
use App\Entity\User;

0 commit comments

Comments
 (0)