コード例 #1
0
 function it_stops_the_upload_process_if_task_is_stopped(ImageProvider $imageProvider, Task $migrationTask, Logger $logger, Synchronizable $image1, Synchronizable $image2)
 {
     $image1->getFilename()->willReturn('/z/b/image1.jpg');
     $image2->getFilename()->willReturn('/invalid');
     $migrationTask->hasBeenStopped()->willReturn(false, true);
     $images = array($image1, $image2);
     $this->uploadImages($images);
     $imageProvider->upload('/catalog/media/z/b/image1.jpg')->shouldHaveBeenCalled();
     $image1->tagAsSynchronized()->shouldHaveBeenCalled();
     $imageProvider->upload('/catalog/media/r/b/image2.jpg')->shouldNotHaveBeenCalled();
     $image2->tagAsSynchronized()->shouldNotHaveBeenCalled();
     $logger->notice(sprintf(BatchUploader::MESSAGE_STATUS, 1))->shouldHaveBeenCalled();
 }
コード例 #2
0
 private function getAbsolutePath(Synchronizable $image)
 {
     return sprintf('%s%s', $this->baseMediaPath, $image->getFilename());
 }