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

@ -122,7 +122,7 @@ class ElementsEndpointTest extends TestCase
parentElement: null,
));
$response = $this->patchJson("/api/elements/{$element->getId()}", [
$response = $this->postJson("/api/elements/{$element->getId()}", [
'title' => 'Updated title',
'description' => 'Updated description',
'iconImageUrl' => '/assets/updated-icon.png',
@ -162,7 +162,7 @@ class ElementsEndpointTest extends TestCase
$response = $this->withCredentials()
->withUnencryptedCookie('auth_token', 'valid-token')
->patchJson("/api/elements/{$element->getId()}", [
->postJson("/api/elements/{$element->getId()}", [
'title' => 'Updated title',
'description' => 'Updated description',
'iconImageUrl' => '/assets/updated-icon.png',
@ -212,7 +212,7 @@ class ElementsEndpointTest extends TestCase
));
$response = $this->post(
"/api/elements/{$element->getId()}/icon-image",
"/api/elements/{$element->getId()}",
['iconImage' => $this->iconImageUpload()],
);
@ -247,7 +247,7 @@ class ElementsEndpointTest extends TestCase
$response = $this->withCredentials()
->withUnencryptedCookie('auth_token', 'valid-token')
->post(
"/api/elements/{$element->getId()}/icon-image",
"/api/elements/{$element->getId()}",
['iconImage' => $this->iconImageUpload()],
);
@ -290,7 +290,7 @@ class ElementsEndpointTest extends TestCase
));
$response = $this->post(
"/api/elements/{$element->getId()}/pdf",
"/api/elements/{$element->getId()}",
['pdf' => $this->pdfUpload()],
);
@ -325,7 +325,7 @@ class ElementsEndpointTest extends TestCase
$response = $this->withCredentials()
->withUnencryptedCookie('auth_token', 'valid-token')
->post(
"/api/elements/{$element->getId()}/pdf",
"/api/elements/{$element->getId()}",
['pdf' => $this->pdfUpload()],
);
@ -369,9 +369,7 @@ class ElementsEndpointTest extends TestCase
private function iconImageUpload(): UploadedFile
{
$fixturePath = __DIR__
. '/../../../frontend/rabbi_gerzi/public/assets/'
. 'baderech-haavodah-icon.png';
$fixturePath = __DIR__ . '/../fixtures/icon.png';
return new UploadedFile(
$fixturePath,
@ -384,9 +382,7 @@ class ElementsEndpointTest extends TestCase
private function pdfUpload(): UploadedFile
{
$fixturePath = __DIR__
. '/../../../frontend/rabbi_gerzi/public/assets/pdfs/'
. 'baderech.pdf';
$fixturePath = __DIR__ . '/../fixtures/baderech.pdf';
return new UploadedFile(
$fixturePath,