setUpStartInputEnd(); $this->definition->save( $this->workflow ); $execution = new ezcWorkflowDatabaseExecution( $this->db ); $execution->workflow = $this->workflow; $id = $execution->start(); $this->assertNotNull( $id ); $this->assertFalse( $execution->hasEnded() ); $this->assertFalse( $execution->isResumed() ); $this->assertTrue( $execution->isSuspended() ); $execution = new ezcWorkflowDatabaseExecution( $this->db, $id ); $execution->resume( array( 'variable' => 'value' ) ); $this->assertTrue( $execution->hasEnded() ); $this->assertFalse( $execution->isResumed() ); $this->assertFalse( $execution->isSuspended() ); } public function testNonInteractiveSubWorkflow() { $this->setUpStartEnd(); $this->definition->save( $this->workflow ); $this->setUpWorkflowWithSubWorkflow( 'StartEnd' ); $this->definition->save( $this->workflow ); $execution = new ezcWorkflowDatabaseExecution( $this->db ); $execution->workflow = $this->workflow; $id = $execution->start(); $this->assertNull( $id ); $this->assertTrue( $execution->hasEnded() ); $this->assertFalse( $execution->isResumed() ); $this->assertFalse( $execution->isSuspended() ); } public function testInteractiveSubWorkflow() { $this->setUpStartInputEnd(); $this->definition->save( $this->workflow ); $this->setUpWorkflowWithSubWorkflow( 'StartInputEnd' ); $this->definition->save( $this->workflow ); $execution = new ezcWorkflowDatabaseExecution( $this->db ); $execution->workflow = $this->workflow; $id = $execution->start(); $this->assertNotNull( $id ); $this->assertFalse( $execution->hasEnded() ); $this->assertFalse( $execution->isResumed() ); $this->assertTrue( $execution->isSuspended() ); $execution = new ezcWorkflowDatabaseExecution( $this->db, $id ); $execution->resume( array( 'variable' => 'value' ) ); $this->assertTrue( $execution->hasEnded() ); $this->assertFalse( $execution->isResumed() ); $this->assertFalse( $execution->isSuspended() ); } public function testNotExistingExecutionThrowsException() { try { $execution = new ezcWorkflowDatabaseExecution( $this->db, 1 ); } catch ( ezcWorkflowExecutionException $e ) { return; } $this->fail(); } } ?>