test unified uploads

This commit is contained in:
Yisroel Baum 2026-06-02 16:06:59 +03:00
parent a2c3ffad8b
commit b6da71ecd2
Signed by: yisroelbaum
GPG key ID: 0FA60884F75520A9
6 changed files with 144 additions and 27 deletions

View file

@ -42,11 +42,6 @@ class ElementControllerTest extends TestCase
new UpdateRichText($this->elementRepo),
new UpdatePdfPath($this->elementRepo),
new UpdateYoutubeUrl($this->elementRepo),
$this->elementRepo,
);
$this->controller = new ElementController(
$getElement,
$updateElement,
new UpdateElementIconImage(
$this->elementRepo,
$this->fileUploader,
@ -55,6 +50,11 @@ class ElementControllerTest extends TestCase
$this->elementRepo,
$this->fileUploader,
),
$this->elementRepo,
);
$this->controller = new ElementController(
$getElement,
$updateElement,
$this->fileUploader,
);
}
@ -155,7 +155,7 @@ class ElementControllerTest extends TestCase
);
}
public function testUploadIconImageReturnsElementPayload(): void
public function testUpdateWithIconImageReturnsElementPayload(): void
{
$set = $this->createSet(1, 'Baderech');
$element = $this->createElement(
@ -168,9 +168,7 @@ class ElementControllerTest extends TestCase
null,
null,
);
$fixturePath = __DIR__
. '/../../../../frontend/rabbi_gerzi/public/assets/'
. 'baderech-haavodah-icon.png';
$fixturePath = __DIR__ . '/../../fixtures/icon.png';
$request = new Request([], [], [], [], [
'iconImage' => new UploadedFile(
$fixturePath,
@ -181,7 +179,7 @@ class ElementControllerTest extends TestCase
),
]);
$response = $this->controller->uploadIconImage(
$response = $this->controller->update(
$element->getId(),
$request,
);
@ -199,7 +197,7 @@ class ElementControllerTest extends TestCase
);
}
public function testUploadPdfReturnsElementPayload(): void
public function testUpdateWithPdfReturnsElementPayload(): void
{
$set = $this->createSet(1, 'Baderech');
$element = $this->createElement(
@ -212,9 +210,7 @@ class ElementControllerTest extends TestCase
null,
null,
);
$fixturePath = __DIR__
. '/../../../../frontend/rabbi_gerzi/public/assets/pdfs/'
. 'baderech.pdf';
$fixturePath = __DIR__ . '/../../fixtures/baderech.pdf';
$request = new Request([], [], [], [], [
'pdf' => new UploadedFile(
$fixturePath,
@ -225,7 +221,7 @@ class ElementControllerTest extends TestCase
),
]);
$response = $this->controller->uploadPdf(
$response = $this->controller->update(
$element->getId(),
$request,
);