public function update(array $input)
{
if (!$this->valid($input)) {
return false;
}
DB::transaction(function () use($input) {
$this->user->update($input);
});
return true;
}
public function test_Should_FailToUpdateRole_When_ValidationFails() { $this->mockValidator->shouldReceive('with')->once()->andReturn($this->mockValidator); $this->mockValidator->shouldReceive('passes')->once()->andReturn(false); $form = new UserForm($this->mockValidator, $this->mockUserRepository); $result = $form->update([]); $this->assertFalse($result, 'Expected update to fail.'); }