Example #1
0
 public function testValidateFailsOnToStatus()
 {
     /** @var ActiveWorkflowBehavior|Item05 $model */
     $model = new Item05();
     $model->sendToStatus('Item05Workflow/new');
     $model->sendToStatus('Item05Workflow/correction');
     expect_that($model->getWorkflowStatus()->getId() == 'Item05Workflow/correction');
     $this->specify('model validation success on enter status "published" for attribute "author"', function () use($model) {
         $model->status = 'Item05Workflow/published';
         $model->tags = 'some tag';
         $model->author = null;
         verify('validation error', $model->validate())->false();
         verify('the model has errors', $model->hasErrors())->true();
         verify('the model has exactly one error', count($model->getErrors()) == 1)->true();
         verify('the correct error message is set', $model->getFirstError('author'))->equals('Author cannot be blank.');
     });
 }