19 declare(strict_types=1);
29 require_once(
'IliasMocks.php');
37 protected function setUp(): void
39 $ui_factory = $this->mockUIFactory();
40 $lang = $this->mockIlLanguage();
43 $uri = $data_factory->uri(
'https://ilias.de/somepath');
46 $uri = $data_factory->uri(
'http://ilias.de/some/other/path');
49 $this->control_builder =
new LSControlBuilder($ui_factory, $url_builder,
$lang, $settings, $lp_url_builder);
54 $this->assertInstanceOf(ControlBuilder::class, $this->control_builder);
59 $this->assertNull($this->control_builder->getExitControl());
60 $this->assertNull($this->control_builder->getNextControl());
61 $this->assertNull($this->control_builder->getPreviousControl());
62 $this->assertNull($this->control_builder->getDoneControl());
63 $this->assertEquals([], $this->control_builder->getControls());
64 $this->assertNull($this->control_builder->getToc());
69 $cb = $this->control_builder->exit(
'cmd');
70 $this->assertInstanceOf(ControlBuilder::class, $cb);
71 $this->assertInstanceOf(
Button\Bulky::class, $cb->getExitControl());
78 $this->control_builder
81 $this->assertFalse(
"This should not happen");
83 $this->assertTrue(
true);
89 $cb = $this->control_builder
92 $this->assertInstanceOf(ControlBuilder::class, $cb);
93 $this->assertInstanceOf(
Button\Standard::class, $cb->getPreviousControl());
94 $this->assertInstanceOf(
Button\Standard::class, $cb->getNextControl());
100 $this->control_builder
102 ->previous(
'cmd', 1);
103 $this->assertFalse(
"This should not happen");
105 $this->assertTrue(
true);
112 $this->control_builder
115 $this->assertFalse(
"This should not happen");
117 $this->assertTrue(
true);
123 $toc = $this->control_builder->tableOfContent(
'cmd',
'rootnode');
124 $this->assertInstanceOf(TOCBuilder::class, $toc);
125 $this->assertEquals($toc, $this->control_builder->getToc());
131 $this->control_builder->tableOfContent(
'cmd',
'rootnode')
133 $this->control_builder->tableOfContent(
'cmd',
'rootnode');
134 $this->assertFalse(
"This should not happen");
136 $this->assertTrue(
true);
142 $cb = $this->control_builder->generic(
'label',
'cmd', 1);
143 $this->assertInstanceOf(ControlBuilder::class, $cb);
144 $this->assertInstanceOf(
Button\Standard::class, $cb->getControls()[0]);
149 $cb = $this->control_builder
150 ->generic(
'label',
'cmd', 1)
151 ->generic(
'label',
'cmd', 2)
152 ->generic(
'label',
'cmd', 3);
153 $this->assertCount(3, $cb->getControls());
158 $cb = $this->control_builder->done(
'cmd', 1);
159 $this->assertInstanceOf(ControlBuilder::class, $cb);
160 $this->assertInstanceOf(
Button\Primary::class, $cb->getDoneControl());
166 $this->control_builder
169 $this->assertFalse(
"This should not happen");
171 $this->assertTrue(
true);
177 $cb = $this->control_builder->mode(
'cmd', [
'm1',
'm2']);
178 $this->assertInstanceOf(ControlBuilder::class, $cb);
179 $this->assertInstanceOf(
ViewControl\Mode::class, $cb->getModeControls()[0]);
184 $cb = $this->control_builder->locator(
'cmd');
185 $this->assertInstanceOf(LocatorBuilder::class, $cb);
191 $this->control_builder->locator(
'cmd')
193 $this->control_builder->locator(
'cmd');
194 $this->assertFalse(
"This should not happen");
196 $this->assertTrue(
true);
Global Settings of the Learning Sequence.
LSControlBuilder $control_builder
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...