test still failing with error saying column phonenumber of relation users does not exist

This commit is contained in:
Julie Lenaerts 2024-02-12 18:56:05 +01:00
parent 9b8e143855
commit 0b739fda34

View File

@ -16,6 +16,9 @@ use Chill\MainBundle\Entity\User;
use Chill\MainBundle\Entity\UserJob;
use Chill\MainBundle\Templating\Entity\UserRender;
use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
use Doctrine\ORM\EntityManagerInterface;
use JetBrains\PhpStorm\NoReturn;
use libphonenumber\PhoneNumberUtil;
use Prophecy\PhpUnit\ProphecyTrait;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
use Symfony\Component\Clock\MockClock;
@ -36,8 +39,11 @@ class UserRenderTest extends WebTestCase
self::bootKernel();
}
public function testRenderUserWithJobAndScopeAtCertainDate(): void
#[NoReturn] public function testRenderUserWithJobAndScopeAtCertainDate(): void
{
self::bootKernel();
$em = self::$container->get(EntityManagerInterface::class);
assert($em instanceof EntityManagerInterface);
// Create a user with a certain user job
$user = new User();
@ -47,6 +53,8 @@ class UserRenderTest extends WebTestCase
$userJobA->setLabel(['fr' => 'assistant social']);
$scopeA->setName(['fr' => 'service A']);
$user->setLabel('BOB ISLA');
// $user->setPhonenumber(PhoneNumberUtil::getInstance()->parse('+32475928635'));
$userJobB = new UserJob();
$scopeB = new Scope();
@ -82,6 +90,14 @@ class UserRenderTest extends WebTestCase
$user->getUserJobHistories()->add($userJobHistoryB);
$user->getUserScopeHistories()->add($userScopeHistoryB);
$em->persist($user);
$em->persist($userJobA);
$em->persist($userJobB);
$em->persist($scopeA);
$em->persist($scopeB);
$em->flush();
// Create renderer
$translatableStringHelperMock = $this->getMockBuilder(TranslatableStringHelperInterface::class)
->getMock();
@ -96,6 +112,8 @@ class UserRenderTest extends WebTestCase
$options['at_date'] = new \DateTime('2023-11-25 12:00:00');
$optionsTwo['at_date'] = new \DateTime('2024-01-30 12:00:00');
// dd($user);
// Check that the user render for the first activity corresponds with the first user job
$expectedStringA = 'BOB ISLA (assistant social) (service A)';
$this->assertEquals($expectedStringA, $renderer->renderString($user, $options));