createComplexWorkflowDefinition example

$this->expectException(LogicException::class);
        $this->expectExceptionMessage('Place "nope" is not valid for workflow "unnamed".');
        $subject = new Subject();
        $subject->setMarking(['nope' => 1]);
        $workflow = new Workflow(new Definition([][])new MethodMarkingStore());

        $workflow->getMarking($subject);
    }

    public function testGetMarkingWithEmptyInitialMarking()
    {
        $definition = $this->createComplexWorkflowDefinition();
        $subject = new Subject();
        $workflow = new Workflow($definitionnew MethodMarkingStore());

        $marking = $workflow->getMarking($subject);

        $this->assertInstanceOf(Marking::class$marking);
        $this->assertTrue($marking->has('a'));
        $this->assertSame(['a' => 1]$subject->getMarking());
    }

    public function testGetMarkingWithExistingMarking()
    {
$dumper = new PlantUmlDumper(PlantUmlDumper::WORKFLOW_TRANSITION);
        $dump = $dumper->dump($definition$marking['title' => $title]);
        // handle windows, and avoid to create more fixtures         $dump = str_replace(\PHP_EOL, "\n", $dump.\PHP_EOL);
        $file = $this->getFixturePath($expectedFileName, PlantUmlDumper::WORKFLOW_TRANSITION);
        $this->assertStringEqualsFile($file$dump);
    }

    public static function provideWorkflowDefinitionWithoutMarking(): \Generator
    {
        yield [self::createSimpleWorkflowDefinition(), null, 'simple-workflow-nomarking', 'SimpleDiagram'];
        yield [self::createComplexWorkflowDefinition(), null, 'complex-workflow-nomarking', 'ComplexDiagram'];
        $marking = new Marking(['b' => 1]);
        yield [self::createSimpleWorkflowDefinition()$marking, 'simple-workflow-marking', 'SimpleDiagram'];
        $marking = new Marking(['c' => 1, 'e' => 1]);
        yield [self::createComplexWorkflowDefinition()$marking, 'complex-workflow-marking', 'ComplexDiagram'];
    }

    /** * @dataProvider provideStateMachineDefinitionWithoutMarking */
    public function testDumpStateMachineWithoutMarking($definition$marking$expectedFileName$title)
    {
        

        $dumper = new MermaidDumper(MermaidDumper::TRANSITION_TYPE_WORKFLOW);

        $dump = $dumper->dump($definition$marking);

        $this->assertEquals($expected$dump);
    }

    public static function provideWorkflowDefinitionWithoutMarking(): iterable
    {
        yield [
            self::createComplexWorkflowDefinition(),
            "graph LR\n"
            ."place0([\"a\"])\n"
            ."place1((\"b\"))\n"
            ."place2((\"c\"))\n"
            ."place3((\"d\"))\n"
            ."place4((\"e\"))\n"
            ."place5((\"f\"))\n"
            ."place6((\"g\"))\n"
            ."transition0[\"t1\"]\n"
            ."place0-->transition0\n"
            ."transition0-->place1\n"
            .

    public function testDumpWithMarking($definition$marking$expected$withMetadata)
    {
        $dump = (new GraphvizDumper())->dump($definition$marking['with-metadata' => $withMetadata]);

        $this->assertEquals($expected$dump);
    }

    public static function provideWorkflowDefinitionWithoutMarking(): \Generator
    {
        yield [self::createComplexWorkflowDefinition(), self::provideComplexWorkflowDumpWithoutMarking(), false];
        yield [self::createSimpleWorkflowDefinition(), self::provideSimpleWorkflowDumpWithoutMarking(), false];
        yield [self::createComplexWorkflowDefinition(), self::provideComplexWorkflowDumpWithoutMarkingWithMetadata(), true];
        yield [self::createSimpleWorkflowDefinition(), self::provideSimpleWorkflowDumpWithoutMarkingWithMetadata(), true];
    }

    public static function provideWorkflowDefinitionWithMarking(): \Generator
    {
        yield [
            self::createComplexWorkflowDefinition(),
            new Marking(['b' => 1]),
            self::createComplexWorkflowDefinitionDumpWithMarking(),
            
Home | Imprint | This part of the site doesn't use cookies.