Пример #1
0
 public function testGetNextStatusFails()
 {
     $item = new Item04();
     $item->detachBehavior('workflow');
     $item->attachBehavior('workflowForTest', ['class' => SimpleWorkflowBehavior::className(), 'defaultWorkflowId' => 'INVALID_ID']);
     $this->specify('getNextStatus throws exception if default workflow Id is invalid', function () use($item) {
         $this->setExpectedException('raoul2000\\workflow\\base\\WorkflowException', "Invalid workflow Id : 'INVALID_ID'");
         $item->getNextStatuses();
     });
 }
 public function testConvertionOnLeaveWorkflow()
 {
     $item = new Item04();
     $item->attachBehavior('workflow', ['class' => SimpleWorkflowBehavior::className(), 'statusConverter' => 'converter']);
     $this->assertEquals(null, $item->status);
     $this->assertEquals('Item04Workflow/B', $item->getWorkflowStatus()->getId());
     $this->specify('convertion is done when leaving workflow', function () use($item) {
         $item->sendToStatus(null);
         expect('item to not be in a workflow', $item->getWorkflow())->equals(null);
         expect('item to not have status', $item->hasWorkflowStatus())->false();
         expect('status attribut to be converted into 55', $item->status)->equals(55);
     });
 }