mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-28 21:16:13 +00:00
Get workflowComponent directly from registry
This commit is contained in:
parent
2e69d2df90
commit
b97eabf0d2
@ -26,7 +26,6 @@ class CancelStaleWorkflowHandlerTest extends KernelTestCase
|
|||||||
private LoggerInterface $logger;
|
private LoggerInterface $logger;
|
||||||
private EntityWorkflowRepository $workflowRepository;
|
private EntityWorkflowRepository $workflowRepository;
|
||||||
private ClockInterface $clock;
|
private ClockInterface $clock;
|
||||||
private string $workflowName;
|
|
||||||
|
|
||||||
protected function setUp(): void
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
@ -39,13 +38,6 @@ class CancelStaleWorkflowHandlerTest extends KernelTestCase
|
|||||||
$this->logger = self::getContainer()->get(LoggerInterface::class);
|
$this->logger = self::getContainer()->get(LoggerInterface::class);
|
||||||
$this->clock = self::getContainer()->get(ClockInterface::class);
|
$this->clock = self::getContainer()->get(ClockInterface::class);
|
||||||
$this->workflowRepository = $this->createMock(EntityWorkflowRepository::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
|
public function testWorkflowWithOneStepOlderThan90DaysIsDeleted(): void
|
||||||
@ -82,7 +74,7 @@ class CancelStaleWorkflowHandlerTest extends KernelTestCase
|
|||||||
$this->em->flush();
|
$this->em->flush();
|
||||||
|
|
||||||
/** @var WorkflowInterface $workflowComponent */
|
/** @var WorkflowInterface $workflowComponent */
|
||||||
$workflowComponent = $this->registry->get($workflow, $this->workflowName);
|
$workflowComponent = $this->registry->get($workflowComponent);
|
||||||
|
|
||||||
$transitions = $workflowComponent->getEnabledTransitions($workflow);
|
$transitions = $workflowComponent->getEnabledTransitions($workflow);
|
||||||
$metadataStore = $workflowComponent->getMetadataStore();
|
$metadataStore = $workflowComponent->getMetadataStore();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user