|
|
@@ -12,8 +12,8 @@ use App\Repository\Core\FileRepository;
|
|
|
use App\Service\Export\BaseExporter;
|
|
|
use App\Service\Export\Encoder\EncoderInterface;
|
|
|
use App\Service\Export\Model\ExportModelInterface;
|
|
|
+use App\Service\File\Storage\LocalStorage;
|
|
|
use App\Service\ServiceIterator\EncoderIterator;
|
|
|
-use App\Service\Storage\LocalStorage;
|
|
|
use Doctrine\ORM\EntityManagerInterface;
|
|
|
use PHPUnit\Framework\MockObject\MockObject;
|
|
|
use PHPUnit\Framework\TestCase;
|
|
|
@@ -39,7 +39,7 @@ class BaseExporterTest extends TestCase
|
|
|
private Environment $twig;
|
|
|
private EncoderIterator $encoderIterator;
|
|
|
private EntityManagerInterface $entityManager;
|
|
|
- private LocalStorage $storage;
|
|
|
+ private LocalStorage $localStorage;
|
|
|
private LoggerInterface $logger;
|
|
|
|
|
|
public function setUp(): void {
|
|
|
@@ -48,7 +48,7 @@ class BaseExporterTest extends TestCase
|
|
|
$this->twig = $this->getMockBuilder(Environment::class)->disableOriginalConstructor()->getMock();
|
|
|
$this->encoderIterator = $this->getMockBuilder(EncoderIterator::class)->disableOriginalConstructor()->getMock();
|
|
|
$this->entityManager = $this->getMockBuilder(EntityManagerInterface::class)->disableOriginalConstructor()->getMock();
|
|
|
- $this->storage = $this->getMockBuilder(LocalStorage::class)->disableOriginalConstructor()->getMock();
|
|
|
+ $this->localStorage = $this->getMockBuilder(LocalStorage::class)->disableOriginalConstructor()->getMock();
|
|
|
$this->logger = $this->getMockBuilder(LoggerInterface::class)->disableOriginalConstructor()->getMock();
|
|
|
}
|
|
|
|
|
|
@@ -56,7 +56,7 @@ class BaseExporterTest extends TestCase
|
|
|
{
|
|
|
$exporter = $this->getMockBuilder(TestableBaseExporter::class)
|
|
|
->setMethodsExcept([$method, 'setAccessRepository', 'setFileRepository', 'setTwig', 'setEncoderIterator',
|
|
|
- 'setEntityManager', 'setStorage', 'setLogger'])
|
|
|
+ 'setEntityManager', 'setLocalStorage', 'setLogger'])
|
|
|
->getMock();
|
|
|
|
|
|
$exporter->setAccessRepository($this->accessRepository);
|
|
|
@@ -64,7 +64,7 @@ class BaseExporterTest extends TestCase
|
|
|
$exporter->setTwig($this->twig);
|
|
|
$exporter->setEncoderIterator($this->encoderIterator);
|
|
|
$exporter->setEntityManager($this->entityManager);
|
|
|
- $exporter->setStorage($this->storage);
|
|
|
+ $exporter->setLocalStorage($this->localStorage);
|
|
|
$exporter->setLogger($this->logger);
|
|
|
|
|
|
return $exporter;
|
|
|
@@ -106,7 +106,7 @@ class BaseExporterTest extends TestCase
|
|
|
$file = $this->getMockBuilder(File::class)->disableOriginalConstructor()->getMock();
|
|
|
$this->fileRepository->method('find')->with(456, null, null)->willReturn($file);
|
|
|
|
|
|
- $this->storage->expects(self::once())->method('writeFile')->with($file, $data, $access);
|
|
|
+ $this->localStorage->expects(self::once())->method('writeFile')->with($file, $data, $access);
|
|
|
|
|
|
$exporter->export($exportRequest);
|
|
|
}
|
|
|
@@ -138,7 +138,7 @@ class BaseExporterTest extends TestCase
|
|
|
$file = $this->getMockBuilder(File::class)->disableOriginalConstructor()->getMock();
|
|
|
$exporter->expects(self::once())->method('prepareFile')->willReturn($file);
|
|
|
|
|
|
- $this->storage->expects(self::once())->method('writeFile')->with($file, $data, $access);
|
|
|
+ $this->localStorage->expects(self::once())->method('writeFile')->with($file, $data, $access);
|
|
|
|
|
|
$exporter->export($exportRequest);
|
|
|
}
|
|
|
@@ -155,7 +155,7 @@ class BaseExporterTest extends TestCase
|
|
|
|
|
|
$this->accessRepository->method('find')->with(123, null, null)->willReturn(null);
|
|
|
|
|
|
- $this->storage->expects(self::never())->method('writeFile');
|
|
|
+ $this->localStorage->expects(self::never())->method('writeFile');
|
|
|
|
|
|
$this->expectException(\RuntimeException::class);
|
|
|
$this->expectExceptionMessage('Unable to determine the user; abort.');
|
|
|
@@ -186,7 +186,7 @@ class BaseExporterTest extends TestCase
|
|
|
$access->method('getOrganization')->willReturn(null);
|
|
|
$this->accessRepository->method('find')->with(123, null, null)->willReturn($access);
|
|
|
|
|
|
- $this->storage->expects(self::never())->method('writeFile');
|
|
|
+ $this->localStorage->expects(self::never())->method('writeFile');
|
|
|
|
|
|
$this->expectException(\RuntimeException::class);
|
|
|
$this->expectExceptionMessage('Unable to determine the organization of the curent user; abort.');
|
|
|
@@ -212,7 +212,7 @@ class BaseExporterTest extends TestCase
|
|
|
|
|
|
$file = $this->getMockBuilder(File::class)->disableOriginalConstructor()->getMock();
|
|
|
|
|
|
- $this->storage->expects(self::once())
|
|
|
+ $this->localStorage->expects(self::once())
|
|
|
->method('prepareFile')
|
|
|
->with(
|
|
|
$access, 'Foo.pdf', FileTypeEnum::UNKNOWN(), $access, true, 'NOBODY', 'application/pdf', false
|