function it_stops_the_migration_task_if_there_is_nothing_left_to_process(Task $migrationTask, SynchronizedMediaRepository $synchronizedMediaRepository, Logger $logger, BatchUploader $batchUploader)
 {
     $migrationTask->hasBeenStopped()->willReturn(false);
     $synchronizedMediaRepository->findUnsynchronisedImages()->willReturn(array());
     $logger->notice(Queue::MESSAGE_COMPLETE)->shouldBeCalled();
     $migrationTask->stop()->shouldBeCalled();
     $batchUploader->uploadImages(Argument::any())->shouldNotBeCalled();
     $this->process();
 }
 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();
 }