From b97eabf0d28e48f61bac510783fa238caef7fbf6 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Thu, 29 Aug 2024 16:51:25 +0200 Subject: [PATCH] Get workflowComponent directly from registry --- .../Workflow/CancelStaleWorkflowHandlerTest.php | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/src/Bundle/ChillMainBundle/Tests/Services/Workflow/CancelStaleWorkflowHandlerTest.php b/src/Bundle/ChillMainBundle/Tests/Services/Workflow/CancelStaleWorkflowHandlerTest.php index 23c99d16a..2c3016f82 100644 --- a/src/Bundle/ChillMainBundle/Tests/Services/Workflow/CancelStaleWorkflowHandlerTest.php +++ b/src/Bundle/ChillMainBundle/Tests/Services/Workflow/CancelStaleWorkflowHandlerTest.php @@ -26,7 +26,6 @@ class CancelStaleWorkflowHandlerTest extends KernelTestCase private LoggerInterface $logger; private EntityWorkflowRepository $workflowRepository; private ClockInterface $clock; - private string $workflowName; protected function setUp(): void { @@ -39,13 +38,6 @@ class CancelStaleWorkflowHandlerTest extends KernelTestCase $this->logger = self::getContainer()->get(LoggerInterface::class); $this->clock = self::getContainer()->get(ClockInterface::class); $this->workflowRepository = $this->createMock(EntityWorkflowRepository::class); - - // Retrieve the workflow configuration dynamically - $configPath = self::$kernel->getProjectDir() . '/config/packages/workflow.yaml'; // Adjust the path if needed - $config = Yaml::parseFile($configPath); - - // Extract the workflow name from the configuration - $this->workflowName = array_key_first($config['framework']['workflows']); } public function testWorkflowWithOneStepOlderThan90DaysIsDeleted(): void @@ -82,7 +74,7 @@ class CancelStaleWorkflowHandlerTest extends KernelTestCase $this->em->flush(); /** @var WorkflowInterface $workflowComponent */ - $workflowComponent = $this->registry->get($workflow, $this->workflowName); + $workflowComponent = $this->registry->get($workflowComponent); $transitions = $workflowComponent->getEnabledTransitions($workflow); $metadataStore = $workflowComponent->getMetadataStore();