public function testDelete() { $mock = m::mock(); Sentry::shouldReceive('findUserById')->with(1)->once()->andReturn($mock); $mock->shouldReceive('delete')->once()->andReturn(true); $this->assertTrue($this->users->delete(1)); Sentry::shouldReceive('findUserById')->once()->andThrow('Cartalyst\\Sentry\\Users\\UserNotFoundException'); $this->assertFalse($this->users->delete(10)); $this->assertNotNull($this->users->getError()); }
/** * Remove the specified user from storage. * * @param int $id * @return Response */ public function destroy($id) { $this->users->delete($id); return Redirect::route('users.index'); }