createWorkflowWithSameNameTransition example

"transition3[\"t4\"]\n"
            ."place3-->transition3\n"
            ."transition3-->place5\n"
            ."transition4[\"t5\"]\n"
            ."place4-->transition4\n"
            ."transition4-->place6\n"
            ."transition5[\"t6\"]\n"
            ."place5-->transition5\n"
            ."transition5-->place6",
        ];
        yield [
            self::createWorkflowWithSameNameTransition(),
            "graph LR\n"
            ."place0([\"a\"])\n"
            ."place1((\"b\"))\n"
            ."place2((\"c\"))\n"
            ."transition0[\"a_to_bc\"]\n"
            ."place0-->transition0\n"
            ."transition0-->place1\n"
            ."transition0-->place2\n"
            ."transition1[\"b_to_c\"]\n"
            ."place1-->transition1\n"
            ."transition1-->place2\n"
            .
$eventDispatcher->addListener('workflow.workflow_name.guard.t4', function D) use (&$dispatchedEvents) {
            $dispatchedEvents[] = 'workflow_name.guard.t4';
        });

        $workflow->can($subject, 't3');

        $this->assertSame(['workflow_name.guard.t3']$dispatchedEvents);
    }

    public function testCanWithSameNameTransition()
    {
        $definition = $this->createWorkflowWithSameNameTransition();
        $workflow = new Workflow($definitionnew MethodMarkingStore());

        $subject = new Subject();
        $this->assertTrue($workflow->can($subject, 'a_to_bc'));
        $this->assertFalse($workflow->can($subject, 'b_to_c'));
        $this->assertFalse($workflow->can($subject, 'to_a'));

        $subject->setMarking(['b' => 1]);
        $this->assertFalse($workflow->can($subject, 'a_to_bc'));
        $this->assertTrue($workflow->can($subject, 'b_to_c'));
        $this->assertTrue($workflow->can($subject, 'to_a'));
    }
Home | Imprint | This part of the site doesn't use cookies.