Author: sb
Date: Wed Aug  1 10:03:47 2007
New Revision: 5786

Log:
- Add tests for wrong number of activated conditional nodes.

Modified:
    trunk/Workflow/tests/case.php
    trunk/Workflow/tests/execution_test.php

Modified: trunk/Workflow/tests/case.php
==============================================================================
--- trunk/Workflow/tests/case.php [iso-8859-1] (original)
+++ trunk/Workflow/tests/case.php [iso-8859-1] Wed Aug  1 10:03:47 2007
@@ -279,7 +279,7 @@
         $this->endNode->addInNode( $synchronization );
     }
 
-    protected function setUpExclusiveChoiceSimpleMerge()
+    protected function setUpExclusiveChoiceSimpleMerge( $a = 
'ezcWorkflowConditionIsTrue', $b = 'ezcWorkflowConditionIsFalse' )
     {
         $this->workflow = new ezcWorkflow( 'ExclusiveChoiceSimpleMerge' );
         $this->setUpReferences();
@@ -292,7 +292,7 @@
         $this->branchNode->addConditionalOutNode(
           new ezcWorkflowConditionVariable(
             'condition',
-            new ezcWorkflowConditionIsTrue
+            new $a
           ),
           $actionNodeA
         );
@@ -300,7 +300,7 @@
         $this->branchNode->addConditionalOutNode(
           new ezcWorkflowConditionVariable(
             'condition',
-            new ezcWorkflowConditionIsFalse
+            new $b
           ),
           $actionNodeB
         );

Modified: trunk/Workflow/tests/execution_test.php
==============================================================================
--- trunk/Workflow/tests/execution_test.php [iso-8859-1] (original)
+++ trunk/Workflow/tests/execution_test.php [iso-8859-1] Wed Aug  1 10:03:47 
2007
@@ -357,6 +357,52 @@
         $this->assertFalse( $this->execution->isSuspended() );
     }
 
+    public function testExecuteExclusiveChoiceSimpleMerge3()
+    {
+        $this->setUpExclusiveChoiceSimpleMerge( 'ezcWorkflowConditionIsTrue', 
'ezcWorkflowConditionIsTrue' );
+        $this->execution->workflow = $this->workflow;
+        $this->execution->setVariables( array( 'condition' => false ) );
+
+        try
+        {
+            $this->execution->start();
+        }
+        catch ( ezcWorkflowExecutionException $e )
+        {
+            $this->assertEquals(
+              'Node activates less conditional outgoing nodes than required.',
+              $e->getMessage()
+            );
+
+            return;
+        }
+
+        $this->fail();
+    }
+
+    public function testExecuteExclusiveChoiceSimpleMerge4()
+    {
+        $this->setUpExclusiveChoiceSimpleMerge( 'ezcWorkflowConditionIsTrue', 
'ezcWorkflowConditionIsTrue' );
+        $this->execution->workflow = $this->workflow;
+        $this->execution->setVariables( array( 'condition' => true ) );
+
+        try
+        {
+            $this->execution->start();
+        }
+        catch ( ezcWorkflowExecutionException $e )
+        {
+            $this->assertEquals(
+              'Node activates more conditional outgoing nodes than allowed.',
+              $e->getMessage()
+            );
+
+            return;
+        }
+
+        $this->fail();
+    }
+
     public function testExclusiveChoiceWithUnconditionalOutNodeSimpleMerge()
     {
         $this->setUpExclusiveChoiceWithUnconditionalOutNodeSimpleMerge();


-- 
svn-components mailing list
[email protected]
http://lists.ez.no/mailman/listinfo/svn-components

Reply via email to