public function testInitialise()
 {
     $apiData = ["urls" => [Photo::THUMBNAIL_STANDARD => 'standardUrl', Photo::THUMBNAIL_SMALL => 'smallUrl'], "tags" => ['uno', 'duo']];
     $photoDTO = new PhotoDTO($apiData['tags'], $apiData['urls']);
     $interactor = new AddPhoto($photoDTO, $this->repository);
     $photoId = $interactor->execute();
     $photoDTO->setId($photoId);
     $actual = $this->repository->findById($photoId);
     $this->assertEquals($photoDTO->getId(), $actual->getId());
 }
Exemple #2
0
 /**
  * @Route("/photos", name="api.photos.create")
  * @Method("POST")
  * @param Request $request
  * @return JsonResponse
  */
 public function createPhotoAction(Request $request)
 {
     $content = json_decode($request->getContent());
     $photoDTO = new PhotoDTO($content->tags, $content->urls);
     /** @var MongoDBPhotoRepository $photoRepository */
     $photoRepository = $this->get('freyr.gallery.repository.photo');
     $addPhotoInteractor = new AddPhoto($photoDTO, $photoRepository);
     $photoId = $addPhotoInteractor->execute();
     $photoDTO->setId($photoId);
     return new JsonResponse($photoDTO);
 }