/** * @test */ public function it_returns_validation_error_messages_as_array() { $data = array('hello', 'world'); $rules = array('bye', 'world'); $validator = m::mock('Illuminate\\Validation\\Factory'); $validation = m::mock(array('messages' => array('first' => 'hello'), 'passes' => true)); $instance = new GenericValidator($validator); $validator->shouldReceive('make')->with($data, $rules)->andReturn($validation); $instance = new GenericValidator($validator); $instance->runValidation($data, $rules); $this->assertInternalType('array', $instance->messages(), 'Does not return validation messages as array'); }
/** * @param Request $input [description] * @param Validator $validator [description] */ public function __construct(Request $input, Validator $validator) { parent::__construct($validator); $this->input = $input; if (!$this->defer) { $this->hydrate(); } }