diff --git a/src/Bundle/ChillMainBundle/Tests/Templating/Entity/UserRenderTest.php b/src/Bundle/ChillMainBundle/Tests/Templating/Entity/UserRenderTest.php new file mode 100644 index 000000000..fe0ad7e04 --- /dev/null +++ b/src/Bundle/ChillMainBundle/Tests/Templating/Entity/UserRenderTest.php @@ -0,0 +1,65 @@ +setLabel(['fr' => 'assistant social']); + $scope->setName(['fr' => 'service A']); + $user->setLabel('BOB ISLA'); + $user->setUserJob($userJob); + $user->setMainScope($scope); + + // Change the user job + $userJobTwo = new UserJob(); + $userJobTwo->setLabel(['fr' => 'directrice']); + /* this automatically creates a UserJobHistory. How to set the date manually though? **/ + + // Change the scope + $scopeTwo = new Scope(); + $scopeTwo->setName(['fr' => 'service B']); + /* this automatically creates a UserScopeHistory. How to set the date manually though? **/ + + + // Create renderer + $translatableStringHelper = $this->createMock(TranslatableStringHelperInterface::class); + $engine = $this->createMock(Environment::class); + $translator = $this->createMock(TranslatorInterface::class); + $renderer = new UserRender($translatableStringHelper, $engine, $translator); + + + $options['at_date'] = new \DateTime('2023-11-30 12:00:00'); + $optionsTwo['at_date'] = new \DateTime('2024-01-30 12:00:00'); + + // 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)); + + // Check that the user render for the second activity corresponds with the second user job + $expectedStringB = 'BOB ISLA (directrice) (service B)'; + $this->assertEquals($expectedStringB, $renderer->renderString($user, $optionsTwo)); + + + } + +}