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);
     });
 }
 public function testEnterWorkflowSuccess()
 {
     /** @var ActiveWorkflowBehavior|Item04 $item */
     $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->getWorkflowStatus()->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();
         /** @var ActiveWorkflowBehavior|Item04 $newitem */
         $newitem = Item04::findOne(['id' => $item->id]);
         verify('current status is set', $newitem->hasWorkflowStatus())->true();
         verify('current status is ok', $newitem->getWorkflowStatus()->getId())->equals('Item04Workflow/A');
     });
 }
 public function testStatusEqualsFails()
 {
     $item = new Item04();
     $item->sendToStatus('A');
     expect_not($item->statusEquals('B'));
     expect_not($item->statusEquals('Item04Workflow/B'));
     expect_not($item->statusEquals('NOTFOUND'));
     expect_not($item->statusEquals('Item04Workflow/NOTFOUND'));
     expect_not($item->statusEquals('NOTFOUND/NOTFOUND'));
     expect_not($item->statusEquals('invalid name'));
     expect_not($item->statusEquals(''));
     expect_not($item->statusEquals(null));
     $statusA = $item->getWorkflowStatus();
     $item->sendToStatus('B');
     verify($item->statusEquals('B'));
     expect_not($item->statusEquals($statusA));
 }