19 declare(strict_types=1);
37 return new class ($md_id, $definition, ...$sub_elements) extends
BaseElement {
55 public function name():
string 73 $this->assertNull($root->getSuperElement());
74 $this->assertSame($root, $el2->getSuperElement());
76 $subs = $el2->getSubElements();
77 $this->assertSame($subs->current(), $el21);
79 $this->assertSame($subs->current(), $el22);
81 $this->assertNull($subs->current());
83 $this->assertSame($el2, $el21->getSuperElement());
84 $this->assertNull($el21->getSubElements()->current());
93 $cloned_root = clone $root;
94 $cloned_subs = $cloned_root->getSubElements();
95 $cloned_el = $cloned_subs->current();
96 $this->assertEquals($el1, $cloned_el);
97 $this->assertNotSame($el1, $cloned_el);
98 $this->assertSame($cloned_root, $cloned_el->getSuperElement());
100 $this->assertNull($cloned_subs->current());
102 $cloned_subs = $cloned_el->getSubElements();
103 $this->assertEquals($el11, $cloned_subs->current());
104 $this->assertNotSame($el11, $cloned_subs->current());
105 $this->assertSame($cloned_el, $cloned_subs->current()->getSuperElement());
106 $cloned_subs->next();
107 $this->assertNull($cloned_subs->current());
109 $cloned_el1 = clone $el1;
110 $this->assertNull($cloned_el1->getSuperElement());
117 $this->expectException(\ilMDElementsException::class);
126 $this->assertSame(NoID::ROOT, $root->getMDID());
127 $this->assertSame(13, $not_root->getMDID());
129 $this->assertTrue($root->isRoot());
130 $this->assertFalse($not_root->isRoot());
145 $this->assertSame($def, $el->getDefinition());
__construct()
Constructor setup ILIAS global object public.
__construct(Container $dic, ilPlugin $plugin)