public function testAttachFails3() { $this->specify('the status attribute must exist in the owner model', function () { $model = new Item01(); $model->detachBehavior('workflow'); $model->attachBehavior('workflow', ['class' => SimpleWorkflowBehavior::className(), 'statusAttribute' => 'not_found']); }, ['throws' => 'yii\\base\\InvalidConfigException']); }
public function testConfiguredWorkflowId() { $this->specify('use the configured workflow Id', function () { $model = new Item01(); $model->attachBehavior('workflow', ['class' => SimpleWorkflowBehavior::className(), 'defaultWorkflowId' => 'myWorkflow']); expect('model should have workflow id set to "myWorkflow"', $model->getDefaultWorkflowId() == 'myWorkflow')->true(); }); }
public function testInitStatusAfterFindFails() { $this->specify('status initialisation success when saving model', function () { /** @var Item01|ActiveWorkflowBehavior $model */ $model = new Item01(); $model->detachBehavior('workflow'); $model->id = 1; $model->name = 'name'; $model->status = 'Workflow1/X'; $model->save(false); $this->setExpectedException('fproject\\workflow\\core\\WorkflowException', 'No status found with id Workflow1/X'); Item01::findOne(1); }); }