test set elements

This commit is contained in:
Yisroel Baum 2026-05-24 22:28:44 +03:00
parent 104909bcf5
commit db35a97910
Signed by: yisroelbaum
GPG key ID: 0FA60884F75520A9
6 changed files with 409 additions and 0 deletions

View file

@ -0,0 +1,33 @@
<?php
namespace Tests\Unit\Element;
use App\Element\Element;
use App\Set\Set as DomainSet;
use Tests\TestCase;
class ElementTest extends TestCase
{
public function testCreatesElementWithNullableParent(): void
{
$set = new DomainSet(1, 'Daily learning');
$rootElement = new Element(
id: 1,
title: 'Root',
set: $set,
parentElement: null,
);
$childElement = new Element(
id: 2,
title: 'Child',
set: $set,
parentElement: $rootElement,
);
$this->assertSame(2, $childElement->getId());
$this->assertSame('Child', $childElement->getTitle());
$this->assertSame($set, $childElement->getSet());
$this->assertSame($rootElement, $childElement->getParentElement());
$this->assertNull($rootElement->getParentElement());
}
}