test shorter upload names

This commit is contained in:
Yisroel Baum 2026-06-02 16:37:35 +03:00
parent 1d9e2cff0a
commit bd38e350cf
Signed by: yisroelbaum
GPG key ID: 0FA60884F75520A9
4 changed files with 31 additions and 31 deletions

View file

@ -5,12 +5,12 @@ namespace Tests\Unit\Element\UseCases;
use App\Element\CreateElementDto;
use App\Element\Element;
use App\Element\UseCases\UpdateElement\UpdateDescription;
use App\Element\UseCases\UpdateElement\UpdateIconImageUrl;
use App\Element\UseCases\UpdateElement\UpdateElement;
use App\Element\UseCases\UpdateElement\UpdateElementIconImage;
use App\Element\UseCases\UpdateElement\UpdateElementPdf;
use App\Element\UseCases\UpdateElement\UpdateElementRequest;
use App\Element\UseCases\UpdateElement\UpdateIconImage;
use App\Element\UseCases\UpdateElement\UpdateIconImageUrl;
use App\Element\UseCases\UpdateElement\UpdatePdfPath;
use App\Element\UseCases\UpdateElement\UpdatePdf;
use App\Element\UseCases\UpdateElement\UpdateRichText;
use App\Element\UseCases\UpdateElement\UpdateTitle;
use App\Element\UseCases\UpdateElement\UpdateYoutubeUrl;
@ -40,11 +40,11 @@ class UpdateElementTest extends TestCase
new UpdateRichText($this->elementRepo),
new UpdatePdfPath($this->elementRepo),
new UpdateYoutubeUrl($this->elementRepo),
new UpdateElementIconImage(
new UpdateIconImage(
$this->elementRepo,
$this->fileUploader,
),
new UpdateElementPdf(
new UpdatePdf(
$this->elementRepo,
$this->fileUploader,
),

View file

@ -4,8 +4,8 @@ namespace Tests\Unit\Element\UseCases;
use App\Element\CreateElementDto;
use App\Element\Element;
use App\Element\UseCases\UpdateElement\UpdateElementIconImage;
use App\Element\UseCases\UpdateElement\UpdateElementIconImageRequest;
use App\Element\UseCases\UpdateElement\UpdateIconImage;
use App\Element\UseCases\UpdateElement\UpdateIconImageRequest;
use App\Exceptions\BadRequestException;
use App\Exceptions\NotFoundException;
use App\Set\Set as DomainSet;
@ -13,19 +13,19 @@ use Tests\Fakes\FakeElementRepository;
use Tests\Fakes\FakeFileUploader;
use Tests\TestCase;
class UpdateElementIconImageTest extends TestCase
class UpdateIconImageTest extends TestCase
{
private FakeElementRepository $elementRepository;
private FakeFileUploader $fileUploader;
private UpdateElementIconImage $useCase;
private UpdateIconImage $useCase;
protected function setUp(): void
{
$this->elementRepository = new FakeElementRepository();
$this->fileUploader = new FakeFileUploader();
$this->useCase = new UpdateElementIconImage(
$this->useCase = new UpdateIconImage(
$this->elementRepository,
$this->fileUploader,
);
@ -54,7 +54,7 @@ class UpdateElementIconImageTest extends TestCase
$element = $this->createElement();
$updatedElement = $this->useCase->execute(
new UpdateElementIconImageRequest(
new UpdateIconImageRequest(
...$this->imageArgs(),
id: $element->getId(),
)
@ -82,7 +82,7 @@ class UpdateElementIconImageTest extends TestCase
$this->expectExceptionMessage('id is required');
$this->useCase->execute(
new UpdateElementIconImageRequest(
new UpdateIconImageRequest(
...$this->imageArgs(),
id: null,
)
@ -95,7 +95,7 @@ class UpdateElementIconImageTest extends TestCase
$this->expectExceptionMessage('icon image is required');
$this->useCase->execute(
new UpdateElementIconImageRequest(
new UpdateIconImageRequest(
id: 1,
iconImageContents: null,
iconImageOriginalName: null,
@ -113,7 +113,7 @@ class UpdateElementIconImageTest extends TestCase
);
$this->useCase->execute(
new UpdateElementIconImageRequest(
new UpdateIconImageRequest(
id: 1,
iconImageContents: 'not-an-image',
iconImageOriginalName: 'icon.pdf',
@ -129,7 +129,7 @@ class UpdateElementIconImageTest extends TestCase
$this->expectExceptionMessage('icon image must be 5MB or smaller');
$this->useCase->execute(
new UpdateElementIconImageRequest(
new UpdateIconImageRequest(
id: 1,
iconImageContents: 'big',
iconImageOriginalName: 'icon.png',
@ -145,7 +145,7 @@ class UpdateElementIconImageTest extends TestCase
$this->expectExceptionMessage('Element not found');
$this->useCase->execute(
new UpdateElementIconImageRequest(
new UpdateIconImageRequest(
...$this->imageArgs(),
id: 999,
)

View file

@ -4,8 +4,8 @@ namespace Tests\Unit\Element\UseCases;
use App\Element\CreateElementDto;
use App\Element\Element;
use App\Element\UseCases\UpdateElement\UpdateElementPdf;
use App\Element\UseCases\UpdateElement\UpdateElementPdfRequest;
use App\Element\UseCases\UpdateElement\UpdatePdf;
use App\Element\UseCases\UpdateElement\UpdatePdfRequest;
use App\Exceptions\BadRequestException;
use App\Exceptions\NotFoundException;
use App\Set\Set as DomainSet;
@ -13,19 +13,19 @@ use Tests\Fakes\FakeElementRepository;
use Tests\Fakes\FakeFileUploader;
use Tests\TestCase;
class UpdateElementPdfTest extends TestCase
class UpdatePdfTest extends TestCase
{
private FakeElementRepository $elementRepository;
private FakeFileUploader $fileUploader;
private UpdateElementPdf $useCase;
private UpdatePdf $useCase;
protected function setUp(): void
{
$this->elementRepository = new FakeElementRepository();
$this->fileUploader = new FakeFileUploader();
$this->useCase = new UpdateElementPdf(
$this->useCase = new UpdatePdf(
$this->elementRepository,
$this->fileUploader,
);
@ -54,7 +54,7 @@ class UpdateElementPdfTest extends TestCase
$element = $this->createElement();
$updatedElement = $this->useCase->execute(
new UpdateElementPdfRequest(
new UpdatePdfRequest(
...$this->pdfArgs(),
id: $element->getId(),
)
@ -82,7 +82,7 @@ class UpdateElementPdfTest extends TestCase
$this->expectExceptionMessage('id is required');
$this->useCase->execute(
new UpdateElementPdfRequest(
new UpdatePdfRequest(
...$this->pdfArgs(),
id: null,
)
@ -95,7 +95,7 @@ class UpdateElementPdfTest extends TestCase
$this->expectExceptionMessage('pdf is required');
$this->useCase->execute(
new UpdateElementPdfRequest(
new UpdatePdfRequest(
id: 1,
pdfContents: null,
pdfOriginalName: null,
@ -111,7 +111,7 @@ class UpdateElementPdfTest extends TestCase
$this->expectExceptionMessage('pdf must be a pdf file');
$this->useCase->execute(
new UpdateElementPdfRequest(
new UpdatePdfRequest(
id: 1,
pdfContents: 'not-a-pdf',
pdfOriginalName: 'icon.png',
@ -127,7 +127,7 @@ class UpdateElementPdfTest extends TestCase
$this->expectExceptionMessage('pdf must be 10MB or smaller');
$this->useCase->execute(
new UpdateElementPdfRequest(
new UpdatePdfRequest(
id: 1,
pdfContents: 'big',
pdfOriginalName: 'baderech.pdf',
@ -143,7 +143,7 @@ class UpdateElementPdfTest extends TestCase
$this->expectExceptionMessage('Element not found');
$this->useCase->execute(
new UpdateElementPdfRequest(
new UpdatePdfRequest(
...$this->pdfArgs(),
id: 999,
)