public function testGetUserNumberWillReturnFoundEntities() { $user = new User(); $numbers = [(new PhoneNumber())->setId(100), (new PhoneNumber())->setId(200)]; $this->repositoryMock->expects($this->once())->method('findUserNumbers')->with($user)->will($this->returnValue($numbers)); $this->assertSame($numbers, $this->useCase->getUserNumbers($user)); }
public function testGetUserNumbersWillReturnNumbersFetchedFromUseCase() { $user = $this->createExampleUser(); $numbers = [(new PhoneNumber())->setId(100), (new PhoneNumber())->setId(200)]; $this->useCaseMock->expects($this->once())->method('getUserNumbers')->with($user)->will($this->returnValue($numbers)); $this->assertSame($numbers, $this->controller->getUserNumbersAction($user)); }
/** * Gets user phone number objects * * @ApiDoc( * section="Number management", * output={"class" = "array<Arkon\Bundle\PhoneBookBundle\Entity\PhoneNumber>"}, * description="Gets user phone number objects", * statusCodes={ * 200="Returned when successful", * 404={ * "User not found" * } * } * ) * * @ParamConverter("user", class="ArkonUserBundle:User") * @RestView() * @param User $user * @return PhoneNumber[] */ public function getUserNumbersAction(User $user) { return $this->useCase->getUserNumbers($user); }