Author: sb
Date: Wed Aug  1 09:42:36 2007
New Revision: 5785

Log:
- Add test for invalid synchronization.
# 100% code coverage for ezcWorkflowNodeMerge.

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 09:42:36 2007
@@ -252,6 +252,30 @@
         $synchronization->addInNode( $actionNodeC );
 
         $this->startNode->addOutNode( $this->branchNode );
+        $this->endNode->addInNode( $synchronization );
+    }
+
+    protected function setUpParallelSplitInvalidSynchronization()
+    {
+        $this->workflow = new ezcWorkflow( 
'ParallelSplitInvalidSynchronization' );
+        $this->setUpReferences();
+
+        $branchA = new ezcWorkflowNodeParallelSplit;
+        $branchB = new ezcWorkflowNodeParallelSplit;
+        $branchC = new ezcWorkflowNodeParallelSplit;
+
+        $branchA->addOutNode( $branchB )
+                ->addOutNode( $branchC );
+
+        $synchronization = new ezcWorkflowNodeSynchronization;
+
+        $branchB->addOutNode( new ezcWorkflowNodeEnd )
+                ->addOutNode( $synchronization );
+
+        $branchC->addOutNode( $synchronization )
+                ->addOutNode( new ezcWorkflowNodeEnd );
+
+        $this->startNode->addOutNode( $branchA );
         $this->endNode->addInNode( $synchronization );
     }
 

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 09:42:36 
2007
@@ -311,6 +311,28 @@
         $this->assertFalse( $this->execution->isSuspended() );
     }
 
+    public function testExecuteParallelSplitInvalidSynchronization()
+    {
+        $this->setUpParallelSplitInvalidSynchronization();
+        $this->execution->workflow = $this->workflow;
+
+        try
+        {
+            $this->execution->start();
+        }
+        catch ( ezcWorkflowExecutionException $e )
+        {
+            $this->assertEquals(
+              'Cannot synchronize threads that were started by different 
branches.',
+              $e->getMessage()
+            );
+
+            return;
+        }
+
+        $this->fail();
+    }
+
     public function testExecuteExclusiveChoiceSimpleMerge()
     {
         $this->setUpExclusiveChoiceSimpleMerge();


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

Reply via email to