test pdf path removal
This commit is contained in:
parent
9bbabc7fa6
commit
28f4114def
3 changed files with 29 additions and 58 deletions
|
|
@ -92,7 +92,6 @@ class ElementsEndpointTest extends TestCase
|
|||
'richText' => '<p>A structured path for growth</p>',
|
||||
'shortPdfPath' => '/assets/pdfs/baderech.pdf',
|
||||
'longPdfPath' => '/assets/pdfs/baderech-long.pdf',
|
||||
'pdfPath' => '/assets/pdfs/baderech.pdf',
|
||||
'youtubeUrl' => $sampleYoutubeUrl,
|
||||
],
|
||||
]);
|
||||
|
|
@ -187,7 +186,6 @@ class ElementsEndpointTest extends TestCase
|
|||
'richText' => '<p>Updated rich text</p>',
|
||||
'shortPdfPath' => '/assets/pdfs/updated.pdf',
|
||||
'longPdfPath' => '/assets/pdfs/updated-long.pdf',
|
||||
'pdfPath' => '/assets/pdfs/updated.pdf',
|
||||
'youtubeUrl' => $sampleYoutubeUrl,
|
||||
],
|
||||
]);
|
||||
|
|
@ -203,7 +201,7 @@ class ElementsEndpointTest extends TestCase
|
|||
);
|
||||
}
|
||||
|
||||
public function testAuthenticatedUpdateAcceptsLegacyPdfPath(): void
|
||||
public function testAuthenticatedUpdateRejectsLegacyPdfPath(): void
|
||||
{
|
||||
$setRepository = app(SetRepository::class);
|
||||
$elementRepository = app(ElementRepository::class);
|
||||
|
|
@ -229,20 +227,10 @@ class ElementsEndpointTest extends TestCase
|
|||
'pdfPath' => '/assets/pdfs/legacy-updated.pdf',
|
||||
]);
|
||||
|
||||
$response->assertOk();
|
||||
$body = $response->json();
|
||||
$this->assertSame(
|
||||
'/assets/pdfs/legacy-updated.pdf',
|
||||
$body['element']['shortPdfPath'],
|
||||
);
|
||||
$this->assertSame(
|
||||
'/assets/pdfs/legacy-updated.pdf',
|
||||
$body['element']['pdfPath'],
|
||||
);
|
||||
$this->assertSame(
|
||||
'/assets/pdfs/baderech-long.pdf',
|
||||
$body['element']['longPdfPath'],
|
||||
);
|
||||
$response->assertBadRequest();
|
||||
$response->assertExactJson([
|
||||
'error' => 'nothing to update',
|
||||
]);
|
||||
}
|
||||
|
||||
public function testAuthenticatedUpdateClearsUploadedMedia(): void
|
||||
|
|
@ -282,7 +270,7 @@ class ElementsEndpointTest extends TestCase
|
|||
->postJson('/api/element/update', [
|
||||
'elementId' => $element->getId(),
|
||||
'iconImageUrl' => '',
|
||||
'pdfPath' => '',
|
||||
'shortPdfPath' => '',
|
||||
'longPdfPath' => '',
|
||||
]);
|
||||
|
||||
|
|
@ -291,7 +279,7 @@ class ElementsEndpointTest extends TestCase
|
|||
$this->assertNull($body['element']['iconImageUrl']);
|
||||
$this->assertNull($body['element']['shortPdfPath']);
|
||||
$this->assertNull($body['element']['longPdfPath']);
|
||||
$this->assertNull($body['element']['pdfPath']);
|
||||
$this->assertArrayNotHasKey('pdfPath', $body['element']);
|
||||
$updatedElement = $elementRepository->find($element->getId());
|
||||
$this->assertNotNull($updatedElement);
|
||||
$this->assertNull($updatedElement->getIconImageUrl());
|
||||
|
|
@ -461,10 +449,7 @@ class ElementsEndpointTest extends TestCase
|
|||
'/storage/element-pdfs/short/',
|
||||
$body['element']['shortPdfPath'],
|
||||
);
|
||||
$this->assertSame(
|
||||
$body['element']['shortPdfPath'],
|
||||
$body['element']['pdfPath'],
|
||||
);
|
||||
$this->assertArrayNotHasKey('pdfPath', $body['element']);
|
||||
$updatedElement = $elementRepository->find($element->getId());
|
||||
$this->assertNotNull($updatedElement);
|
||||
$updatedPdfPath = $updatedElement->getShortPdfPath();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue