Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
minor #20548 [Workflow] Refactored test suite (HeahDude, lyrixx)
This PR was merged into the 3.2-dev branch. Discussion ---------- [Workflow] Refactored test suite | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #20507 | License | MIT | Doc PR | - Commits ------- cef6f31 [Workflow] Refactored tests suite 3ee876b [Workflow] Fixed validator tests and used static function to create workflows
- Loading branch information
Showing
8 changed files
with
77 additions
and
115 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
src/Symfony/Component/Workflow/Tests/WorkflowBuilderTrait.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<?php | ||
|
||
namespace Symfony\Component\Workflow\Tests; | ||
|
||
use Symfony\Component\Workflow\Definition; | ||
use Symfony\Component\Workflow\Transition; | ||
|
||
trait WorkflowBuilderTrait | ||
{ | ||
private function createComplexWorkflow() | ||
{ | ||
$places = range('a', 'g'); | ||
|
||
$transitions = array(); | ||
$transitions[] = new Transition('t1', 'a', array('b', 'c')); | ||
$transitions[] = new Transition('t2', array('b', 'c'), 'd'); | ||
$transitions[] = new Transition('t3', 'd', 'e'); | ||
$transitions[] = new Transition('t4', 'd', 'f'); | ||
$transitions[] = new Transition('t5', 'e', 'g'); | ||
$transitions[] = new Transition('t6', 'f', 'g'); | ||
|
||
return new Definition($places, $transitions); | ||
|
||
// The graph looks like: | ||
// +---+ +----+ +---+ +----+ +----+ +----+ +----+ +----+ +---+ | ||
// | a | --> | t1 | --> | c | --> | t2 | --> | d | --> | t4 | --> | f | --> | t6 | --> | g | | ||
// +---+ +----+ +---+ +----+ +----+ +----+ +----+ +----+ +---+ | ||
// | ^ | ^ | ||
// | | | | | ||
// v | v | | ||
// +----+ | +----+ +----+ +----+ | | ||
// | b | ----------------+ | t3 | --> | e | --> | t5 | -----------------+ | ||
// +----+ +----+ +----+ +----+ | ||
} | ||
|
||
public function createSimpleWorkflowDefinition() | ||
{ | ||
$places = range('a', 'c'); | ||
|
||
$transitions = array(); | ||
$transitions[] = new Transition('t1', 'a', 'b'); | ||
$transitions[] = new Transition('t2', 'b', 'c'); | ||
|
||
return new Definition($places, $transitions); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters