Author: sb
Date: Wed Oct  3 07:54:43 2007
New Revision: 6344

Log:
- Fix (and test) check for non-existing execution id.

Modified:
    trunk/Workflow/src/interfaces/execution.php
    trunk/Workflow/tests/execution.php
    trunk/Workflow/tests/execution_test.php

Modified: trunk/Workflow/src/interfaces/execution.php
==============================================================================
--- trunk/Workflow/src/interfaces/execution.php [iso-8859-1] (original)
+++ trunk/Workflow/src/interfaces/execution.php [iso-8859-1] Wed Oct  3 
07:54:43 2007
@@ -310,7 +310,7 @@
      */
     public function resume( Array $inputData = array() )
     {
-        if ( $this->id === false )
+        if ( $this->id === null )
         {
             throw new ezcWorkflowExecutionException(
               'No execution id given.'

Modified: trunk/Workflow/tests/execution.php
==============================================================================
--- trunk/Workflow/tests/execution.php [iso-8859-1] (original)
+++ trunk/Workflow/tests/execution.php [iso-8859-1] Wed Oct  3 07:54:43 2007
@@ -17,6 +17,13 @@
  */
 class ezcWorkflowTestExecution extends ezcWorkflowExecutionNonInteractive
 {
+    /**
+     * Execution ID.
+     *
+     * @var integer
+     */
+    protected $id = 0;
+
     /**
      * @var array
      */

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 Oct  3 07:54:43 
2007
@@ -29,43 +29,6 @@
         $this->execution = new ezcWorkflowTestExecution;
     }
 
-    public function testNoWorkflowRaisesException()
-    {
-        try
-        {
-            $execution = new ezcWorkflowExecutionNonInteractive;
-            $execution->start();
-        }
-        catch ( ezcWorkflowExecutionException $e )
-        {
-            return;
-        }
-
-        $this->fail();
-    }
-
-    public function testInteractiveWorkflowRaisesException()
-    {
-        $this->setupEmptyWorkflow();
-
-        $input = new ezcWorkflowNodeInput( array( 'choice' => new 
ezcWorkflowConditionIsBool ) );
-
-        $this->startNode->addOutNode( $input );
-        $this->endNode->addInNode( $input );
-
-        try
-        {
-            $execution = new ezcWorkflowExecutionNonInteractive;
-            $execution->workflow = $this->workflow;
-        }
-        catch ( ezcWorkflowExecutionException $e )
-        {
-            return;
-        }
-
-        $this->fail();
-    }
-
     public function testExecuteStartEnd()
     {
         $this->setUpStartEnd();
@@ -646,45 +609,6 @@
         $this->assertEquals( 2, $this->execution->getVariable( 'z' ) );
     }
 
-    public function testGetVariable()
-    {
-        $this->setUpStartEnd();
-        $this->execution->workflow = $this->workflow;
-        $this->execution->start();
-
-        $this->assertFalse( $this->execution->hasVariable( 'foo' ) );
-
-        try
-        {
-            $this->execution->getVariable( 'foo' );
-        }
-        catch ( ezcWorkflowExecutionException $e )
-        {
-            return;
-        }
-
-        $this->fail();
-    }
-
-    public function testEndNonExistingThread()
-    {
-        try
-        {
-            $this->execution->endThread( 0 );
-        }
-        catch ( ezcWorkflowExecutionException $e )
-        {
-            return;
-        }
-
-        $this->fail();
-    }
-
-    public function testGetSiblingsForNonExistingThread()
-    {
-        $this->assertFalse( $this->execution->getNumSiblingThreads( 0 ) );
-    }
-
     public function testListener()
     {
         $listener = $this->getMock( 'ezcWorkflowExecutionListener' );
@@ -694,6 +618,97 @@
 
         $this->assertTrue( $this->execution->removeListener( $listener ) );
         $this->assertFalse( $this->execution->removeListener( $listener ) );
+    }
+
+    public function testNoWorkflowStartRaisesException()
+    {
+        try
+        {
+            $execution = new ezcWorkflowExecutionNonInteractive;
+            $execution->start();
+        }
+        catch ( ezcWorkflowExecutionException $e )
+        {
+            return;
+        }
+
+        $this->fail();
+    }
+
+    public function testNoExecutionIdResumeRaisesException()
+    {
+        try
+        {
+            $execution = new ezcWorkflowExecutionNonInteractive;
+            $execution->resume();
+        }
+        catch ( ezcWorkflowExecutionException $e )
+        {
+            return;
+        }
+
+        $this->fail();
+    }
+
+    public function testInteractiveWorkflowRaisesException()
+    {
+        $this->setupEmptyWorkflow();
+
+        $input = new ezcWorkflowNodeInput( array( 'choice' => new 
ezcWorkflowConditionIsBool ) );
+
+        $this->startNode->addOutNode( $input );
+        $this->endNode->addInNode( $input );
+
+        try
+        {
+            $execution = new ezcWorkflowExecutionNonInteractive;
+            $execution->workflow = $this->workflow;
+        }
+        catch ( ezcWorkflowExecutionException $e )
+        {
+            return;
+        }
+
+        $this->fail();
+    }
+
+    public function testGetVariable()
+    {
+        $this->setUpStartEnd();
+        $this->execution->workflow = $this->workflow;
+        $this->execution->start();
+
+        $this->assertFalse( $this->execution->hasVariable( 'foo' ) );
+
+        try
+        {
+            $this->execution->getVariable( 'foo' );
+        }
+        catch ( ezcWorkflowExecutionException $e )
+        {
+            return;
+        }
+
+        $this->fail();
+    }
+
+    public function testEndNonExistingThread()
+    {
+        try
+        {
+            $this->execution->endThread( 0 );
+        }
+        catch ( ezcWorkflowExecutionException $e )
+        {
+            return;
+        }
+
+        $this->fail();
+    }
+
+    public function testGetSiblingsForNonExistingThread()
+    {
+        $this->assertFalse( $this->execution->getNumSiblingThreads( 0 ) );
     }
 
     public function testProperties()


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

Reply via email to