コード例 #1
0
ファイル: case.php プロジェクト: jacomyma/GEXF-Atlas
 protected function setUpNestedExclusiveChoiceSimpleMerge($x = true, $y = true)
 {
     $this->workflow = new ezcWorkflow('NestedExclusiveChoiceSimpleMerge');
     $setX = new ezcWorkflowNodeVariableSet(array('x' => $x));
     $setY = new ezcWorkflowNodeVariableSet(array('y' => $y));
     $setZ1 = new ezcWorkflowNodeVariableSet(array('z' => true));
     $setZ2 = new ezcWorkflowNodeVariableSet(array('z' => false));
     $setZ3 = new ezcWorkflowNodeVariableSet(array('z' => false));
     $this->workflow->startNode->addOutNode($setX);
     $branch1 = new ezcWorkflowNodeExclusiveChoice();
     $branch1->addInNode($setX);
     $branch1->addConditionalOutNode(new ezcWorkflowConditionVariable('x', new ezcWorkflowConditionIsTrue()), $setY);
     $branch1->addConditionalOutNode(new ezcWorkflowConditionVariable('x', new ezcWorkflowConditionIsFalse()), $setZ3);
     $branch2 = new ezcWorkflowNodeExclusiveChoice();
     $branch2->addInNode($setY);
     $branch2->addConditionalOutNode(new ezcWorkflowConditionVariable('y', new ezcWorkflowConditionIsTrue()), $setZ1);
     $branch2->addConditionalOutNode(new ezcWorkflowConditionVariable('y', new ezcWorkflowConditionIsFalse()), $setZ2);
     $nestedMerge = new ezcWorkflowNodeSimpleMerge();
     $nestedMerge->addInNode($setZ1)->addInNode($setZ2);
     $merge = new ezcWorkflowNodeSimpleMerge();
     $merge->addInNode($nestedMerge)->addInNode($setZ3)->addOutNode($this->workflow->endNode);
 }
コード例 #2
0
ファイル: tutorial_example_01.php プロジェクト: bmdevel/ezc
<?php

// Create new workflow of name "Test".
$workflow = new ezcWorkflow('Test');
// Create an Input node that expects a boolean workflow variable of name "choice".
$input = new ezcWorkflowNodeInput(array('choice' => new ezcWorkflowConditionIsBool()));
// Add the previously created Input node
// as an outgoing node to the start node.
$workflow->startNode->addOutNode($input);
// Create a new Exclusive Choice node and add it as an
// outgoing node to the previously created Input node.
// This node will choose which output to run based on the
// choice workflow variable.
$branch = new ezcWorkflowNodeExclusiveChoice();
$branch->addInNode($input);
// Either $true or $false will be run depending on
// the above choice.
// Note that neither $true nor $false are valid action nodes.
// see the next example
$trueNode = new ezcWorkflowNodeAction('PrintTrue');
$falseNode = new ezcWorkflowNodeAction('PrintFalse');
// Branch
// Condition: Variable "choice" has boolean value "true".
// Action:    PrintTrue service object.
$branch->addConditionalOutNode(new ezcWorkflowConditionVariable('choice', new ezcWorkflowConditionIsTrue()), $trueNode);
// Branch
// Condition: Variable "choice" has boolean value "false".
// Action:    PrintFalse service object.
$branch->addConditionalOutNode(new ezcWorkflowConditionVariable('choice', new ezcWorkflowConditionIsFalse()), $falseNode);
// Create SimpleMerge node and add the two possible threads of
// execution as incoming nodes of the end node.
コード例 #3
0
ファイル: node_test.php プロジェクト: bmdevel/ezc
 public function testVerifyTooFewConditionalOutNodes()
 {
     $branch = new ezcWorkflowNodeExclusiveChoice();
     $branch->addInNode(new ezcWorkflowNodeStart())->addOutNode(new ezcWorkflowNodeEnd())->addOutNode(new ezcWorkflowNodeEnd());
     try {
         $branch->verify();
     } catch (ezcWorkflowInvalidWorkflowException $e) {
         $this->assertEquals('Node has less conditional outgoing nodes than required.', $e->getMessage());
         return;
     }
     $this->fail('Expected an ezcWorkflowInvalidWorkflowException to be thrown.');
 }