Open
Description
Symfony version(s) affected
7.2
Description
With a workflow that has simultaneous states that merge into a single state, the floowing transition produces an unexpected state.
graph LR;
A-->|t1|B;
A-->|t1|C;
B-->|t2|D;
C-->|t3|D;
D-->|t4|E;
When t4 is applied, the subject has D and E in marking store.
How to reproduce
Using the same subject class as the workflow tests
<?php
declare(strict_types=1);
namespace App\Tests;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Workflow\Definition;
use Symfony\Component\Workflow\MarkingStore\MethodMarkingStore;
use Symfony\Component\Workflow\Transition;
use Symfony\Component\Workflow\Workflow;
class MarkingTest extends TestCase
{
public function testUnmarkWithComplexWorkflow(): void
{
$definition = $this->createComplexWorkflowDefinition();
$subject = new Subject();
$subject->setMarking(['a' => 1]);
$workflow = new Workflow($definition, new MethodMarkingStore());
$workflow->apply($subject, 't1');
$workflow->apply($subject, 't2');
$workflow->apply($subject, 't3');
$workflow->apply($subject, 't4');
$marking = $workflow->getMarking($subject);
$this->assertTrue($marking->has('e'));
$this->assertFalse($marking->has('d'));
}
private function createComplexWorkflowDefinition(): Definition
{
$places = range('a', 'e');
$transitions = [];
$transitions[] = new Transition('t1', 'a', ['b', 'c']);
$transitions[] = new Transition('t2', 'b', 'd');
$transitions[] = new Transition('t3', 'c', 'd');
$transitions[] = new Transition('t4', 'd', 'e');
return new Definition($places, $transitions);
}
}
Possible Solution
No response
Additional Context
No response