test enforced element levels

This commit is contained in:
Yisroel Baum 2026-08-11 22:48:53 +03:00
parent 0d102fcee0
commit 25495b6c4d
Signed by: yisroelbaum
GPG key ID: 0FA60884F75520A9
2 changed files with 100 additions and 36 deletions

View file

@ -4,6 +4,7 @@ namespace Tests\Unit\Element;
use App\Element\Element;
use App\Set\Set;
use App\Set\SetLevel;
use App\Shared\ValueObject\EmailAddress;
use App\User\User;
use PHPUnit\Framework\TestCase;
@ -22,19 +23,29 @@ class ElementTest extends TestCase
name: 'Bible',
creator: $creator,
);
$bookLevel = new SetLevel(
id: 31,
set: $set,
kind: 'book',
depth: 0,
);
$portionLevel = new SetLevel(
id: 32,
set: $set,
kind: 'portion',
depth: 1,
);
$parentElement = new Element(
id: 21,
name: 'Genesis',
kind: 'book',
set: $set,
level: $bookLevel,
parentElement: null,
position: 1,
);
$element = new Element(
id: 22,
name: 'Genesis',
kind: 'portion',
set: $set,
level: $portionLevel,
parentElement: $parentElement,
position: 2,
);
@ -42,6 +53,7 @@ class ElementTest extends TestCase
$this->assertSame(22, $element->getId());
$this->assertSame('Genesis', $element->getName());
$this->assertSame('portion', $element->getKind());
$this->assertSame($portionLevel, $element->getLevel());
$this->assertSame($set, $element->getSet());
$this->assertSame($parentElement, $element->getParentElement());
$this->assertSame(2, $element->getPosition());