8 protected function setUp() : void
10 $this->ctrl_structure = new \ilCtrlStructure();
15 $this->ctrl_structure = $this->ctrl_structure
16 ->withClassScript(
"class1",
"file1")
17 ->withClassScript(
"class2",
"file2")
18 ->withClassScript(
"class3",
"file3")
19 ->withClassScript(
"class2",
"file2");
29 iterator_to_array($this->ctrl_structure->getClassScripts())
35 $this->expectException(\RuntimeException::class);
38 ->withClassScript(
"class1",
"file1")
39 ->withClassScript(
"class1",
"file2");
44 $this->ctrl_structure = $this->ctrl_structure
45 ->withClassChild(
"parent1",
"child1")
46 ->withClassChild(
"parent2",
"child2")
47 ->withClassChild(
"parent1",
"child3");
50 "parent1" => [
"child1",
"child3"],
51 "parent2" => [
"child2"]
56 iterator_to_array($this->ctrl_structure->getClassChildren())
69 "parent1" => [
"child1",
"child3"],
70 "parent2" => [
"child2"]
73 $ctrl_structure = new \ilCtrlStructure($scripts, $children);
77 iterator_to_array($ctrl_structure->getClassScripts())
82 iterator_to_array($ctrl_structure->getClassChildren())
94 $ctrl_structure = new \ilCtrlStructure($scripts, []);
96 $this->assertEquals(
"file1", $ctrl_structure->getClassScriptOf(
"class1"));
97 $this->assertEquals(
"file2", $ctrl_structure->getClassScriptOf(
"class2"));
98 $this->assertEquals(
"file3", $ctrl_structure->getClassScriptOf(
"class3"));
99 $this->assertSame(null, $ctrl_structure->getClassScriptOf(
"class4"));
testAddClassScriptPanicsOnDuplicate()