public function testTransitionCreationSuccess()
 {
     $this->specify('create a transition instance with success', function () {
         $start = new Status(['id' => 'draft', 'workflowId' => 'workflow1']);
         $end = new Status(['id' => 'published', 'workflowId' => 'workflow1']);
         $tr = new Transition(['start' => $start, 'end' => $end]);
         verify("start status id is 'draft'", $tr->getStartStatus()->getId())->equals('draft');
         verify("end status id is 'published'", $tr->getEndStatus()->getId())->equals('published');
     });
 }
 /**
  * Produces the following sequence when a model changes from status A to status B:
  *
  * - beforeLeaveStatus(A)
  * - beforeChangeStatus(A,B)
  * - beforeEnterStatus(B)
  *
  * - afterLeaveStatus(A)
  * - afterChangeStatus(A,B)
  * - afterEnterStatus(B)
  * @param Transition $transition
  * @param Object $sender
  * @return array|\yii\base\Event[]
  * @see \fproject\workflow\events\IEventSequenceScheme::createChangeStatusSequence()
  */
 public function createChangeStatusSequence($transition, $sender)
 {
     return ['before' => [new WorkflowEvent(WorkflowEvent::beforeLeaveStatus($transition->getStartStatus()->getId()), ['start' => $transition->getStartStatus(), 'sender' => $sender]), new WorkflowEvent(WorkflowEvent::beforeChangeStatus($transition->getStartStatus()->getId(), $transition->getEndStatus()->getId()), ['start' => $transition->getStartStatus(), 'end' => $transition->getEndStatus(), 'transition' => $transition, 'sender' => $sender]), new WorkflowEvent(WorkflowEvent::beforeEnterStatus($transition->getEndStatus()->getId()), ['end' => $transition->getEndStatus(), 'sender' => $sender])], 'after' => [new WorkflowEvent(WorkflowEvent::afterLeaveStatus($transition->getStartStatus()->getId()), ['start' => $transition->getStartStatus(), 'sender' => $sender]), new WorkflowEvent(WorkflowEvent::afterChangeStatus($transition->getStartStatus()->getId(), $transition->getEndStatus()->getId()), ['start' => $transition->getStartStatus(), 'end' => $transition->getEndStatus(), 'transition' => $transition, 'sender' => $sender]), new WorkflowEvent(WorkflowEvent::afterEnterStatus($transition->getEndStatus()->getId()), ['end' => $transition->getEndStatus(), 'sender' => $sender])]];
 }