Compare commits

...

6 Commits

4 changed files with 14 additions and 6 deletions

View File

@@ -94,7 +94,8 @@ unit_tests:
- php -d memory_limit=2G tests/app/bin/console cache:clear --env=dev - php -d memory_limit=2G tests/app/bin/console cache:clear --env=dev
- php -d memory_limit=3G tests/app/bin/console doctrine:fixtures:load -n - php -d memory_limit=3G tests/app/bin/console doctrine:fixtures:load -n
- php -d memory_limit=2G tests/app/bin/console cache:clear --env=test - php -d memory_limit=2G tests/app/bin/console cache:clear --env=test
- php -d memory_limit=4G bin/phpunit --colors=never - php -d memory_limit=2G tests/app/bin/console doctrine:query:dql "SELECT c.name FROM Chill\\MainBundle\\Entity\\Center c"
- php -d memory_limit=4G bin/phpunit --colors=never --testdox
artifacts: artifacts:
expire_in: 30 min expire_in: 30 min
paths: paths:

View File

@@ -14,7 +14,7 @@
{% if is_granted('CHILL_PERSON_ACCOMPANYING_PERIOD_UPDATE', period) %} {% if is_granted('CHILL_PERSON_ACCOMPANYING_PERIOD_UPDATE', period) %}
<div class="item-col item-meta"> <div class="item-col item-meta">
{% set job_id = null %} {% set job_id = null %}
{% if period.job is defined %} {% if period.job is not null %}
{% set job_id = period.job.id %} {% set job_id = period.job.id %}
{% endif %} {% endif %}
<span <span

View File

@@ -13,6 +13,7 @@ namespace Chill\PersonBundle\Tests\Controller;
use Chill\MainBundle\Test\PrepareClientTrait; use Chill\MainBundle\Test\PrepareClientTrait;
use DateTime; use DateTime;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Bundle\FrameworkBundle\KernelBrowser; use Symfony\Bundle\FrameworkBundle\KernelBrowser;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
use Symfony\Component\DomCrawler\Form; use Symfony\Component\DomCrawler\Form;
@@ -48,21 +49,21 @@ final class PersonControllerCreateTest extends WebTestCase
public static function tearDownAfterClass(): void public static function tearDownAfterClass(): void
{ {
self::bootKernel(); self::bootKernel();
$em = self::$kernel->getContainer()->get('doctrine.orm.entity_manager'); $em = self::$kernel->getContainer()->get(EntityManagerInterface::class);
//remove two people created during test //remove two people created during test
$jesus = $em->getRepository(\Chill\PersonBundle\Entity\Person::class) $jesus = $em->getRepository(\Chill\PersonBundle\Entity\Person::class)
->findOneBy(['firstName' => 'God']); ->findOneBy(['firstName' => 'God']);
if (null !== $jesus) { if (null !== $jesus) {
$em->remove($jesus); //$em->remove($jesus);
} }
$jesus2 = $em->getRepository(\Chill\PersonBundle\Entity\Person::class) $jesus2 = $em->getRepository(\Chill\PersonBundle\Entity\Person::class)
->findOneBy(['firstName' => 'roger']); ->findOneBy(['firstName' => 'roger']);
if (null !== $jesus2) { if (null !== $jesus2) {
$em->remove($jesus2); //$em->remove($jesus2);
} }
$em->flush(); $em->flush();
} }

View File

@@ -12,6 +12,7 @@ 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\Repository\CenterRepository;
use Chill\MainBundle\Test\PrepareClientTrait; use Chill\MainBundle\Test\PrepareClientTrait;
use Chill\PersonBundle\Entity\Person; use Chill\PersonBundle\Entity\Person;
use Closure; use Closure;
@@ -60,9 +61,14 @@ final class PersonControllerUpdateTest extends WebTestCase
$this->em = self::$container $this->em = self::$container
->get(EntityManagerInterface::class); ->get(EntityManagerInterface::class);
$center = $this->em->getRepository(Center::class) $center = self::$container->get(CenterRepository::class)
->findOneBy(['name' => 'Center A']); ->findOneBy(['name' => 'Center A']);
var_dump(array_map(
function (Center $c) { return $c->getName(); },
self::$container->get(CenterRepository::class)->findAll()
));
$this->person = (new Person()) $this->person = (new Person())
->setLastName('My Beloved') ->setLastName('My Beloved')
->setFirstName('Jesus') ->setFirstName('Jesus')