public function testExecutePreValidations() { // reset fake calls FakeProcessListener::$call = 0; $model = new FakeModel(); $this->modelStorage->newModelStateSuccess($model, 'document_proccess', 'step_create_doc'); $modelState = $this->getProcessHandler()->reachNextState($model, 'validate_with_pre_validation'); $this->assertTrue($modelState->getSuccessful()); $this->assertEquals('step_validate_doc', $modelState->getStepName()); $this->assertEquals(0, FakeProcessListener::$call); $model = new FakeModel(); $this->modelStorage->newModelStateSuccess($model, 'document_proccess', 'step_create_doc'); $modelState = $this->getProcessHandler()->reachNextState($model, 'validate_with_pre_validation_invalid'); $this->assertFalse($modelState->getSuccessful()); $this->assertEquals(array('Validation error!'), $modelState->getErrors()); $this->assertEquals(1, FakeProcessListener::$call); }
/** * {@inheritdoc} */ public function getAllStates(ModelInterface $model, $successOnly = true) { return $this->storage->findAllModelStates($model, $this->process->getName(), $successOnly); }