/** * Gets user object * * @ApiDoc( * section="User management", * output={"class" = "Arkon\Bundle\UserBundle\Entity\User"}, * description="Gets user object", * statusCodes={ * 200="Return when successful", * 404="User not found", * } * ) * * @Rest\View() * @param int $id * @return User */ public function getUserAction($id) { $user = $this->useCase->getUser($id); if (!$user) { throw new NotFoundHttpException('User not found.'); } return $user; }
public function testGetUser() { $user = new User(); $this->repositoryMock->expects($this->once())->method('findById')->will($this->returnValue($user)); $this->assertSame($user, $this->useCase->getUser(1)); }