Ejemplo n.º 1
0
 /**
  * @param HHPnet\Core\Application\Services\Videos\SaveVideo\SaveVideoRequest $request
  */
 public function it_is_not_possible_to_register_a_given_video_twice(SaveVideoRequest $request)
 {
     $request->videoServiceId()->willReturn('video_service_id');
     $request->videoService()->willReturn('video_service');
     $request->title()->willReturn('title');
     $request->description()->willReturn('description');
     $this->factory->getVideoEntity(null, 'video_service_id', 'video_service', 'title', 'description')->willReturn(true);
     $this->shouldThrow('\\DomainException')->during('execute', array($request));
 }
Ejemplo n.º 2
0
 /**
  * @param HHPnet\Core\Application\Services\Videos\SaveVideo\SaveVideoRequest $request
  *
  * @return HHPnet\Core\Application\Services\Videos\SaveVideo\SaveVideoResponse
  */
 public function execute(SaveVideoRequest $request)
 {
     try {
         $this->repository->getByVideoServiceId($request->videoServiceId(), $request->videoService());
         throw new \DomainException('Given video has been registered in our database');
     } catch (\UnexpectedValueException $e) {
     }
     $video = $this->repository->save($this->factory->getVideoEntity(null, $request->videoServiceId(), $request->videoService(), $request->title(), $request->description()));
     return new SaveVideoResponse($video);
 }