Author: sb
Date: Wed Aug  1 10:40:02 2007
New Revision: 5789

Log:
- Add tests.
# 100% code coverage for ezcWorkflowNodeConditionalBranch.

Modified:
    trunk/Workflow/tests/node_test.php

Modified: trunk/Workflow/tests/node_test.php
==============================================================================
--- trunk/Workflow/tests/node_test.php [iso-8859-1] (original)
+++ trunk/Workflow/tests/node_test.php [iso-8859-1] Wed Aug  1 10:40:02 2007
@@ -139,6 +139,21 @@
         $this->assertEquals( 'condition is false', 
(string)$this->branchNode->getCondition( $outNodes[1] ) );
     }
 
+    public function testBranchGetCondition2()
+    {
+        $this->setUpExclusiveChoiceWithUnconditionalOutNodeSimpleMerge();
+
+        $outNodes = $this->branchNode->getOutNodes();
+        $this->assertFalse( $this->branchNode->getCondition( $outNodes[2] ) );
+    }
+
+    public function testBranchGetCondition3()
+    {
+        $this->setUpExclusiveChoiceWithUnconditionalOutNodeSimpleMerge();
+
+        $this->assertFalse( $this->branchNode->getCondition( new 
ezcWorkflowNodeEnd ) );
+    }
+
     public function testRemoveInNode()
     {
         $this->setUpStartEnd();
@@ -262,5 +277,29 @@
 
         $this->fail();
     }
+
+    public function testVerifyTooFewConditionalOutNodes()
+    {
+        try
+        {
+            $branch = new ezcWorkflowNodeExclusiveChoice;
+            $branch->addInNode( new ezcWorkflowNodeStart )
+                   ->addOutNode( new ezcWorkflowNodeEnd )
+                   ->addOutNode( new ezcWorkflowNodeEnd );
+
+            $branch->verify();
+        }
+        catch ( ezcWorkflowInvalidWorkflowException $e )
+        {
+            $this->assertEquals(
+              'Node has less conditional outgoing nodes than required.',
+              $e->getMessage()
+            );
+
+            return;
+        }
+
+        $this->fail();
+    }
 }
 ?>


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

Reply via email to