/** * @param $id * @return User * @throws UserNotFoundException */ public function userOfId($id) { $user = $this->userRepo->userOfId($id); if (!$user) { throw new UserNotFoundException($id); } return $user; }
/** * @test * @group userrepo */ public function should_return_null_when_not_found() { $user = $this->userRepo->userOfId(99999999); $this->assertNull($user); }