public function save(array $input)
{
if (!$this->valid($input)) {
return false;
}
return $this->server->create($input);
}
public function test_Should_FailToSave_When_ValidationFails() { $this->mockValidator->shouldReceive('with')->once()->andReturn($this->mockValidator); $this->mockValidator->shouldReceive('passes')->once()->andReturn(false); $form = new ServerForm($this->mockValidator, $this->mockServerRepository); $result = $form->save([]); $this->assertFalse($result, 'Expected save to fail.'); }