feat: dummy replacement pdf upload for environments other than prod
This commit is contained in:
@@ -14,6 +14,8 @@ use App\Entity\Upload;
|
||||
use App\Service\Pdf\InvoiceApprover;
|
||||
use App\Service\Pdf\InvoiceRenderer;
|
||||
use App\Service\Pdf\Pdf;
|
||||
use App\Service\Upload\UploadHandler;
|
||||
use PHPUnit\Framework\MockObject\MockObject;
|
||||
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
||||
use Symfony\Component\Filesystem\Filesystem;
|
||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
@@ -25,6 +27,7 @@ class InvoiceApproverTest extends WebTestCase
|
||||
private string $pdfPath;
|
||||
private string $origPath;
|
||||
private Filesystem $filesystem;
|
||||
private UploadHandler&MockObject $uploadHandler;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
@@ -35,6 +38,7 @@ class InvoiceApproverTest extends WebTestCase
|
||||
$this->pdfPath = $this->invoiceDir.'/test_approver_backup.pdf';
|
||||
$this->origPath = $this->invoiceDir.'/test_approver_backup.orig.pdf';
|
||||
$this->filesystem = new Filesystem();
|
||||
$this->uploadHandler = $this->createMock(UploadHandler::class);
|
||||
|
||||
$this->filesystem->mkdir($this->invoiceDir);
|
||||
}
|
||||
@@ -80,7 +84,7 @@ class InvoiceApproverTest extends WebTestCase
|
||||
$translator = $this->createMock(TranslatorInterface::class);
|
||||
|
||||
/** @var TranslatorInterface $translator */
|
||||
return new InvoiceApprover($translator, ['project_dir' => $this->projectDir]);
|
||||
return new InvoiceApprover($translator, ['project_dir' => $this->projectDir], $this->uploadHandler);
|
||||
}
|
||||
|
||||
private function createDispositionWithInvoicePdf(): Disposition
|
||||
@@ -130,6 +134,9 @@ class InvoiceApproverTest extends WebTestCase
|
||||
;
|
||||
$disposition->addDocument($invoice);
|
||||
|
||||
$this->uploadHandler->method('getResolvedUploadFilepath')->with($invoice)->willReturn($this->pdfPath);
|
||||
$this->uploadHandler->method('getUploadFilepath')->with($invoice)->willReturn($this->pdfPath);
|
||||
|
||||
return $disposition;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user