test element file routing

This commit is contained in:
Yisroel Baum 2026-06-14 23:05:45 +03:00
parent 14d2ce2284
commit 0d5783ba9c
Signed by: yisroelbaum
GPG key ID: 0FA60884F75520A9
14 changed files with 951 additions and 388 deletions

View file

@ -50,7 +50,8 @@ class CreateElementTest extends TestCase
description: 'Root description',
iconImageUrl: '/assets/root-icon.svg',
richText: '<p>Root rich text</p>',
pdfPath: '/assets/pdfs/root.pdf',
shortPdfPath: '/assets/pdfs/root.pdf',
longPdfPath: '/assets/pdfs/root-long.pdf',
youtubeUrl: 'https://www.youtube.com/watch?v=yHx-r4p6hHU&t=1s',
parentElementId: null,
));
@ -63,7 +64,14 @@ class CreateElementTest extends TestCase
$element->getIconImageUrl(),
);
$this->assertSame('<p>Root rich text</p>', $element->getRichText());
$this->assertSame('/assets/pdfs/root.pdf', $element->getPdfPath());
$this->assertSame(
'/assets/pdfs/root.pdf',
$element->getShortPdfPath(),
);
$this->assertSame(
'/assets/pdfs/root-long.pdf',
$element->getLongPdfPath(),
);
$this->assertSame(
'https://www.youtube.com/watch?v=yHx-r4p6hHU&t=1s',
$element->getYoutubeUrl(),
@ -82,7 +90,8 @@ class CreateElementTest extends TestCase
description: 'Root description',
iconImageUrl: null,
richText: '<p>Root rich text</p>',
pdfPath: null,
shortPdfPath: null,
longPdfPath: null,
youtubeUrl: null,
parentElementId: null,
)
@ -95,7 +104,8 @@ class CreateElementTest extends TestCase
description: 'Child description',
iconImageUrl: '/assets/child-icon.svg',
richText: '<p>Child rich text</p>',
pdfPath: '/assets/pdfs/child.pdf',
shortPdfPath: '/assets/pdfs/child.pdf',
longPdfPath: '/assets/pdfs/child-long.pdf',
youtubeUrl: 'https://youtu.be/yHx-r4p6hHU',
parentElementId: $rootElement->getId(),
)
@ -116,7 +126,11 @@ class CreateElementTest extends TestCase
);
$this->assertSame(
'/assets/pdfs/child.pdf',
$childElement->getPdfPath(),
$childElement->getShortPdfPath(),
);
$this->assertSame(
'/assets/pdfs/child-long.pdf',
$childElement->getLongPdfPath(),
);
$this->assertSame(
'https://youtu.be/yHx-r4p6hHU',
@ -138,7 +152,8 @@ class CreateElementTest extends TestCase
description: null,
iconImageUrl: null,
richText: null,
pdfPath: null,
shortPdfPath: null,
longPdfPath: null,
youtubeUrl: null,
parentElementId: null,
));
@ -146,7 +161,8 @@ class CreateElementTest extends TestCase
$this->assertSame('', $element->getDescription());
$this->assertNull($element->getIconImageUrl());
$this->assertSame('', $element->getRichText());
$this->assertNull($element->getPdfPath());
$this->assertNull($element->getShortPdfPath());
$this->assertNull($element->getLongPdfPath());
$this->assertNull($element->getYoutubeUrl());
}
@ -160,7 +176,8 @@ class CreateElementTest extends TestCase
description: 'Root description',
iconImageUrl: '',
richText: '<p>Root rich text</p>',
pdfPath: null,
shortPdfPath: null,
longPdfPath: null,
youtubeUrl: null,
parentElementId: null,
));
@ -168,7 +185,7 @@ class CreateElementTest extends TestCase
$this->assertNull($element->getIconImageUrl());
}
public function testCreatesElementWithNullPdfPathWhenBlank(): void
public function testCreatesElementWithNullPdfPathsWhenBlank(): void
{
$set = $this->createSet('Daily learning');
@ -178,12 +195,14 @@ class CreateElementTest extends TestCase
description: 'Root description',
iconImageUrl: null,
richText: '<p>Root rich text</p>',
pdfPath: '',
shortPdfPath: '',
longPdfPath: '',
youtubeUrl: null,
parentElementId: null,
));
$this->assertNull($element->getPdfPath());
$this->assertNull($element->getShortPdfPath());
$this->assertNull($element->getLongPdfPath());
}
public function testCreatesElementWithNullYoutubeUrlWhenBlank(): void
@ -196,7 +215,8 @@ class CreateElementTest extends TestCase
description: 'Root description',
iconImageUrl: null,
richText: '<p>Root rich text</p>',
pdfPath: null,
shortPdfPath: null,
longPdfPath: null,
youtubeUrl: '',
parentElementId: null,
));
@ -215,7 +235,8 @@ class CreateElementTest extends TestCase
description: 'Root description',
iconImageUrl: null,
richText: '<p>Root rich text</p>',
pdfPath: null,
shortPdfPath: null,
longPdfPath: null,
youtubeUrl: null,
parentElementId: null,
));
@ -232,7 +253,8 @@ class CreateElementTest extends TestCase
description: 'Root description',
iconImageUrl: null,
richText: '<p>Root rich text</p>',
pdfPath: null,
shortPdfPath: null,
longPdfPath: null,
youtubeUrl: null,
parentElementId: null,
));
@ -249,7 +271,8 @@ class CreateElementTest extends TestCase
description: 'Root description',
iconImageUrl: null,
richText: '<p>Root rich text</p>',
pdfPath: null,
shortPdfPath: null,
longPdfPath: null,
youtubeUrl: null,
parentElementId: null,
));
@ -270,7 +293,8 @@ class CreateElementTest extends TestCase
description: 'Child description',
iconImageUrl: null,
richText: '<p>Child rich text</p>',
pdfPath: null,
shortPdfPath: null,
longPdfPath: null,
youtubeUrl: null,
parentElementId: 99,
));
@ -285,7 +309,8 @@ class CreateElementTest extends TestCase
description: 'Root description',
iconImageUrl: null,
richText: '<p>Root rich text</p>',
pdfPath: null,
shortPdfPath: null,
longPdfPath: null,
youtubeUrl: null,
parentElementId: null,
));
@ -301,7 +326,8 @@ class CreateElementTest extends TestCase
description: 'Another root description',
iconImageUrl: null,
richText: '<p>Another root rich text</p>',
pdfPath: null,
shortPdfPath: null,
longPdfPath: null,
youtubeUrl: null,
parentElementId: null,
));
@ -318,7 +344,8 @@ class CreateElementTest extends TestCase
description: 'Parent root description',
iconImageUrl: null,
richText: '<p>Parent root rich text</p>',
pdfPath: null,
shortPdfPath: null,
longPdfPath: null,
youtubeUrl: null,
parentElementId: null,
)
@ -335,7 +362,8 @@ class CreateElementTest extends TestCase
description: 'Invalid child description',
iconImageUrl: null,
richText: '<p>Invalid child rich text</p>',
pdfPath: null,
shortPdfPath: null,
longPdfPath: null,
youtubeUrl: null,
parentElementId: $parentElement->getId(),
));