Get workflowComponent directly from registry

This commit is contained in:
2024-08-29 16:51:25 +02:00
committed by Julien Fastré
parent 2e69d2df90
commit b97eabf0d2

View File

@@ -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();