chore: upgrade phpunit to 12.5
This commit is contained in:
1 parent
da039d0527
commit
849da8d471
53 files changed
+832
-856
No files matched your search
@@ -12,10 +12,9 @@ use App\Entity\JobProfile;
|
||||
use App\Entity\Teamer;
|
||||
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 PHPUnit\Framework\MockObject\Stub;
|
||||
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
||||
use Symfony\Component\Filesystem\Filesystem;
|
||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
@@ -27,7 +26,7 @@ class InvoiceApproverTest extends WebTestCase
|
||||
private string $pdfPath;
|
||||
private string $origPath;
|
||||
private Filesystem $filesystem;
|
||||
private UploadHandler&MockObject $uploadHandler;
|
||||
private UploadHandler&Stub $uploadHandler;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
@@ -38,7 +37,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->uploadHandler = $this->createStub(UploadHandler::class);
|
||||
|
||||
$this->filesystem->mkdir($this->invoiceDir);
|
||||
}
|
||||
@@ -81,10 +80,7 @@ class InvoiceApproverTest extends WebTestCase
|
||||
|
||||
private function createApprover(): InvoiceApprover
|
||||
{
|
||||
$translator = $this->createMock(TranslatorInterface::class);
|
||||
|
||||
/** @var TranslatorInterface $translator */
|
||||
return new InvoiceApprover($translator, ['project_dir' => $this->projectDir], $this->uploadHandler);
|
||||
return new InvoiceApprover($this->createStub(TranslatorInterface::class), ['project_dir' => $this->projectDir], $this->uploadHandler);
|
||||
}
|
||||
|
||||
private function createDispositionWithInvoicePdf(): Disposition
|
||||
@@ -109,7 +105,7 @@ class InvoiceApproverTest extends WebTestCase
|
||||
$jobProfile->setName('Testprofil');
|
||||
$jobProfile->setCostUnit('200');
|
||||
|
||||
$assignment = $this->createMock(Assignment::class);
|
||||
$assignment = $this->createStub(Assignment::class);
|
||||
$assignment->method('getDestination')->willReturn($destination);
|
||||
$assignment->method('getJobProfile')->willReturn($jobProfile);
|
||||
|
||||
@@ -134,8 +130,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);
|
||||
$filepath = fn (Upload $upload): string => $invoice === $upload ? $this->pdfPath : throw new \LogicException('Unexpected upload');
|
||||
$this->uploadHandler->method('getResolvedUploadFilepath')->willReturnCallback($filepath);
|
||||
$this->uploadHandler->method('getUploadFilepath')->willReturnCallback($filepath);
|
||||
|
||||
return $disposition;
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ class InvoiceRendererTest extends WebTestCase
|
||||
public function testRendersInvoice(): void
|
||||
{
|
||||
$projectDir = static::getContainer()->getParameter('kernel.project_dir');
|
||||
$translator = $this->createMock(TranslatorInterface::class);
|
||||
$translator = $this->createStub(TranslatorInterface::class);
|
||||
/** @var TranslatorInterface $translator */
|
||||
$renderer = new InvoiceRenderer($translator, ['project_dir' => $projectDir]);
|
||||
|
||||
@@ -82,7 +82,7 @@ class InvoiceRendererTest extends WebTestCase
|
||||
->setEmail('[email protected]')
|
||||
;
|
||||
|
||||
$assignment = $this->createMock(Assignment::class);
|
||||
$assignment = $this->createStub(Assignment::class);
|
||||
$assignment->method('getId')->willReturn(1234);
|
||||
$assignment->method('getDestination')->willReturn($destination);
|
||||
$assignment->method('getJobProfile')->willReturn($jobProfile);
|
||||
@@ -108,9 +108,10 @@ class InvoiceRendererTest extends WebTestCase
|
||||
$disposition->addDocument($invoice);
|
||||
|
||||
$invoicePath = $projectDir.'/uploads/invoice/a/abcdef0123456789.pdf';
|
||||
$uploadHandler = $this->createMock(UploadHandler::class);
|
||||
$uploadHandler->method('getResolvedUploadFilepath')->with($invoice)->willReturn($invoicePath);
|
||||
$uploadHandler->method('getUploadFilepath')->with($invoice)->willReturn($invoicePath);
|
||||
$uploadHandler = $this->createStub(UploadHandler::class);
|
||||
$filepath = static fn (Upload $upload): string => $invoice === $upload ? $invoicePath : throw new \LogicException('Unexpected upload');
|
||||
$uploadHandler->method('getResolvedUploadFilepath')->willReturnCallback($filepath);
|
||||
$uploadHandler->method('getUploadFilepath')->willReturnCallback($filepath);
|
||||
|
||||
/** @var TranslatorInterface $translator */
|
||||
$approver = new InvoiceApprover($translator, ['project_dir' => $projectDir], $uploadHandler);
|
||||
|
||||
Reference in new issue
Block a user