test element pdf path
This commit is contained in:
parent
2c79ab64ad
commit
6c6b3ad257
6 changed files with 72 additions and 0 deletions
|
|
@ -49,6 +49,7 @@ class CreateElementTest extends TestCase
|
|||
title: 'Root',
|
||||
description: 'Root description',
|
||||
richText: '<p>Root rich text</p>',
|
||||
pdfPath: '/assets/pdfs/root.pdf',
|
||||
parentElementId: null,
|
||||
));
|
||||
|
||||
|
|
@ -56,6 +57,7 @@ class CreateElementTest extends TestCase
|
|||
$this->assertSame('Root', $element->getTitle());
|
||||
$this->assertSame('Root description', $element->getDescription());
|
||||
$this->assertSame('<p>Root rich text</p>', $element->getRichText());
|
||||
$this->assertSame('/assets/pdfs/root.pdf', $element->getPdfPath());
|
||||
$this->assertSame($set->getId(), $element->getSet()->getId());
|
||||
$this->assertNull($element->getParentElement());
|
||||
}
|
||||
|
|
@ -69,6 +71,7 @@ class CreateElementTest extends TestCase
|
|||
title: 'Root',
|
||||
description: 'Root description',
|
||||
richText: '<p>Root rich text</p>',
|
||||
pdfPath: null,
|
||||
parentElementId: null,
|
||||
)
|
||||
);
|
||||
|
|
@ -79,6 +82,7 @@ class CreateElementTest extends TestCase
|
|||
title: 'Child',
|
||||
description: 'Child description',
|
||||
richText: '<p>Child rich text</p>',
|
||||
pdfPath: '/assets/pdfs/child.pdf',
|
||||
parentElementId: $rootElement->getId(),
|
||||
)
|
||||
);
|
||||
|
|
@ -92,6 +96,10 @@ class CreateElementTest extends TestCase
|
|||
'<p>Child rich text</p>',
|
||||
$childElement->getRichText(),
|
||||
);
|
||||
$this->assertSame(
|
||||
'/assets/pdfs/child.pdf',
|
||||
$childElement->getPdfPath(),
|
||||
);
|
||||
$this->assertSame(
|
||||
$rootElement->getId(),
|
||||
$childElement->getParentElement()->getId(),
|
||||
|
|
@ -107,11 +115,29 @@ class CreateElementTest extends TestCase
|
|||
title: 'Root',
|
||||
description: null,
|
||||
richText: null,
|
||||
pdfPath: null,
|
||||
parentElementId: null,
|
||||
));
|
||||
|
||||
$this->assertSame('', $element->getDescription());
|
||||
$this->assertSame('', $element->getRichText());
|
||||
$this->assertNull($element->getPdfPath());
|
||||
}
|
||||
|
||||
public function testCreatesElementWithNullPdfPathWhenBlank(): void
|
||||
{
|
||||
$set = $this->createSet('Daily learning');
|
||||
|
||||
$element = $this->createElement->execute(new CreateElementRequest(
|
||||
setId: $set->getId(),
|
||||
title: 'Root',
|
||||
description: 'Root description',
|
||||
richText: '<p>Root rich text</p>',
|
||||
pdfPath: '',
|
||||
parentElementId: null,
|
||||
));
|
||||
|
||||
$this->assertNull($element->getPdfPath());
|
||||
}
|
||||
|
||||
public function testThrowsWhenSetIdMissing(): void
|
||||
|
|
@ -124,6 +150,7 @@ class CreateElementTest extends TestCase
|
|||
title: 'Root',
|
||||
description: 'Root description',
|
||||
richText: '<p>Root rich text</p>',
|
||||
pdfPath: null,
|
||||
parentElementId: null,
|
||||
));
|
||||
}
|
||||
|
|
@ -138,6 +165,7 @@ class CreateElementTest extends TestCase
|
|||
title: null,
|
||||
description: 'Root description',
|
||||
richText: '<p>Root rich text</p>',
|
||||
pdfPath: null,
|
||||
parentElementId: null,
|
||||
));
|
||||
}
|
||||
|
|
@ -152,6 +180,7 @@ class CreateElementTest extends TestCase
|
|||
title: 'Root',
|
||||
description: 'Root description',
|
||||
richText: '<p>Root rich text</p>',
|
||||
pdfPath: null,
|
||||
parentElementId: null,
|
||||
));
|
||||
}
|
||||
|
|
@ -170,6 +199,7 @@ class CreateElementTest extends TestCase
|
|||
title: 'Child',
|
||||
description: 'Child description',
|
||||
richText: '<p>Child rich text</p>',
|
||||
pdfPath: null,
|
||||
parentElementId: 99,
|
||||
));
|
||||
}
|
||||
|
|
@ -182,6 +212,7 @@ class CreateElementTest extends TestCase
|
|||
title: 'Root',
|
||||
description: 'Root description',
|
||||
richText: '<p>Root rich text</p>',
|
||||
pdfPath: null,
|
||||
parentElementId: null,
|
||||
));
|
||||
|
||||
|
|
@ -195,6 +226,7 @@ class CreateElementTest extends TestCase
|
|||
title: 'Another root',
|
||||
description: 'Another root description',
|
||||
richText: '<p>Another root rich text</p>',
|
||||
pdfPath: null,
|
||||
parentElementId: null,
|
||||
));
|
||||
}
|
||||
|
|
@ -209,6 +241,7 @@ class CreateElementTest extends TestCase
|
|||
title: 'Parent root',
|
||||
description: 'Parent root description',
|
||||
richText: '<p>Parent root rich text</p>',
|
||||
pdfPath: null,
|
||||
parentElementId: null,
|
||||
)
|
||||
);
|
||||
|
|
@ -223,6 +256,7 @@ class CreateElementTest extends TestCase
|
|||
title: 'Invalid child',
|
||||
description: 'Invalid child description',
|
||||
richText: '<p>Invalid child rich text</p>',
|
||||
pdfPath: null,
|
||||
parentElementId: $parentElement->getId(),
|
||||
));
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue