From 55a5a7a64451f59754962c51b246b414fc944ca4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Pineau?= Date: Wed, 7 Feb 2018 19:18:29 +0100 Subject: [PATCH] [Workflow] Remove constraints on transition/place name + Updated Dumper --- src/Symfony/Component/Workflow/Definition.php | 5 - .../Component/Workflow/DefinitionBuilder.php | 6 - .../Workflow/Dumper/GraphvizDumper.php | 16 +- .../Workflow/Dumper/PlantUmlDumper.php | 44 +++--- .../Dumper/StateMachineGraphvizDumper.php | 2 +- .../Workflow/Tests/DefinitionBuilderTest.php | 8 - .../Workflow/Tests/DefinitionTest.php | 9 -- .../Tests/Dumper/GraphvizDumperTest.php | 144 +++++++++--------- .../Dumper/StateMachineGraphvizDumperTest.php | 32 ++-- .../Workflow/Tests/TransitionTest.php | 9 -- .../complex-workflow-marking-nofooter.puml | 31 ++-- .../puml/arrow/complex-workflow-marking.puml | 31 ++-- .../complex-workflow-nomarking-nofooter.puml | 31 ++-- .../arrow/complex-workflow-nomarking.puml | 31 ++-- .../simple-workflow-marking-nofooter.puml | 11 +- .../puml/arrow/simple-workflow-marking.puml | 11 +- .../simple-workflow-nomarking-nofooter.puml | 11 +- .../puml/arrow/simple-workflow-nomarking.puml | 11 +- .../complex-workflow-marking-nofooter.puml | 54 +++---- .../puml/square/complex-workflow-marking.puml | 54 +++---- .../complex-workflow-nomarking-nofooter.puml | 54 +++---- .../square/complex-workflow-nomarking.puml | 54 +++---- .../simple-workflow-marking-nofooter.puml | 18 +-- .../puml/square/simple-workflow-marking.puml | 18 +-- .../simple-workflow-nomarking-nofooter.puml | 18 +-- .../square/simple-workflow-nomarking.puml | 18 +-- src/Symfony/Component/Workflow/Transition.php | 6 - 27 files changed, 359 insertions(+), 378 deletions(-) diff --git a/src/Symfony/Component/Workflow/Definition.php b/src/Symfony/Component/Workflow/Definition.php index 1469881de5..98536ddf8f 100644 --- a/src/Symfony/Component/Workflow/Definition.php +++ b/src/Symfony/Component/Workflow/Definition.php @@ -11,7 +11,6 @@ namespace Symfony\Component\Workflow; -use Symfony\Component\Workflow\Exception\InvalidArgumentException; use Symfony\Component\Workflow\Exception\LogicException; /** @@ -82,10 +81,6 @@ final class Definition private function addPlace(string $place) { - if (!preg_match('{^[\w_-]+$}', $place)) { - throw new InvalidArgumentException(sprintf('The place "%s" contains invalid characters.', $place)); - } - if (!count($this->places)) { $this->initialPlace = $place; } diff --git a/src/Symfony/Component/Workflow/DefinitionBuilder.php b/src/Symfony/Component/Workflow/DefinitionBuilder.php index 16d66286ef..bcc31cf2a7 100644 --- a/src/Symfony/Component/Workflow/DefinitionBuilder.php +++ b/src/Symfony/Component/Workflow/DefinitionBuilder.php @@ -11,8 +11,6 @@ namespace Symfony\Component\Workflow; -use Symfony\Component\Workflow\Exception\InvalidArgumentException; - /** * Builds a definition. * @@ -77,10 +75,6 @@ class DefinitionBuilder */ public function addPlace($place) { - if (!preg_match('{^[\w_-]+$}', $place)) { - throw new InvalidArgumentException(sprintf('The place "%s" contains invalid characters.', $place)); - } - if (!$this->places) { $this->initialPlace = $place; } diff --git a/src/Symfony/Component/Workflow/Dumper/GraphvizDumper.php b/src/Symfony/Component/Workflow/Dumper/GraphvizDumper.php index 1344980bee..2d883c8264 100644 --- a/src/Symfony/Component/Workflow/Dumper/GraphvizDumper.php +++ b/src/Symfony/Component/Workflow/Dumper/GraphvizDumper.php @@ -107,7 +107,7 @@ class GraphvizDumper implements DumperInterface $code = ''; foreach ($places as $id => $place) { - $code .= sprintf(" place_%s [label=\"%s\", shape=circle%s];\n", $this->dotize($id), $id, $this->addAttributes($place['attributes'])); + $code .= sprintf(" place_%s [label=\"%s\", shape=circle%s];\n", $this->dotize($id), $this->escape($id), $this->addAttributes($place['attributes'])); } return $code; @@ -121,7 +121,7 @@ class GraphvizDumper implements DumperInterface $code = ''; foreach ($transitions as $place) { - $code .= sprintf(" transition_%s [label=\"%s\", shape=box%s];\n", $this->dotize($place['name']), $place['name'], $this->addAttributes($place['attributes'])); + $code .= sprintf(" transition_%s [label=\"%s\", shape=box%s];\n", $this->dotize($place['name']), $this->escape($place['name']), $this->addAttributes($place['attributes'])); } return $code; @@ -198,7 +198,15 @@ class GraphvizDumper implements DumperInterface */ protected function dotize($id) { - return strtolower(preg_replace('/[^\w]/i', '_', $id)); + return hash('sha1', $id); + } + + /** + * @internal + */ + protected function escape(string $string): string + { + return addslashes($string); } private function addAttributes(array $attributes): string @@ -206,7 +214,7 @@ class GraphvizDumper implements DumperInterface $code = array(); foreach ($attributes as $k => $v) { - $code[] = sprintf('%s="%s"', $k, $v); + $code[] = sprintf('%s="%s"', $k, $this->escape($v)); } return $code ? ', '.implode(', ', $code) : ''; diff --git a/src/Symfony/Component/Workflow/Dumper/PlantUmlDumper.php b/src/Symfony/Component/Workflow/Dumper/PlantUmlDumper.php index 02d9634617..d0f4bdb225 100644 --- a/src/Symfony/Component/Workflow/Dumper/PlantUmlDumper.php +++ b/src/Symfony/Component/Workflow/Dumper/PlantUmlDumper.php @@ -34,8 +34,8 @@ UnrujbYjjz0NnsObkTgnmolqJD4QgGUYTQiNe8eIjtx4b6Vv8nPGpncn3NJ8Geo9W9VW2wGACm_JzgIO qM53XHDUwhY0TAwPug3OG9NonRFhO8ynF3I4unuAMDHmSrXH57V1RGvl9jafuZF9ZhqjWOEh98y0tUYGsUxkBSllIyBdT2oM5Fn2-ut-fzsq_cQNuL6Uvwqr knh4RrvOKzxZfLV3s0rs_R_1SdYt3VxeQ1_y2_W2 }'; - private const INITIAL = 'initial'; - private const MARKED = 'marked'; + private const INITIAL = '<>'; + private const MARKED = '<>'; const STATEMACHINE_TRANSITION = 'arrow'; const WORKFLOW_TRANSITION = 'square'; @@ -45,11 +45,11 @@ knh4RrvOKzxZfLV3s0rs_R_1SdYt3VxeQ1_y2_W2 'titleBorderRoundCorner' => 15, 'titleBorderThickness' => 2, 'state' => array( - 'BackgroundColor<<'.self::INITIAL.'>>' => '#87b741', - 'BackgroundColor<<'.self::MARKED.'>>' => '#3887C6', + 'BackgroundColor'.self::INITIAL => '#87b741', + 'BackgroundColor'.self::MARKED => '#3887C6', 'BorderColor' => '#3887C6', - 'BorderColor<<'.self::MARKED.'>>' => 'Black', - 'FontColor<<'.self::MARKED.'>>' => 'White', + 'BorderColor'.self::MARKED => 'Black', + 'FontColor'.self::MARKED => 'White', ), 'agent' => array( 'BackgroundColor' => '#ffffff', @@ -63,7 +63,7 @@ knh4RrvOKzxZfLV3s0rs_R_1SdYt3VxeQ1_y2_W2 public function __construct(string $transitionType = null) { if (!in_array($transitionType, self::TRANSITION_TYPES)) { - throw new InvalidArgumentException("Transition type '{$transitionType}' does not exist."); + throw new InvalidArgumentException("Transition type '$transitionType' does not exist."); } $this->transitionType = $transitionType; } @@ -73,23 +73,28 @@ knh4RrvOKzxZfLV3s0rs_R_1SdYt3VxeQ1_y2_W2 $options = array_replace_recursive(self::DEFAULT_OPTIONS, $options); $code = $this->initialize($options); foreach ($definition->getPlaces() as $place) { + $placeEscaped = $this->escape($place); $code[] = - "state {$place}". - ($definition->getInitialPlace() === $place ? ' <<'.self::INITIAL.'>>' : ''). - ($marking && $marking->has($place) ? ' <<'.self::MARKED.'>>' : ''); + "state $placeEscaped". + ($definition->getInitialPlace() === $place ? ' '.self::INITIAL : ''). + ($marking && $marking->has($place) ? ' '.self::MARKED : ''); } if ($this->isWorkflowTransitionType()) { foreach ($definition->getTransitions() as $transition) { - $code[] = "agent {$transition->getName()}"; + $transitionEscaped = $this->escape($transition->getName()); + $code[] = "agent $transitionEscaped"; } } foreach ($definition->getTransitions() as $transition) { + $transitionEscaped = $this->escape($transition->getName()); foreach ($transition->getFroms() as $from) { + $fromEscaped = $this->escape($from); foreach ($transition->getTos() as $to) { + $toEscaped = $this->escape($to); if ($this->isWorkflowTransitionType()) { $lines = array( - "{$from} --> {$transition->getName()}", - "{$transition->getName()} --> {$to}", + "$fromEscaped --> $transitionEscaped", + "$transitionEscaped --> $toEscaped", ); foreach ($lines as $line) { if (!in_array($line, $code)) { @@ -97,7 +102,7 @@ knh4RrvOKzxZfLV3s0rs_R_1SdYt3VxeQ1_y2_W2 } } } else { - $code[] = "{$from} --> {$to}: {$transition->getName()}"; + $code[] = "$fromEscaped --> $toEscaped: $transitionEscaped"; } } } @@ -114,10 +119,7 @@ knh4RrvOKzxZfLV3s0rs_R_1SdYt3VxeQ1_y2_W2 private function startPuml(array $options): string { $start = '@startuml'.PHP_EOL; - - if ($this->isWorkflowTransitionType()) { - $start .= 'allow_mixing'.PHP_EOL; - } + $start .= 'allow_mixing'.PHP_EOL; if ($options['nofooter'] ?? false) { return $start; @@ -169,4 +171,10 @@ knh4RrvOKzxZfLV3s0rs_R_1SdYt3VxeQ1_y2_W2 return $code; } + + private function escape(string $string): string + { + // It's not possible to escape property double quote, so let's remove it + return '"'.str_replace('"', '', $string).'"'; + } } diff --git a/src/Symfony/Component/Workflow/Dumper/StateMachineGraphvizDumper.php b/src/Symfony/Component/Workflow/Dumper/StateMachineGraphvizDumper.php index 9f68e1daf7..e73517581a 100644 --- a/src/Symfony/Component/Workflow/Dumper/StateMachineGraphvizDumper.php +++ b/src/Symfony/Component/Workflow/Dumper/StateMachineGraphvizDumper.php @@ -71,7 +71,7 @@ class StateMachineGraphvizDumper extends GraphvizDumper foreach ($edges as $id => $edges) { foreach ($edges as $edge) { - $code .= sprintf(" place_%s -> place_%s [label=\"%s\" style=\"%s\"];\n", $this->dotize($id), $this->dotize($edge['to']), $edge['name'], 'solid'); + $code .= sprintf(" place_%s -> place_%s [label=\"%s\" style=\"%s\"];\n", $this->dotize($id), $this->dotize($edge['to']), $this->escape($edge['name']), 'solid'); } } diff --git a/src/Symfony/Component/Workflow/Tests/DefinitionBuilderTest.php b/src/Symfony/Component/Workflow/Tests/DefinitionBuilderTest.php index 20eb1c8fee..1939fb5713 100644 --- a/src/Symfony/Component/Workflow/Tests/DefinitionBuilderTest.php +++ b/src/Symfony/Component/Workflow/Tests/DefinitionBuilderTest.php @@ -8,14 +8,6 @@ use Symfony\Component\Workflow\Transition; class DefinitionBuilderTest extends TestCase { - /** - * @expectedException \Symfony\Component\Workflow\Exception\InvalidArgumentException - */ - public function testAddPlaceInvalidName() - { - $builder = new DefinitionBuilder(array('a"', 'b')); - } - public function testSetInitialPlace() { $builder = new DefinitionBuilder(array('a', 'b')); diff --git a/src/Symfony/Component/Workflow/Tests/DefinitionTest.php b/src/Symfony/Component/Workflow/Tests/DefinitionTest.php index 8eb1b6e4cf..92e517df2f 100644 --- a/src/Symfony/Component/Workflow/Tests/DefinitionTest.php +++ b/src/Symfony/Component/Workflow/Tests/DefinitionTest.php @@ -18,15 +18,6 @@ class DefinitionTest extends TestCase $this->assertEquals('a', $definition->getInitialPlace()); } - /** - * @expectedException \Symfony\Component\Workflow\Exception\InvalidArgumentException - */ - public function testAddPlacesInvalidArgument() - { - $places = array('a"', 'e"'); - $definition = new Definition($places, array()); - } - public function testSetInitialPlace() { $places = range('a', 'e'); diff --git a/src/Symfony/Component/Workflow/Tests/Dumper/GraphvizDumperTest.php b/src/Symfony/Component/Workflow/Tests/Dumper/GraphvizDumperTest.php index 067cb9d415..203f33f6dc 100644 --- a/src/Symfony/Component/Workflow/Tests/Dumper/GraphvizDumperTest.php +++ b/src/Symfony/Component/Workflow/Tests/Dumper/GraphvizDumperTest.php @@ -66,33 +66,33 @@ class GraphvizDumperTest extends TestCase node [fontsize="9" fontname="Arial" color="#333333" fillcolor="lightblue" fixedsize="1" width="1"]; edge [fontsize="9" fontname="Arial" color="#333333" arrowhead="normal" arrowsize="0.5"]; - place_a [label="a", shape=circle, style="filled"]; - place_b [label="b", shape=circle, color="#FF0000", shape="doublecircle"]; - place_c [label="c", shape=circle]; - place_d [label="d", shape=circle]; - place_e [label="e", shape=circle]; - place_f [label="f", shape=circle]; - place_g [label="g", shape=circle]; - transition_t1 [label="t1", shape=box, shape="box", regular="1"]; - transition_t2 [label="t2", shape=box, shape="box", regular="1"]; - transition_t3 [label="t3", shape=box, shape="box", regular="1"]; - transition_t4 [label="t4", shape=box, shape="box", regular="1"]; - transition_t5 [label="t5", shape=box, shape="box", regular="1"]; - transition_t6 [label="t6", shape=box, shape="box", regular="1"]; - place_a -> transition_t1 [style="solid"]; - transition_t1 -> place_b [style="solid"]; - transition_t1 -> place_c [style="solid"]; - place_b -> transition_t2 [style="solid"]; - place_c -> transition_t2 [style="solid"]; - transition_t2 -> place_d [style="solid"]; - place_d -> transition_t3 [style="solid"]; - transition_t3 -> place_e [style="solid"]; - place_d -> transition_t4 [style="solid"]; - transition_t4 -> place_f [style="solid"]; - place_e -> transition_t5 [style="solid"]; - transition_t5 -> place_g [style="solid"]; - place_f -> transition_t6 [style="solid"]; - transition_t6 -> place_g [style="solid"]; + place_86f7e437faa5a7fce15d1ddcb9eaeaea377667b8 [label="a", shape=circle, style="filled"]; + place_e9d71f5ee7c92d6dc9e92ffdad17b8bd49418f98 [label="b", shape=circle, color="#FF0000", shape="doublecircle"]; + place_84a516841ba77a5b4648de2cd0dfcb30ea46dbb4 [label="c", shape=circle]; + place_3c363836cf4e16666669a25da280a1865c2d2874 [label="d", shape=circle]; + place_58e6b3a414a1e090dfc6029add0f3555ccba127f [label="e", shape=circle]; + place_4a0a19218e082a343a1b17e5333409af9d98f0f5 [label="f", shape=circle]; + place_54fd1711209fb1c0781092374132c66e79e2241b [label="g", shape=circle]; + transition_e5353879bd69bfddcb465dad176ff52db8319d6f [label="t1", shape=box, shape="box", regular="1"]; + transition_2a5bd02710e975a7fbb92da876655950fbd5e70d [label="t2", shape=box, shape="box", regular="1"]; + transition_4358694eeb098c6708ae914a10562ce722bbbc34 [label="t3", shape=box, shape="box", regular="1"]; + transition_a9dfb15be45a5f3128784c80c733f2cdee2f756a [label="t4", shape=box, shape="box", regular="1"]; + transition_bf55e75fa263cbbc2529db49da43cb7f1d370b88 [label="t5", shape=box, shape="box", regular="1"]; + transition_e92a96c0e3a20d87ace74ab7871931a8f9f25943 [label="t6", shape=box, shape="box", regular="1"]; + place_86f7e437faa5a7fce15d1ddcb9eaeaea377667b8 -> transition_e5353879bd69bfddcb465dad176ff52db8319d6f [style="solid"]; + transition_e5353879bd69bfddcb465dad176ff52db8319d6f -> place_e9d71f5ee7c92d6dc9e92ffdad17b8bd49418f98 [style="solid"]; + transition_e5353879bd69bfddcb465dad176ff52db8319d6f -> place_84a516841ba77a5b4648de2cd0dfcb30ea46dbb4 [style="solid"]; + place_e9d71f5ee7c92d6dc9e92ffdad17b8bd49418f98 -> transition_2a5bd02710e975a7fbb92da876655950fbd5e70d [style="solid"]; + place_84a516841ba77a5b4648de2cd0dfcb30ea46dbb4 -> transition_2a5bd02710e975a7fbb92da876655950fbd5e70d [style="solid"]; + transition_2a5bd02710e975a7fbb92da876655950fbd5e70d -> place_3c363836cf4e16666669a25da280a1865c2d2874 [style="solid"]; + place_3c363836cf4e16666669a25da280a1865c2d2874 -> transition_4358694eeb098c6708ae914a10562ce722bbbc34 [style="solid"]; + transition_4358694eeb098c6708ae914a10562ce722bbbc34 -> place_58e6b3a414a1e090dfc6029add0f3555ccba127f [style="solid"]; + place_3c363836cf4e16666669a25da280a1865c2d2874 -> transition_a9dfb15be45a5f3128784c80c733f2cdee2f756a [style="solid"]; + transition_a9dfb15be45a5f3128784c80c733f2cdee2f756a -> place_4a0a19218e082a343a1b17e5333409af9d98f0f5 [style="solid"]; + place_58e6b3a414a1e090dfc6029add0f3555ccba127f -> transition_bf55e75fa263cbbc2529db49da43cb7f1d370b88 [style="solid"]; + transition_bf55e75fa263cbbc2529db49da43cb7f1d370b88 -> place_54fd1711209fb1c0781092374132c66e79e2241b [style="solid"]; + place_4a0a19218e082a343a1b17e5333409af9d98f0f5 -> transition_e92a96c0e3a20d87ace74ab7871931a8f9f25943 [style="solid"]; + transition_e92a96c0e3a20d87ace74ab7871931a8f9f25943 -> place_54fd1711209fb1c0781092374132c66e79e2241b [style="solid"]; } '; } @@ -104,15 +104,15 @@ class GraphvizDumperTest extends TestCase node [fontsize="9" fontname="Arial" color="#333333" fillcolor="lightblue" fixedsize="1" width="1"]; edge [fontsize="9" fontname="Arial" color="#333333" arrowhead="normal" arrowsize="0.5"]; - place_a [label="a", shape=circle, style="filled"]; - place_b [label="b", shape=circle]; - place_c [label="c", shape=circle, color="#FF0000", shape="doublecircle"]; - transition_t1 [label="t1", shape=box, shape="box", regular="1"]; - transition_t2 [label="t2", shape=box, shape="box", regular="1"]; - place_a -> transition_t1 [style="solid"]; - transition_t1 -> place_b [style="solid"]; - place_b -> transition_t2 [style="solid"]; - transition_t2 -> place_c [style="solid"]; + place_86f7e437faa5a7fce15d1ddcb9eaeaea377667b8 [label="a", shape=circle, style="filled"]; + place_e9d71f5ee7c92d6dc9e92ffdad17b8bd49418f98 [label="b", shape=circle]; + place_84a516841ba77a5b4648de2cd0dfcb30ea46dbb4 [label="c", shape=circle, color="#FF0000", shape="doublecircle"]; + transition_e5353879bd69bfddcb465dad176ff52db8319d6f [label="t1", shape=box, shape="box", regular="1"]; + transition_2a5bd02710e975a7fbb92da876655950fbd5e70d [label="t2", shape=box, shape="box", regular="1"]; + place_86f7e437faa5a7fce15d1ddcb9eaeaea377667b8 -> transition_e5353879bd69bfddcb465dad176ff52db8319d6f [style="solid"]; + transition_e5353879bd69bfddcb465dad176ff52db8319d6f -> place_e9d71f5ee7c92d6dc9e92ffdad17b8bd49418f98 [style="solid"]; + place_e9d71f5ee7c92d6dc9e92ffdad17b8bd49418f98 -> transition_2a5bd02710e975a7fbb92da876655950fbd5e70d [style="solid"]; + transition_2a5bd02710e975a7fbb92da876655950fbd5e70d -> place_84a516841ba77a5b4648de2cd0dfcb30ea46dbb4 [style="solid"]; } '; } @@ -124,33 +124,33 @@ class GraphvizDumperTest extends TestCase node [fontsize="9" fontname="Arial" color="#333333" fillcolor="lightblue" fixedsize="1" width="1"]; edge [fontsize="9" fontname="Arial" color="#333333" arrowhead="normal" arrowsize="0.5"]; - place_a [label="a", shape=circle, style="filled"]; - place_b [label="b", shape=circle]; - place_c [label="c", shape=circle]; - place_d [label="d", shape=circle]; - place_e [label="e", shape=circle]; - place_f [label="f", shape=circle]; - place_g [label="g", shape=circle]; - transition_t1 [label="t1", shape=box, shape="box", regular="1"]; - transition_t2 [label="t2", shape=box, shape="box", regular="1"]; - transition_t3 [label="t3", shape=box, shape="box", regular="1"]; - transition_t4 [label="t4", shape=box, shape="box", regular="1"]; - transition_t5 [label="t5", shape=box, shape="box", regular="1"]; - transition_t6 [label="t6", shape=box, shape="box", regular="1"]; - place_a -> transition_t1 [style="solid"]; - transition_t1 -> place_b [style="solid"]; - transition_t1 -> place_c [style="solid"]; - place_b -> transition_t2 [style="solid"]; - place_c -> transition_t2 [style="solid"]; - transition_t2 -> place_d [style="solid"]; - place_d -> transition_t3 [style="solid"]; - transition_t3 -> place_e [style="solid"]; - place_d -> transition_t4 [style="solid"]; - transition_t4 -> place_f [style="solid"]; - place_e -> transition_t5 [style="solid"]; - transition_t5 -> place_g [style="solid"]; - place_f -> transition_t6 [style="solid"]; - transition_t6 -> place_g [style="solid"]; + place_86f7e437faa5a7fce15d1ddcb9eaeaea377667b8 [label="a", shape=circle, style="filled"]; + place_e9d71f5ee7c92d6dc9e92ffdad17b8bd49418f98 [label="b", shape=circle]; + place_84a516841ba77a5b4648de2cd0dfcb30ea46dbb4 [label="c", shape=circle]; + place_3c363836cf4e16666669a25da280a1865c2d2874 [label="d", shape=circle]; + place_58e6b3a414a1e090dfc6029add0f3555ccba127f [label="e", shape=circle]; + place_4a0a19218e082a343a1b17e5333409af9d98f0f5 [label="f", shape=circle]; + place_54fd1711209fb1c0781092374132c66e79e2241b [label="g", shape=circle]; + transition_e5353879bd69bfddcb465dad176ff52db8319d6f [label="t1", shape=box, shape="box", regular="1"]; + transition_2a5bd02710e975a7fbb92da876655950fbd5e70d [label="t2", shape=box, shape="box", regular="1"]; + transition_4358694eeb098c6708ae914a10562ce722bbbc34 [label="t3", shape=box, shape="box", regular="1"]; + transition_a9dfb15be45a5f3128784c80c733f2cdee2f756a [label="t4", shape=box, shape="box", regular="1"]; + transition_bf55e75fa263cbbc2529db49da43cb7f1d370b88 [label="t5", shape=box, shape="box", regular="1"]; + transition_e92a96c0e3a20d87ace74ab7871931a8f9f25943 [label="t6", shape=box, shape="box", regular="1"]; + place_86f7e437faa5a7fce15d1ddcb9eaeaea377667b8 -> transition_e5353879bd69bfddcb465dad176ff52db8319d6f [style="solid"]; + transition_e5353879bd69bfddcb465dad176ff52db8319d6f -> place_e9d71f5ee7c92d6dc9e92ffdad17b8bd49418f98 [style="solid"]; + transition_e5353879bd69bfddcb465dad176ff52db8319d6f -> place_84a516841ba77a5b4648de2cd0dfcb30ea46dbb4 [style="solid"]; + place_e9d71f5ee7c92d6dc9e92ffdad17b8bd49418f98 -> transition_2a5bd02710e975a7fbb92da876655950fbd5e70d [style="solid"]; + place_84a516841ba77a5b4648de2cd0dfcb30ea46dbb4 -> transition_2a5bd02710e975a7fbb92da876655950fbd5e70d [style="solid"]; + transition_2a5bd02710e975a7fbb92da876655950fbd5e70d -> place_3c363836cf4e16666669a25da280a1865c2d2874 [style="solid"]; + place_3c363836cf4e16666669a25da280a1865c2d2874 -> transition_4358694eeb098c6708ae914a10562ce722bbbc34 [style="solid"]; + transition_4358694eeb098c6708ae914a10562ce722bbbc34 -> place_58e6b3a414a1e090dfc6029add0f3555ccba127f [style="solid"]; + place_3c363836cf4e16666669a25da280a1865c2d2874 -> transition_a9dfb15be45a5f3128784c80c733f2cdee2f756a [style="solid"]; + transition_a9dfb15be45a5f3128784c80c733f2cdee2f756a -> place_4a0a19218e082a343a1b17e5333409af9d98f0f5 [style="solid"]; + place_58e6b3a414a1e090dfc6029add0f3555ccba127f -> transition_bf55e75fa263cbbc2529db49da43cb7f1d370b88 [style="solid"]; + transition_bf55e75fa263cbbc2529db49da43cb7f1d370b88 -> place_54fd1711209fb1c0781092374132c66e79e2241b [style="solid"]; + place_4a0a19218e082a343a1b17e5333409af9d98f0f5 -> transition_e92a96c0e3a20d87ace74ab7871931a8f9f25943 [style="solid"]; + transition_e92a96c0e3a20d87ace74ab7871931a8f9f25943 -> place_54fd1711209fb1c0781092374132c66e79e2241b [style="solid"]; } '; } @@ -162,15 +162,15 @@ class GraphvizDumperTest extends TestCase node [fontsize="9" fontname="Arial" color="#333333" fillcolor="lightblue" fixedsize="1" width="1"]; edge [fontsize="9" fontname="Arial" color="#333333" arrowhead="normal" arrowsize="0.5"]; - place_a [label="a", shape=circle, style="filled"]; - place_b [label="b", shape=circle]; - place_c [label="c", shape=circle]; - transition_t1 [label="t1", shape=box, shape="box", regular="1"]; - transition_t2 [label="t2", shape=box, shape="box", regular="1"]; - place_a -> transition_t1 [style="solid"]; - transition_t1 -> place_b [style="solid"]; - place_b -> transition_t2 [style="solid"]; - transition_t2 -> place_c [style="solid"]; + place_86f7e437faa5a7fce15d1ddcb9eaeaea377667b8 [label="a", shape=circle, style="filled"]; + place_e9d71f5ee7c92d6dc9e92ffdad17b8bd49418f98 [label="b", shape=circle]; + place_84a516841ba77a5b4648de2cd0dfcb30ea46dbb4 [label="c", shape=circle]; + transition_e5353879bd69bfddcb465dad176ff52db8319d6f [label="t1", shape=box, shape="box", regular="1"]; + transition_2a5bd02710e975a7fbb92da876655950fbd5e70d [label="t2", shape=box, shape="box", regular="1"]; + place_86f7e437faa5a7fce15d1ddcb9eaeaea377667b8 -> transition_e5353879bd69bfddcb465dad176ff52db8319d6f [style="solid"]; + transition_e5353879bd69bfddcb465dad176ff52db8319d6f -> place_e9d71f5ee7c92d6dc9e92ffdad17b8bd49418f98 [style="solid"]; + place_e9d71f5ee7c92d6dc9e92ffdad17b8bd49418f98 -> transition_2a5bd02710e975a7fbb92da876655950fbd5e70d [style="solid"]; + transition_2a5bd02710e975a7fbb92da876655950fbd5e70d -> place_84a516841ba77a5b4648de2cd0dfcb30ea46dbb4 [style="solid"]; } '; } diff --git a/src/Symfony/Component/Workflow/Tests/Dumper/StateMachineGraphvizDumperTest.php b/src/Symfony/Component/Workflow/Tests/Dumper/StateMachineGraphvizDumperTest.php index 7277b1c65b..29899109a0 100644 --- a/src/Symfony/Component/Workflow/Tests/Dumper/StateMachineGraphvizDumperTest.php +++ b/src/Symfony/Component/Workflow/Tests/Dumper/StateMachineGraphvizDumperTest.php @@ -30,14 +30,14 @@ digraph workflow { node [fontsize="9" fontname="Arial" color="#333333" fillcolor="lightblue" fixedsize="1" width="1"]; edge [fontsize="9" fontname="Arial" color="#333333" arrowhead="normal" arrowsize="0.5"]; - place_a [label="a", shape=circle, style="filled"]; - place_b [label="b", shape=circle]; - place_c [label="c", shape=circle]; - place_d [label="d", shape=circle]; - place_a -> place_b [label="t1" style="solid"]; - place_d -> place_b [label="t1" style="solid"]; - place_b -> place_c [label="t2" style="solid"]; - place_b -> place_d [label="t3" style="solid"]; + place_86f7e437faa5a7fce15d1ddcb9eaeaea377667b8 [label="a", shape=circle, style="filled"]; + place_e9d71f5ee7c92d6dc9e92ffdad17b8bd49418f98 [label="b", shape=circle]; + place_84a516841ba77a5b4648de2cd0dfcb30ea46dbb4 [label="c", shape=circle]; + place_3c363836cf4e16666669a25da280a1865c2d2874 [label="d", shape=circle]; + place_86f7e437faa5a7fce15d1ddcb9eaeaea377667b8 -> place_e9d71f5ee7c92d6dc9e92ffdad17b8bd49418f98 [label="t1" style="solid"]; + place_3c363836cf4e16666669a25da280a1865c2d2874 -> place_e9d71f5ee7c92d6dc9e92ffdad17b8bd49418f98 [label="t1" style="solid"]; + place_e9d71f5ee7c92d6dc9e92ffdad17b8bd49418f98 -> place_84a516841ba77a5b4648de2cd0dfcb30ea46dbb4 [label="t2" style="solid"]; + place_e9d71f5ee7c92d6dc9e92ffdad17b8bd49418f98 -> place_3c363836cf4e16666669a25da280a1865c2d2874 [label="t3" style="solid"]; } EOGRAPH; @@ -56,14 +56,14 @@ digraph workflow { node [fontsize="9" fontname="Arial" color="#333333" fillcolor="lightblue" fixedsize="1" width="1"]; edge [fontsize="9" fontname="Arial" color="#333333" arrowhead="normal" arrowsize="0.5"]; - place_a [label="a", shape=circle, style="filled"]; - place_b [label="b", shape=circle, color="#FF0000", shape="doublecircle"]; - place_c [label="c", shape=circle]; - place_d [label="d", shape=circle]; - place_a -> place_b [label="t1" style="solid"]; - place_d -> place_b [label="t1" style="solid"]; - place_b -> place_c [label="t2" style="solid"]; - place_b -> place_d [label="t3" style="solid"]; + place_86f7e437faa5a7fce15d1ddcb9eaeaea377667b8 [label="a", shape=circle, style="filled"]; + place_e9d71f5ee7c92d6dc9e92ffdad17b8bd49418f98 [label="b", shape=circle, color="#FF0000", shape="doublecircle"]; + place_84a516841ba77a5b4648de2cd0dfcb30ea46dbb4 [label="c", shape=circle]; + place_3c363836cf4e16666669a25da280a1865c2d2874 [label="d", shape=circle]; + place_86f7e437faa5a7fce15d1ddcb9eaeaea377667b8 -> place_e9d71f5ee7c92d6dc9e92ffdad17b8bd49418f98 [label="t1" style="solid"]; + place_3c363836cf4e16666669a25da280a1865c2d2874 -> place_e9d71f5ee7c92d6dc9e92ffdad17b8bd49418f98 [label="t1" style="solid"]; + place_e9d71f5ee7c92d6dc9e92ffdad17b8bd49418f98 -> place_84a516841ba77a5b4648de2cd0dfcb30ea46dbb4 [label="t2" style="solid"]; + place_e9d71f5ee7c92d6dc9e92ffdad17b8bd49418f98 -> place_3c363836cf4e16666669a25da280a1865c2d2874 [label="t3" style="solid"]; } EOGRAPH; diff --git a/src/Symfony/Component/Workflow/Tests/TransitionTest.php b/src/Symfony/Component/Workflow/Tests/TransitionTest.php index 74bab16f71..cf2d281620 100644 --- a/src/Symfony/Component/Workflow/Tests/TransitionTest.php +++ b/src/Symfony/Component/Workflow/Tests/TransitionTest.php @@ -7,15 +7,6 @@ use Symfony\Component\Workflow\Transition; class TransitionTest extends TestCase { - /** - * @expectedException \Symfony\Component\Workflow\Exception\InvalidArgumentException - * @expectedExceptionMessage The transition "foo.bar" contains invalid characters. - */ - public function testValidateName() - { - $transition = new Transition('foo.bar', 'a', 'b'); - } - public function testConstructor() { $transition = new Transition('name', 'a', 'b'); diff --git a/src/Symfony/Component/Workflow/Tests/fixtures/puml/arrow/complex-workflow-marking-nofooter.puml b/src/Symfony/Component/Workflow/Tests/fixtures/puml/arrow/complex-workflow-marking-nofooter.puml index 72a3fe4cac..c6e43db94b 100644 --- a/src/Symfony/Component/Workflow/Tests/fixtures/puml/arrow/complex-workflow-marking-nofooter.puml +++ b/src/Symfony/Component/Workflow/Tests/fixtures/puml/arrow/complex-workflow-marking-nofooter.puml @@ -1,4 +1,5 @@ @startuml +allow_mixing title ComplexDiagram skinparam titleBorderRoundCorner 15 skinparam titleBorderThickness 2 @@ -9,19 +10,19 @@ skinparam state { BorderColor<> Black FontColor<> White } -state a <> -state b -state c <> -state d -state e <> -state f -state g -a --> b: t1 -a --> c: t1 -b --> d: t2 -c --> d: t2 -d --> e: t3 -d --> f: t4 -e --> g: t5 -f --> g: t6 +state "a" <> +state "b" +state "c" <> +state "d" +state "e" <> +state "f" +state "g" +"a" --> "b": "t1" +"a" --> "c": "t1" +"b" --> "d": "t2" +"c" --> "d": "t2" +"d" --> "e": "t3" +"d" --> "f": "t4" +"e" --> "g": "t5" +"f" --> "g": "t6" @enduml diff --git a/src/Symfony/Component/Workflow/Tests/fixtures/puml/arrow/complex-workflow-marking.puml b/src/Symfony/Component/Workflow/Tests/fixtures/puml/arrow/complex-workflow-marking.puml index dcb29effc9..8342a9f9de 100644 --- a/src/Symfony/Component/Workflow/Tests/fixtures/puml/arrow/complex-workflow-marking.puml +++ b/src/Symfony/Component/Workflow/Tests/fixtures/puml/arrow/complex-workflow-marking.puml @@ -1,4 +1,5 @@ @startuml +allow_mixing sprite $sf_logo [81x20/16z] { hPNRaYiX24K1xwBo_tyx6-qaCtDEJ-KXLYMTLbp0HWcHZr3KRDJ8z94HG3jZn4_mijbQ2ryJoFePtXLWA_qxyGy19DpdY_10z11ZAbGjFHRwcEbcKx5-wqsV yIMo8StMCHKh8ZUxnEwrZiwRAUOvy1lLcPQF4lEFAjhzMd5WOAqvKflS0Enx8PbihiSYXM8ClGVAseIWTAjCgVSAcnYbQG79xKFsZ0VnDCNc7AVBoPSMcTsX @@ -17,20 +18,20 @@ skinparam state { BorderColor<> Black FontColor<> White } -state a <> -state b -state c <> -state d -state e <> -state f -state g -a --> b: t1 -a --> c: t1 -b --> d: t2 -c --> d: t2 -d --> e: t3 -d --> f: t4 -e --> g: t5 -f --> g: t6 +state "a" <> +state "b" +state "c" <> +state "d" +state "e" <> +state "f" +state "g" +"a" --> "b": "t1" +"a" --> "c": "t1" +"b" --> "d": "t2" +"c" --> "d": "t2" +"d" --> "e": "t3" +"d" --> "f": "t4" +"e" --> "g": "t5" +"f" --> "g": "t6" footer \nGenerated by <$sf_logo> **Workflow Component** and **PlantUML** @enduml diff --git a/src/Symfony/Component/Workflow/Tests/fixtures/puml/arrow/complex-workflow-nomarking-nofooter.puml b/src/Symfony/Component/Workflow/Tests/fixtures/puml/arrow/complex-workflow-nomarking-nofooter.puml index d3d9273f25..c247438954 100644 --- a/src/Symfony/Component/Workflow/Tests/fixtures/puml/arrow/complex-workflow-nomarking-nofooter.puml +++ b/src/Symfony/Component/Workflow/Tests/fixtures/puml/arrow/complex-workflow-nomarking-nofooter.puml @@ -1,4 +1,5 @@ @startuml +allow_mixing title ComplexDiagram skinparam titleBorderRoundCorner 15 skinparam titleBorderThickness 2 @@ -9,19 +10,19 @@ skinparam state { BorderColor<> Black FontColor<> White } -state a <> -state b -state c -state d -state e -state f -state g -a --> b: t1 -a --> c: t1 -b --> d: t2 -c --> d: t2 -d --> e: t3 -d --> f: t4 -e --> g: t5 -f --> g: t6 +state "a" <> +state "b" +state "c" +state "d" +state "e" +state "f" +state "g" +"a" --> "b": "t1" +"a" --> "c": "t1" +"b" --> "d": "t2" +"c" --> "d": "t2" +"d" --> "e": "t3" +"d" --> "f": "t4" +"e" --> "g": "t5" +"f" --> "g": "t6" @enduml diff --git a/src/Symfony/Component/Workflow/Tests/fixtures/puml/arrow/complex-workflow-nomarking.puml b/src/Symfony/Component/Workflow/Tests/fixtures/puml/arrow/complex-workflow-nomarking.puml index 14819bf97e..160d725468 100644 --- a/src/Symfony/Component/Workflow/Tests/fixtures/puml/arrow/complex-workflow-nomarking.puml +++ b/src/Symfony/Component/Workflow/Tests/fixtures/puml/arrow/complex-workflow-nomarking.puml @@ -1,4 +1,5 @@ @startuml +allow_mixing sprite $sf_logo [81x20/16z] { hPNRaYiX24K1xwBo_tyx6-qaCtDEJ-KXLYMTLbp0HWcHZr3KRDJ8z94HG3jZn4_mijbQ2ryJoFePtXLWA_qxyGy19DpdY_10z11ZAbGjFHRwcEbcKx5-wqsV yIMo8StMCHKh8ZUxnEwrZiwRAUOvy1lLcPQF4lEFAjhzMd5WOAqvKflS0Enx8PbihiSYXM8ClGVAseIWTAjCgVSAcnYbQG79xKFsZ0VnDCNc7AVBoPSMcTsX @@ -17,20 +18,20 @@ skinparam state { BorderColor<> Black FontColor<> White } -state a <> -state b -state c -state d -state e -state f -state g -a --> b: t1 -a --> c: t1 -b --> d: t2 -c --> d: t2 -d --> e: t3 -d --> f: t4 -e --> g: t5 -f --> g: t6 +state "a" <> +state "b" +state "c" +state "d" +state "e" +state "f" +state "g" +"a" --> "b": "t1" +"a" --> "c": "t1" +"b" --> "d": "t2" +"c" --> "d": "t2" +"d" --> "e": "t3" +"d" --> "f": "t4" +"e" --> "g": "t5" +"f" --> "g": "t6" footer \nGenerated by <$sf_logo> **Workflow Component** and **PlantUML** @enduml diff --git a/src/Symfony/Component/Workflow/Tests/fixtures/puml/arrow/simple-workflow-marking-nofooter.puml b/src/Symfony/Component/Workflow/Tests/fixtures/puml/arrow/simple-workflow-marking-nofooter.puml index 54fe1e33cb..ba1abf9215 100644 --- a/src/Symfony/Component/Workflow/Tests/fixtures/puml/arrow/simple-workflow-marking-nofooter.puml +++ b/src/Symfony/Component/Workflow/Tests/fixtures/puml/arrow/simple-workflow-marking-nofooter.puml @@ -1,4 +1,5 @@ @startuml +allow_mixing title SimpleDiagram skinparam titleBorderRoundCorner 15 skinparam titleBorderThickness 2 @@ -9,9 +10,9 @@ skinparam state { BorderColor<> Black FontColor<> White } -state a <> -state b <> -state c -a --> b: t1 -b --> c: t2 +state "a" <> +state "b" <> +state "c" +"a" --> "b": "t1" +"b" --> "c": "t2" @enduml diff --git a/src/Symfony/Component/Workflow/Tests/fixtures/puml/arrow/simple-workflow-marking.puml b/src/Symfony/Component/Workflow/Tests/fixtures/puml/arrow/simple-workflow-marking.puml index 3064520b3a..7546338da3 100644 --- a/src/Symfony/Component/Workflow/Tests/fixtures/puml/arrow/simple-workflow-marking.puml +++ b/src/Symfony/Component/Workflow/Tests/fixtures/puml/arrow/simple-workflow-marking.puml @@ -1,4 +1,5 @@ @startuml +allow_mixing sprite $sf_logo [81x20/16z] { hPNRaYiX24K1xwBo_tyx6-qaCtDEJ-KXLYMTLbp0HWcHZr3KRDJ8z94HG3jZn4_mijbQ2ryJoFePtXLWA_qxyGy19DpdY_10z11ZAbGjFHRwcEbcKx5-wqsV yIMo8StMCHKh8ZUxnEwrZiwRAUOvy1lLcPQF4lEFAjhzMd5WOAqvKflS0Enx8PbihiSYXM8ClGVAseIWTAjCgVSAcnYbQG79xKFsZ0VnDCNc7AVBoPSMcTsX @@ -17,10 +18,10 @@ skinparam state { BorderColor<> Black FontColor<> White } -state a <> -state b <> -state c -a --> b: t1 -b --> c: t2 +state "a" <> +state "b" <> +state "c" +"a" --> "b": "t1" +"b" --> "c": "t2" footer \nGenerated by <$sf_logo> **Workflow Component** and **PlantUML** @enduml diff --git a/src/Symfony/Component/Workflow/Tests/fixtures/puml/arrow/simple-workflow-nomarking-nofooter.puml b/src/Symfony/Component/Workflow/Tests/fixtures/puml/arrow/simple-workflow-nomarking-nofooter.puml index 170c9aec33..a2800a627f 100644 --- a/src/Symfony/Component/Workflow/Tests/fixtures/puml/arrow/simple-workflow-nomarking-nofooter.puml +++ b/src/Symfony/Component/Workflow/Tests/fixtures/puml/arrow/simple-workflow-nomarking-nofooter.puml @@ -1,4 +1,5 @@ @startuml +allow_mixing title SimpleDiagram skinparam titleBorderRoundCorner 15 skinparam titleBorderThickness 2 @@ -9,9 +10,9 @@ skinparam state { BorderColor<> Black FontColor<> White } -state a <> -state b -state c -a --> b: t1 -b --> c: t2 +state "a" <> +state "b" +state "c" +"a" --> "b": "t1" +"b" --> "c": "t2" @enduml diff --git a/src/Symfony/Component/Workflow/Tests/fixtures/puml/arrow/simple-workflow-nomarking.puml b/src/Symfony/Component/Workflow/Tests/fixtures/puml/arrow/simple-workflow-nomarking.puml index 7d3b7c669a..ffe310b4a2 100644 --- a/src/Symfony/Component/Workflow/Tests/fixtures/puml/arrow/simple-workflow-nomarking.puml +++ b/src/Symfony/Component/Workflow/Tests/fixtures/puml/arrow/simple-workflow-nomarking.puml @@ -1,4 +1,5 @@ @startuml +allow_mixing sprite $sf_logo [81x20/16z] { hPNRaYiX24K1xwBo_tyx6-qaCtDEJ-KXLYMTLbp0HWcHZr3KRDJ8z94HG3jZn4_mijbQ2ryJoFePtXLWA_qxyGy19DpdY_10z11ZAbGjFHRwcEbcKx5-wqsV yIMo8StMCHKh8ZUxnEwrZiwRAUOvy1lLcPQF4lEFAjhzMd5WOAqvKflS0Enx8PbihiSYXM8ClGVAseIWTAjCgVSAcnYbQG79xKFsZ0VnDCNc7AVBoPSMcTsX @@ -17,10 +18,10 @@ skinparam state { BorderColor<> Black FontColor<> White } -state a <> -state b -state c -a --> b: t1 -b --> c: t2 +state "a" <> +state "b" +state "c" +"a" --> "b": "t1" +"b" --> "c": "t2" footer \nGenerated by <$sf_logo> **Workflow Component** and **PlantUML** @enduml diff --git a/src/Symfony/Component/Workflow/Tests/fixtures/puml/square/complex-workflow-marking-nofooter.puml b/src/Symfony/Component/Workflow/Tests/fixtures/puml/square/complex-workflow-marking-nofooter.puml index 9fdacade26..0ae74a7c44 100644 --- a/src/Symfony/Component/Workflow/Tests/fixtures/puml/square/complex-workflow-marking-nofooter.puml +++ b/src/Symfony/Component/Workflow/Tests/fixtures/puml/square/complex-workflow-marking-nofooter.puml @@ -14,31 +14,31 @@ skinparam agent { BackgroundColor #ffffff BorderColor #3887C6 } -state a <> -state b -state c <> -state d -state e <> -state f -state g -agent t1 -agent t2 -agent t3 -agent t4 -agent t5 -agent t6 -a --> t1 -t1 --> b -t1 --> c -b --> t2 -t2 --> d -c --> t2 -d --> t3 -t3 --> e -d --> t4 -t4 --> f -e --> t5 -t5 --> g -f --> t6 -t6 --> g +state "a" <> +state "b" +state "c" <> +state "d" +state "e" <> +state "f" +state "g" +agent "t1" +agent "t2" +agent "t3" +agent "t4" +agent "t5" +agent "t6" +"a" --> "t1" +"t1" --> "b" +"t1" --> "c" +"b" --> "t2" +"t2" --> "d" +"c" --> "t2" +"d" --> "t3" +"t3" --> "e" +"d" --> "t4" +"t4" --> "f" +"e" --> "t5" +"t5" --> "g" +"f" --> "t6" +"t6" --> "g" @enduml diff --git a/src/Symfony/Component/Workflow/Tests/fixtures/puml/square/complex-workflow-marking.puml b/src/Symfony/Component/Workflow/Tests/fixtures/puml/square/complex-workflow-marking.puml index 7384728761..fa7efe91f6 100644 --- a/src/Symfony/Component/Workflow/Tests/fixtures/puml/square/complex-workflow-marking.puml +++ b/src/Symfony/Component/Workflow/Tests/fixtures/puml/square/complex-workflow-marking.puml @@ -22,32 +22,32 @@ skinparam agent { BackgroundColor #ffffff BorderColor #3887C6 } -state a <> -state b -state c <> -state d -state e <> -state f -state g -agent t1 -agent t2 -agent t3 -agent t4 -agent t5 -agent t6 -a --> t1 -t1 --> b -t1 --> c -b --> t2 -t2 --> d -c --> t2 -d --> t3 -t3 --> e -d --> t4 -t4 --> f -e --> t5 -t5 --> g -f --> t6 -t6 --> g +state "a" <> +state "b" +state "c" <> +state "d" +state "e" <> +state "f" +state "g" +agent "t1" +agent "t2" +agent "t3" +agent "t4" +agent "t5" +agent "t6" +"a" --> "t1" +"t1" --> "b" +"t1" --> "c" +"b" --> "t2" +"t2" --> "d" +"c" --> "t2" +"d" --> "t3" +"t3" --> "e" +"d" --> "t4" +"t4" --> "f" +"e" --> "t5" +"t5" --> "g" +"f" --> "t6" +"t6" --> "g" footer \nGenerated by <$sf_logo> **Workflow Component** and **PlantUML** @enduml diff --git a/src/Symfony/Component/Workflow/Tests/fixtures/puml/square/complex-workflow-nomarking-nofooter.puml b/src/Symfony/Component/Workflow/Tests/fixtures/puml/square/complex-workflow-nomarking-nofooter.puml index 73677f3dec..db3c8bf208 100644 --- a/src/Symfony/Component/Workflow/Tests/fixtures/puml/square/complex-workflow-nomarking-nofooter.puml +++ b/src/Symfony/Component/Workflow/Tests/fixtures/puml/square/complex-workflow-nomarking-nofooter.puml @@ -14,31 +14,31 @@ skinparam agent { BackgroundColor #ffffff BorderColor #3887C6 } -state a <> -state b -state c -state d -state e -state f -state g -agent t1 -agent t2 -agent t3 -agent t4 -agent t5 -agent t6 -a --> t1 -t1 --> b -t1 --> c -b --> t2 -t2 --> d -c --> t2 -d --> t3 -t3 --> e -d --> t4 -t4 --> f -e --> t5 -t5 --> g -f --> t6 -t6 --> g +state "a" <> +state "b" +state "c" +state "d" +state "e" +state "f" +state "g" +agent "t1" +agent "t2" +agent "t3" +agent "t4" +agent "t5" +agent "t6" +"a" --> "t1" +"t1" --> "b" +"t1" --> "c" +"b" --> "t2" +"t2" --> "d" +"c" --> "t2" +"d" --> "t3" +"t3" --> "e" +"d" --> "t4" +"t4" --> "f" +"e" --> "t5" +"t5" --> "g" +"f" --> "t6" +"t6" --> "g" @enduml diff --git a/src/Symfony/Component/Workflow/Tests/fixtures/puml/square/complex-workflow-nomarking.puml b/src/Symfony/Component/Workflow/Tests/fixtures/puml/square/complex-workflow-nomarking.puml index 7bed4c7dd8..aa6c2fee39 100644 --- a/src/Symfony/Component/Workflow/Tests/fixtures/puml/square/complex-workflow-nomarking.puml +++ b/src/Symfony/Component/Workflow/Tests/fixtures/puml/square/complex-workflow-nomarking.puml @@ -22,32 +22,32 @@ skinparam agent { BackgroundColor #ffffff BorderColor #3887C6 } -state a <> -state b -state c -state d -state e -state f -state g -agent t1 -agent t2 -agent t3 -agent t4 -agent t5 -agent t6 -a --> t1 -t1 --> b -t1 --> c -b --> t2 -t2 --> d -c --> t2 -d --> t3 -t3 --> e -d --> t4 -t4 --> f -e --> t5 -t5 --> g -f --> t6 -t6 --> g +state "a" <> +state "b" +state "c" +state "d" +state "e" +state "f" +state "g" +agent "t1" +agent "t2" +agent "t3" +agent "t4" +agent "t5" +agent "t6" +"a" --> "t1" +"t1" --> "b" +"t1" --> "c" +"b" --> "t2" +"t2" --> "d" +"c" --> "t2" +"d" --> "t3" +"t3" --> "e" +"d" --> "t4" +"t4" --> "f" +"e" --> "t5" +"t5" --> "g" +"f" --> "t6" +"t6" --> "g" footer \nGenerated by <$sf_logo> **Workflow Component** and **PlantUML** @enduml diff --git a/src/Symfony/Component/Workflow/Tests/fixtures/puml/square/simple-workflow-marking-nofooter.puml b/src/Symfony/Component/Workflow/Tests/fixtures/puml/square/simple-workflow-marking-nofooter.puml index 2325f95311..f81c44c5c2 100644 --- a/src/Symfony/Component/Workflow/Tests/fixtures/puml/square/simple-workflow-marking-nofooter.puml +++ b/src/Symfony/Component/Workflow/Tests/fixtures/puml/square/simple-workflow-marking-nofooter.puml @@ -14,13 +14,13 @@ skinparam agent { BackgroundColor #ffffff BorderColor #3887C6 } -state a <> -state b <> -state c -agent t1 -agent t2 -a --> t1 -t1 --> b -b --> t2 -t2 --> c +state "a" <> +state "b" <> +state "c" +agent "t1" +agent "t2" +"a" --> "t1" +"t1" --> "b" +"b" --> "t2" +"t2" --> "c" @enduml diff --git a/src/Symfony/Component/Workflow/Tests/fixtures/puml/square/simple-workflow-marking.puml b/src/Symfony/Component/Workflow/Tests/fixtures/puml/square/simple-workflow-marking.puml index 50ba4d7b5d..999d8add0f 100644 --- a/src/Symfony/Component/Workflow/Tests/fixtures/puml/square/simple-workflow-marking.puml +++ b/src/Symfony/Component/Workflow/Tests/fixtures/puml/square/simple-workflow-marking.puml @@ -22,14 +22,14 @@ skinparam agent { BackgroundColor #ffffff BorderColor #3887C6 } -state a <> -state b <> -state c -agent t1 -agent t2 -a --> t1 -t1 --> b -b --> t2 -t2 --> c +state "a" <> +state "b" <> +state "c" +agent "t1" +agent "t2" +"a" --> "t1" +"t1" --> "b" +"b" --> "t2" +"t2" --> "c" footer \nGenerated by <$sf_logo> **Workflow Component** and **PlantUML** @enduml diff --git a/src/Symfony/Component/Workflow/Tests/fixtures/puml/square/simple-workflow-nomarking-nofooter.puml b/src/Symfony/Component/Workflow/Tests/fixtures/puml/square/simple-workflow-nomarking-nofooter.puml index 38b0870c9e..c677c24f89 100644 --- a/src/Symfony/Component/Workflow/Tests/fixtures/puml/square/simple-workflow-nomarking-nofooter.puml +++ b/src/Symfony/Component/Workflow/Tests/fixtures/puml/square/simple-workflow-nomarking-nofooter.puml @@ -14,13 +14,13 @@ skinparam agent { BackgroundColor #ffffff BorderColor #3887C6 } -state a <> -state b -state c -agent t1 -agent t2 -a --> t1 -t1 --> b -b --> t2 -t2 --> c +state "a" <> +state "b" +state "c" +agent "t1" +agent "t2" +"a" --> "t1" +"t1" --> "b" +"b" --> "t2" +"t2" --> "c" @enduml diff --git a/src/Symfony/Component/Workflow/Tests/fixtures/puml/square/simple-workflow-nomarking.puml b/src/Symfony/Component/Workflow/Tests/fixtures/puml/square/simple-workflow-nomarking.puml index 31e3b40061..7e57fdd54e 100644 --- a/src/Symfony/Component/Workflow/Tests/fixtures/puml/square/simple-workflow-nomarking.puml +++ b/src/Symfony/Component/Workflow/Tests/fixtures/puml/square/simple-workflow-nomarking.puml @@ -22,14 +22,14 @@ skinparam agent { BackgroundColor #ffffff BorderColor #3887C6 } -state a <> -state b -state c -agent t1 -agent t2 -a --> t1 -t1 --> b -b --> t2 -t2 --> c +state "a" <> +state "b" +state "c" +agent "t1" +agent "t2" +"a" --> "t1" +"t1" --> "b" +"b" --> "t2" +"t2" --> "c" footer \nGenerated by <$sf_logo> **Workflow Component** and **PlantUML** @enduml diff --git a/src/Symfony/Component/Workflow/Transition.php b/src/Symfony/Component/Workflow/Transition.php index 9b482ac843..0516fa181a 100644 --- a/src/Symfony/Component/Workflow/Transition.php +++ b/src/Symfony/Component/Workflow/Transition.php @@ -11,8 +11,6 @@ namespace Symfony\Component\Workflow; -use Symfony\Component\Workflow\Exception\InvalidArgumentException; - /** * @author Fabien Potencier * @author Grégoire Pineau @@ -30,10 +28,6 @@ class Transition */ public function __construct(string $name, $froms, $tos) { - if (!preg_match('{^[\w_-]+$}', $name)) { - throw new InvalidArgumentException(sprintf('The transition "%s" contains invalid characters.', $name)); - } - $this->name = $name; $this->froms = (array) $froms; $this->tos = (array) $tos;