MermaidDumper example



    public function collect(Request $request, Response $response, \Throwable $exception = null): void
    {
    }

    public function lateCollect(): void
    {
        foreach ($this->workflows as $workflow) {
            // We always use a workflow type because we want to mermaid to             // create a node for transitions             $dumper = new MermaidDumper(MermaidDumper::TRANSITION_TYPE_WORKFLOW);
            $this->data['workflows'][$workflow->getName()] = [
                'dump' => $dumper->dump($workflow->getDefinition()),
            ];
        }
    }

    public function getName(): string
    {
        return 'workflow';
    }

    
throw new InvalidArgumentException(sprintf('No service found for "workflow.%1$s" nor "state_machine.%1$s".', $workflowName));
        }

        switch ($input->getOption('dump-format')) {
            case 'puml':
                $transitionType = 'workflow' === $type ? PlantUmlDumper::WORKFLOW_TRANSITION : PlantUmlDumper::STATEMACHINE_TRANSITION;
                $dumper = new PlantUmlDumper($transitionType);
                break;

            case 'mermaid':
                $transitionType = 'workflow' === $type ? MermaidDumper::TRANSITION_TYPE_WORKFLOW : MermaidDumper::TRANSITION_TYPE_STATEMACHINE;
                $dumper = new MermaidDumper($transitionType);
                break;

            case 'dot':
            default:
                $dumper = ('workflow' === $type) ? new GraphvizDumper() : new StateMachineGraphvizDumper();
        }

        $marking = new Marking();

        foreach ($input->getArgument('marking') as $place) {
            $marking->mark($place);
        }
use Symfony\Component\Workflow\Transition;

class MermaidDumperTest extends TestCase
{
    use WorkflowBuilderTrait;

    /** * @dataProvider provideWorkflowDefinitionWithoutMarking */
    public function testDumpWithoutMarking(Definition $definition, string $expected)
    {
        $dumper = new MermaidDumper(MermaidDumper::TRANSITION_TYPE_WORKFLOW);

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

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

    /** * @dataProvider provideWorkflowWithReservedWords */
    public function testDumpWithReservedWordsAsPlacenames(Definition $definition, string $expected)
    {
        
Home | Imprint | This part of the site doesn't use cookies.