Esempio n. 1
0
 public function testValidateSetErrorInElementIfThereAreErrorsAfterBuild()
 {
     $element = $this->mockTextElement();
     $element->shouldReceive('withError')->once()->andReturn($element);
     $element->shouldReceive('getValidationState')->andReturn('error');
     $element->shouldReceive('help')->once()->andReturn($element);
     $element->shouldReceive('getHelp')->once()->andReturn('bar');
     $errors = m::mock('Illuminate\\Support\\MessageBag');
     $errors->shouldReceive('first')->once()->andReturn(array('test' => 'bar2'));
     $this->events->shouldReceive('fire')->twice();
     $this->view->shouldReceive('make')->once();
     $this->fb->text('test');
     $this->fb->errors($errors);
     $this->fb->build();
     $this->assertSame('error', $this->fb->get('test')->getValidationState());
     $this->assertSame('bar', $this->fb->get('test')->getHelp());
 }