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 testSaveModelNoChangeSuccess() { $this->specify('a model can be saved with status not set', function () { $model = new Item01(); $model->attachBehavior('workflow', ['class' => ActiveWorkflowBehavior::className(), 'defaultWorkflowId' => 'Workflow1']); expect('model is saved', $model->save())->true(); }); }
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(); }); }