mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-12 13:24:25 +00:00
Fix phpunit pipeline
This commit is contained in:
parent
d04f9ae9ff
commit
ac3ac432e1
@ -80,14 +80,15 @@ class LoadPeople extends AbstractFixture implements ContainerAwareInterface, Ord
|
|||||||
*/
|
*/
|
||||||
protected array $cacheUsers = [];
|
protected array $cacheUsers = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var array|Gender[]
|
||||||
|
*/
|
||||||
protected array $cacheGenders = [];
|
protected array $cacheGenders = [];
|
||||||
|
|
||||||
protected Generator $faker;
|
protected Generator $faker;
|
||||||
|
|
||||||
protected NativeLoader $loader;
|
protected NativeLoader $loader;
|
||||||
|
|
||||||
// private array $genders = [GenderEnum::MALE, GenderEnum::FEMALE, GenderEnum::NEUTRAL];
|
|
||||||
|
|
||||||
private array $peoples = [
|
private array $peoples = [
|
||||||
[
|
[
|
||||||
'lastName' => 'Depardieu',
|
'lastName' => 'Depardieu',
|
||||||
@ -124,7 +125,7 @@ class LoadPeople extends AbstractFixture implements ContainerAwareInterface, Ord
|
|||||||
'maritalStatus' => 'ms_divorce',
|
'maritalStatus' => 'ms_divorce',
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
// to have a person with same birthdate of Gérard Depardieu
|
// to have a person with same birthdate as Gérard Depardieu
|
||||||
'lastName' => 'Van Snick',
|
'lastName' => 'Van Snick',
|
||||||
'firstName' => 'Bart',
|
'firstName' => 'Bart',
|
||||||
'birthdate' => '1948-12-27',
|
'birthdate' => '1948-12-27',
|
||||||
@ -281,7 +282,7 @@ class LoadPeople extends AbstractFixture implements ContainerAwareInterface, Ord
|
|||||||
public function getRandomGender(int $nullPercentage = 50): ?Gender
|
public function getRandomGender(int $nullPercentage = 50): ?Gender
|
||||||
{
|
{
|
||||||
if (0 === \count($this->cacheGenders)) {
|
if (0 === \count($this->cacheGenders)) {
|
||||||
$this->cacheGenders = $this->genderRepository->findAll();
|
$this->cacheGenders = $this->genderRepository->findByActiveOrdered();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (\random_int(0, 100) > $nullPercentage) {
|
if (\random_int(0, 100) > $nullPercentage) {
|
||||||
|
@ -11,6 +11,9 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Tests\Controller\AccompanyingCoursWorkApiController;
|
namespace Tests\Controller\AccompanyingCoursWorkApiController;
|
||||||
|
|
||||||
|
use Chill\MainBundle\Entity\Gender;
|
||||||
|
use Chill\MainBundle\Entity\GenderEnum;
|
||||||
|
use Chill\MainBundle\Entity\GenderIconEnum;
|
||||||
use Chill\MainBundle\Repository\UserRepositoryInterface;
|
use Chill\MainBundle\Repository\UserRepositoryInterface;
|
||||||
use Chill\MainBundle\Test\PrepareClientTrait;
|
use Chill\MainBundle\Test\PrepareClientTrait;
|
||||||
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||||
@ -129,8 +132,15 @@ class ConflictTest extends WebTestCase
|
|||||||
|
|
||||||
$period = new AccompanyingPeriod();
|
$period = new AccompanyingPeriod();
|
||||||
$em->persist($period);
|
$em->persist($period);
|
||||||
|
|
||||||
|
$gender = new Gender();
|
||||||
|
$gender->setGenderTranslation(GenderEnum::MALE);
|
||||||
|
$gender->setLabel(["fr" => "homme"]);
|
||||||
|
$gender->setIcon(GenderIconEnum::MALE);
|
||||||
|
$em->persist($gender);
|
||||||
|
|
||||||
$period->addPerson(($p = new Person())->setFirstName('test')->setLastName('test')
|
$period->addPerson(($p = new Person())->setFirstName('test')->setLastName('test')
|
||||||
->setBirthdate(new \DateTime('1980-01-01'))->setGender(Person::BOTH_GENDER));
|
->setBirthdate(new \DateTime('1980-01-01'))->setGender($gender));
|
||||||
$em->persist($p);
|
$em->persist($p);
|
||||||
$issue = (new SocialIssue())->setTitle(['fr' => 'test']);
|
$issue = (new SocialIssue())->setTitle(['fr' => 'test']);
|
||||||
$em->persist($issue);
|
$em->persist($issue);
|
||||||
|
@ -14,6 +14,9 @@ namespace Chill\PersonBundle\Tests\Controller;
|
|||||||
use Chill\MainBundle\Entity\Address;
|
use Chill\MainBundle\Entity\Address;
|
||||||
use Chill\MainBundle\Entity\AddressReference;
|
use Chill\MainBundle\Entity\AddressReference;
|
||||||
use Chill\MainBundle\Entity\Center;
|
use Chill\MainBundle\Entity\Center;
|
||||||
|
use Chill\MainBundle\Entity\Gender;
|
||||||
|
use Chill\MainBundle\Entity\GenderEnum;
|
||||||
|
use Chill\MainBundle\Entity\GenderIconEnum;
|
||||||
use Chill\MainBundle\Entity\User;
|
use Chill\MainBundle\Entity\User;
|
||||||
use Chill\MainBundle\Test\PrepareClientTrait;
|
use Chill\MainBundle\Test\PrepareClientTrait;
|
||||||
use Chill\PersonBundle\Entity\Household\Household;
|
use Chill\PersonBundle\Entity\Household\Household;
|
||||||
@ -51,9 +54,15 @@ final class HouseholdApiControllerTest extends WebTestCase
|
|||||||
->setMaxResults(1)
|
->setMaxResults(1)
|
||||||
->getQuery()->getSingleResult();
|
->getQuery()->getSingleResult();
|
||||||
|
|
||||||
|
$gender = new Gender();
|
||||||
|
$gender->setGenderTranslation(GenderEnum::MALE);
|
||||||
|
$gender->setLabel(["fr" => "homme"]);
|
||||||
|
$gender->setIcon(GenderIconEnum::MALE);
|
||||||
|
$em->persist($gender);
|
||||||
|
|
||||||
$p = new Person();
|
$p = new Person();
|
||||||
$p->setFirstname('test')->setLastName('test lastname')
|
$p->setFirstname('test')->setLastName('test lastname')
|
||||||
->setGender(Person::BOTH_GENDER)
|
->setGender($gender)
|
||||||
->setCenter($centerA);
|
->setCenter($centerA);
|
||||||
$em->persist($p);
|
$em->persist($p);
|
||||||
$h = new Household();
|
$h = new Household();
|
||||||
|
@ -12,6 +12,9 @@ declare(strict_types=1);
|
|||||||
namespace Chill\PersonBundle\Tests\Controller;
|
namespace Chill\PersonBundle\Tests\Controller;
|
||||||
|
|
||||||
use Chill\MainBundle\Entity\Center;
|
use Chill\MainBundle\Entity\Center;
|
||||||
|
use Chill\MainBundle\Entity\Gender;
|
||||||
|
use Chill\MainBundle\Entity\GenderEnum;
|
||||||
|
use Chill\MainBundle\Entity\GenderIconEnum;
|
||||||
use Chill\MainBundle\Repository\CenterRepositoryInterface;
|
use Chill\MainBundle\Repository\CenterRepositoryInterface;
|
||||||
use Chill\MainBundle\Test\PrepareClientTrait;
|
use Chill\MainBundle\Test\PrepareClientTrait;
|
||||||
use Chill\PersonBundle\Entity\Person;
|
use Chill\PersonBundle\Entity\Person;
|
||||||
@ -160,12 +163,18 @@ final class PersonControllerUpdateTest extends WebTestCase
|
|||||||
$em = self::getContainer()->get(EntityManagerInterface::class);
|
$em = self::getContainer()->get(EntityManagerInterface::class);
|
||||||
$center = $centerRepository->findOneBy(['name' => 'Center A']);
|
$center = $centerRepository->findOneBy(['name' => 'Center A']);
|
||||||
|
|
||||||
|
$gender = new Gender();
|
||||||
|
$gender->setGenderTranslation(GenderEnum::MALE);
|
||||||
|
$gender->setLabel(["fr" => "homme"]);
|
||||||
|
$gender->setIcon(GenderIconEnum::MALE);
|
||||||
|
$em->persist($gender);
|
||||||
|
|
||||||
$person = new Person();
|
$person = new Person();
|
||||||
$person
|
$person
|
||||||
->setFirstName('Foo')
|
->setFirstName('Foo')
|
||||||
->setLastName('Bar')
|
->setLastName('Bar')
|
||||||
->setBirthdate(new \DateTime('2017-09-30'))
|
->setBirthdate(new \DateTime('2017-09-30'))
|
||||||
->setGender(Person::MALE_GENDER)
|
->setGender($gender)
|
||||||
->setCenter($center);
|
->setCenter($center);
|
||||||
|
|
||||||
$em->persist($person);
|
$em->persist($person);
|
||||||
|
@ -11,6 +11,9 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Chill\PersonBundle\Tests\Controller;
|
namespace Chill\PersonBundle\Tests\Controller;
|
||||||
|
|
||||||
|
use Chill\MainBundle\Entity\Gender;
|
||||||
|
use Chill\MainBundle\Entity\GenderEnum;
|
||||||
|
use Chill\MainBundle\Entity\GenderIconEnum;
|
||||||
use Chill\MainBundle\Repository\CenterRepositoryInterface;
|
use Chill\MainBundle\Repository\CenterRepositoryInterface;
|
||||||
use Chill\MainBundle\Test\PrepareClientTrait;
|
use Chill\MainBundle\Test\PrepareClientTrait;
|
||||||
use Chill\PersonBundle\Entity\Person;
|
use Chill\PersonBundle\Entity\Person;
|
||||||
@ -99,12 +102,18 @@ final class PersonControllerViewTest extends WebTestCase
|
|||||||
$em = self::getContainer()->get(EntityManagerInterface::class);
|
$em = self::getContainer()->get(EntityManagerInterface::class);
|
||||||
$center = $centerRepository->findOneBy(['name' => 'Center A']);
|
$center = $centerRepository->findOneBy(['name' => 'Center A']);
|
||||||
|
|
||||||
|
$gender = new Gender();
|
||||||
|
$gender->setGenderTranslation(GenderEnum::MALE);
|
||||||
|
$gender->setLabel(["fr" => "homme"]);
|
||||||
|
$gender->setIcon(GenderIconEnum::MALE);
|
||||||
|
$em->persist($gender);
|
||||||
|
|
||||||
$person = new Person();
|
$person = new Person();
|
||||||
$person
|
$person
|
||||||
->setFirstName('Foo')
|
->setFirstName('Foo')
|
||||||
->setLastName('Bar')
|
->setLastName('Bar')
|
||||||
->setBirthdate(new \DateTime('2017-09-30'))
|
->setBirthdate(new \DateTime('2017-09-30'))
|
||||||
->setGender(Person::MALE_GENDER)
|
->setGender($gender)
|
||||||
->setCenter($center);
|
->setCenter($center);
|
||||||
|
|
||||||
$em->persist($person);
|
$em->persist($person);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user