public function testStatusCreationSuccess() { $this->specify('create a status instance', function () { $s = new Status(['id' => 'draft', 'workflowId' => 'workflow1']); expect("status id is 'draft'", $s->getId())->equals('draft'); expect("workflow id is 'workflow1'", $s->getWorkflowId())->equals('workflow1'); expect("label is empty string", $s->getLabel())->equals(''); }); $this->specify('create a status instance with a label', function () { $s = new Status(['id' => 'draft', 'workflowId' => 'workflow1', 'label' => 'my custom label']); expect("label is 'my custom label'", $s->getLabel())->equals('my custom label'); }); }
/** * 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 setStatus(BaseActiveRecord $model, Status $status = null) { echo 'setStatus model <br/>'; $this->_status = $status != null ? $status->getId() : null; }