Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 067ce70

Browse files
committed
minor #22020 [Workflow] Added more tests (lyrixx)
This PR was merged into the 3.2 branch. Discussion ---------- [Workflow] Added more tests | Q | A | ------------- | --- | Branch? | 3.2 | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #22017 | License | MIT | Doc PR | - --- It's not the first time that people try to fix the workflow because they don't understand how it works. Basically, it's because the default configuration is using the "workflow" and not the "state_machine" type. It was a mistake but it's too late because it will be BC break. May be we could solve that by triggering a deprecation if the type is not explicit. But nobody will see it because it will be triggered during the compilation. It could also be fixed with more documentation. Anyway, I want to add more tests to cover that with a little comment in the test suite. Right now, only one tests failed. With this PR more tests are failing. Commits ------- e47cfe9 [Workflow] Added more tests
2 parents efa74c5 + e47cfe9 commit 067ce70

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

src/Symfony/Component/Workflow/Tests/WorkflowTest.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,23 @@ public function testCan()
104104

105105
$this->assertTrue($workflow->can($subject, 't1'));
106106
$this->assertFalse($workflow->can($subject, 't2'));
107+
108+
$subject->marking = array('b' => 1);
109+
110+
$this->assertFalse($workflow->can($subject, 't1'));
111+
// In a workflow net, all "from" places should contain a token to enable
112+
// the transition.
113+
$this->assertFalse($workflow->can($subject, 't2'));
114+
115+
$subject->marking = array('b' => 1, 'c' => 1);
116+
117+
$this->assertFalse($workflow->can($subject, 't1'));
118+
$this->assertTrue($workflow->can($subject, 't2'));
119+
120+
$subject->marking = array('f' => 1);
121+
122+
$this->assertFalse($workflow->can($subject, 't5'));
123+
$this->assertTrue($workflow->can($subject, 't6'));
107124
}
108125

109126
public function testCanWithGuard()

0 commit comments

Comments
 (0)