diff --git a/src/Bundle/ChillMainBundle/Resources/views/Workflow/workflow_notification_on_transition_completed_content_to_user_group.fr.txt.twig b/src/Bundle/ChillMainBundle/Resources/views/Workflow/workflow_notification_on_transition_completed_content_to_user_group.fr.txt.twig index 6920bc008..b97fbf359 100644 --- a/src/Bundle/ChillMainBundle/Resources/views/Workflow/workflow_notification_on_transition_completed_content_to_user_group.fr.txt.twig +++ b/src/Bundle/ChillMainBundle/Resources/views/Workflow/workflow_notification_on_transition_completed_content_to_user_group.fr.txt.twig @@ -4,6 +4,6 @@ Un suivi "{{ workflow.text }}" a atteint une nouvelle étape: {{ place.text }} Vous pouvez visualiser le workflow sur cette page: -{{ absolute_url(path('chill_main_workflow_grant_access_by_key', {'id': entity_workflow.id, '_locale': 'fr', 'accessKey': entity_workflow.currentStep.accessKey})) }} +{{ absolute_url(path('chill_main_workflow_grant_access_by_key', {'id': entity_workflow.currentStep.id, '_locale': 'fr', 'accessKey': entity_workflow.currentStep.accessKey})) }} Cordialement, diff --git a/src/Bundle/ChillMainBundle/Tests/Workflow/EventSubscriber/NotificationToUserGroupsOnTransitionTest.php b/src/Bundle/ChillMainBundle/Tests/Workflow/EventSubscriber/NotificationToUserGroupsOnTransitionTest.php index 8c5bce7a6..329294ecc 100644 --- a/src/Bundle/ChillMainBundle/Tests/Workflow/EventSubscriber/NotificationToUserGroupsOnTransitionTest.php +++ b/src/Bundle/ChillMainBundle/Tests/Workflow/EventSubscriber/NotificationToUserGroupsOnTransitionTest.php @@ -18,6 +18,7 @@ use Chill\MainBundle\Workflow\EntityWorkflowMarkingStore; use Chill\MainBundle\Workflow\EventSubscriber\NotificationToUserGroupsOnTransition; use Chill\MainBundle\Workflow\Helper\MetadataExtractor; use Chill\MainBundle\Workflow\WorkflowTransitionContextDTO; +use Doctrine\ORM\EntityManagerInterface; use Prophecy\Argument; use Prophecy\PhpUnit\ProphecyTrait; use Symfony\Bridge\Twig\Mime\TemplatedEmail; @@ -45,12 +46,14 @@ class NotificationToUserGroupsOnTransitionTest extends KernelTestCase use ProphecyTrait; private Environment $twig; private BodyRendererInterface $bodyRenderer; + private EntityManagerInterface $em; protected function setUp(): void { self::bootKernel(); $this->twig = self::getContainer()->get('twig'); $this->bodyRenderer = self::getContainer()->get(BodyRendererInterface::class); + $this->em = self::getContainer()->get('doctrine.orm.entity_manager'); } public function testOnCompletedSendNotificationToUserGroupWithEmailAddress(): void @@ -66,7 +69,11 @@ class NotificationToUserGroupsOnTransitionTest extends KernelTestCase $ug->setEmail('test@email.com')->setLabel(['fr' => 'test group']); $mailer = $this->prophesize(MailerInterface::class); - $sendMethod = $mailer->send(Argument::that(function (RawMessage $message): bool { + $sendMethod = $mailer->send(Argument::that(function (RawMessage $message) use ($entityWorkflow): bool { + // we need to set an id to the current step of the entity workflow + $this->em->persist($entityWorkflow); + $this->em->persist($entityWorkflow->getCurrentStep()); + if (!$message instanceof TemplatedEmail) { return false; } @@ -111,7 +118,7 @@ class NotificationToUserGroupsOnTransitionTest extends KernelTestCase $workflow->apply($entityWorkflow, 'to_one', ['context' => $dto, 'transition' => 'to_one', 'transitionAt' => new \DateTimeImmutable(), 'byUser' => new User()]); } - public function buildRegistryWithEventSubscriber(MailerInterface $mailer, MetadataExtractor $metadataExtractor): Registry + private function buildRegistryWithEventSubscriber(MailerInterface $mailer, MetadataExtractor $metadataExtractor): Registry { $builder = new DefinitionBuilder(); $builder