public function testEnterWorkflowSuccess()
 {
     $item = new Item04();
     $this->specify('model is inserted in the default workflow', function () use($item) {
         verify('current status is not set', $item->hasWorkflowStatus())->false();
         $item->enterWorkflow();
         verify('current status is set', $item->hasWorkflowStatus())->true();
         verify('current status is ok', $item->workflowStatus->getId())->equals('Item04Workflow/A');
         //verify('current status is the initial status for the current workflow', $item->engine->getInitialStatus($item->getWorkflowId())->getId() )->equals($item->currentStatus->id);
         verify('item can be saved', $item->save())->true();
         $newitem = Item04::findOne(['id' => $item->id]);
         verify('current status is set', $newitem->hasWorkflowStatus())->true();
         verify('current status is ok', $newitem->workflowStatus->getId())->equals('Item04Workflow/A');
     });
 }
 public function testConvertionOnChangeStatus()
 {
     $item = new Item04();
     $item->attachBehavior('workflow', ['class' => SimpleWorkflowBehavior::className(), 'statusConverter' => 'converter']);
     $this->specify('convertion is done on change status when setting the model attribute', function () use($item) {
         $item->status = 1;
         verify($item->save())->true();
         $this->assertEquals('Item04Workflow/A', $item->getWorkflowStatus()->getId());
     });
     $this->specify('convertion is done on change status when using SendToStatus()', function () use($item) {
         $item->sendToStatus('Item04Workflow/B');
         $this->assertEquals('Item04Workflow/B', $item->getWorkflowStatus()->getId());
         $this->assertEquals(null, $item->status);
     });
 }