From 33f45e5da22f62bcb54fc0677d38a73af660eea3 Mon Sep 17 00:00:00 2001 From: Tobias Nyholm Date: Fri, 12 Aug 2016 22:44:24 +0200 Subject: [PATCH 1/2] Added failing test --- .../Component/Workflow/Tests/WorkflowTest.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/Symfony/Component/Workflow/Tests/WorkflowTest.php b/src/Symfony/Component/Workflow/Tests/WorkflowTest.php index 22dc1927b8f28..833affcc3028b 100644 --- a/src/Symfony/Component/Workflow/Tests/WorkflowTest.php +++ b/src/Symfony/Component/Workflow/Tests/WorkflowTest.php @@ -128,6 +128,20 @@ public function testCan() $this->assertFalse($workflow->can($subject, 't2')); } + public function testCanWithInitialState() + { + $definition = $this->createComplexWorkflow(); + $workflow = new Workflow($definition, new PropertyAccessorMarkingStore()); + $subject = new \stdClass(); + + $subject->marking = array('b'=>1, 'c'=>1); + $this->assertTrue($workflow->can($subject, 't2')); + + // If you are in place b you should be able to apply t2 + $subject->marking = array('b'=>1); + $this->assertTrue($workflow->can($subject, 't2')); + } + public function testCanWithGuard() { $definition = $this->createComplexWorkflow(); From 9fedaf813136de581a6cc140520d6ec18e968958 Mon Sep 17 00:00:00 2001 From: Tobias Nyholm Date: Fri, 12 Aug 2016 22:49:25 +0200 Subject: [PATCH 2/2] code style --- src/Symfony/Component/Workflow/Tests/WorkflowTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/Workflow/Tests/WorkflowTest.php b/src/Symfony/Component/Workflow/Tests/WorkflowTest.php index 833affcc3028b..0d2af05d222f1 100644 --- a/src/Symfony/Component/Workflow/Tests/WorkflowTest.php +++ b/src/Symfony/Component/Workflow/Tests/WorkflowTest.php @@ -134,11 +134,11 @@ public function testCanWithInitialState() $workflow = new Workflow($definition, new PropertyAccessorMarkingStore()); $subject = new \stdClass(); - $subject->marking = array('b'=>1, 'c'=>1); + $subject->marking = array('b' => 1, 'c' => 1); $this->assertTrue($workflow->can($subject, 't2')); // If you are in place b you should be able to apply t2 - $subject->marking = array('b'=>1); + $subject->marking = array('b' => 1); $this->assertTrue($workflow->can($subject, 't2')); }