Author: Raoul
Inheritance: extends WorkflowBaseObject, implements raoul2000\workflow\base\StatusInterface
 public function setStatus(BaseActiveRecord $model, Status $status = null)
 {
     echo 'setStatus model <br/>';
     $this->_status = $status != null ? $status->getId() : null;
 }
 /**
  * Set the internal status value and the owner model status attribute.
  *
  * @param Status|null $status
  */
 private function setStatusInternal($status)
 {
     if ($status !== null && !$status instanceof Status) {
         throw new WorkflowException('Status instance expected');
     }
     $this->_status = $status;
     $statusId = $status === null ? null : $status->getId();
     if ($this->getStatusConverter() != null) {
         $statusId = $this->_statusConverter->toModelAttribute($statusId);
     }
     $this->owner->{$this->statusAttribute} = $statusId;
 }
 public function testStatusAccessorFails()
 {
     $st = new Status(['id' => 'draft', 'workflowId' => 'workflow1']);
     $this->specify('Failed to get transitions when no source is configured', function () use($st) {
         $this->setExpectedException('raoul2000\\workflow\\base\\WorkflowException', 'no workflow source component available');
         $st->getTransitions();
     });
     $this->specify('Failed to get workflow object when no source is configured', function () use($st) {
         $this->setExpectedException('raoul2000\\workflow\\base\\WorkflowException', 'no workflow source component available');
         $st->getWorkflow();
     });
     $this->specify('Failed to call isInitialStatus when no source is configured', function () use($st) {
         $this->setExpectedException('raoul2000\\workflow\\base\\WorkflowException', 'no workflow source component available');
         $st->getWorkflow();
     });
 }