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

@ -8,9 +8,9 @@ use App\Element\Element;
use App\Element\UseCases\GetElement\GetElement; use App\Element\UseCases\GetElement\GetElement;
use App\Element\UseCases\UpdateElement\UpdateDescription; use App\Element\UseCases\UpdateElement\UpdateDescription;
use App\Element\UseCases\UpdateElement\UpdateElement; use App\Element\UseCases\UpdateElement\UpdateElement;
use App\Element\UseCases\UpdateElement\UpdateElementIconImage; use App\Element\UseCases\UpdateElement\UpdateIconImage;
use App\Element\UseCases\UpdateElement\UpdateElementPdf;
use App\Element\UseCases\UpdateElement\UpdateIconImageUrl; use App\Element\UseCases\UpdateElement\UpdateIconImageUrl;
use App\Element\UseCases\UpdateElement\UpdatePdf;
use App\Element\UseCases\UpdateElement\UpdatePdfPath; use App\Element\UseCases\UpdateElement\UpdatePdfPath;
use App\Element\UseCases\UpdateElement\UpdateRichText; use App\Element\UseCases\UpdateElement\UpdateRichText;
use App\Element\UseCases\UpdateElement\UpdateTitle; use App\Element\UseCases\UpdateElement\UpdateTitle;
@ -42,11 +42,11 @@ class ElementControllerTest extends TestCase
new UpdateRichText($this->elementRepo), new UpdateRichText($this->elementRepo),
new UpdatePdfPath($this->elementRepo), new UpdatePdfPath($this->elementRepo),
new UpdateYoutubeUrl($this->elementRepo), new UpdateYoutubeUrl($this->elementRepo),
new UpdateElementIconImage( new UpdateIconImage(
$this->elementRepo, $this->elementRepo,
$this->fileUploader, $this->fileUploader,
), ),
new UpdateElementPdf( new UpdatePdf(
$this->elementRepo, $this->elementRepo,
$this->fileUploader, $this->fileUploader,
), ),

View file

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

View file

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

View file

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