ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
LSControlBuilderTest Class Reference
+ Inheritance diagram for LSControlBuilderTest:
+ Collaboration diagram for LSControlBuilderTest:

Public Member Functions

 testConstruction ()
 
 testInitialValues ()
 
 testExit ()
 
 testUniqueExit ()
 
 testNavigationControls ()
 
 testUniquePrevious ()
 
 testUniqueNext ()
 
 testToC ()
 
 testUniqueToC ()
 
 testGeneric ()
 
 testMultipleGeneric ()
 
 testDone ()
 
 testUniqueDone ()
 
 testMode ()
 
 testLocator ()
 
 testUniqueLocator ()
 

Protected Member Functions

 setUp ()
 

Protected Attributes

LSControlBuilder $control_builder
 

Detailed Description

Definition at line 31 of file LSControlBuilderTest.php.

Member Function Documentation

◆ setUp()

LSControlBuilderTest::setUp ( )
protected

Definition at line 37 of file LSControlBuilderTest.php.

37 : void
38 {
39 $ui_factory = $this->mockUIFactory();
40 $lang = $this->mockIlLanguage();
41
42 $data_factory = new DataFactory();
43 $uri = $data_factory->uri('https://ilias.de/somepath');
44 $url_builder = new LSUrlBuilder($uri);
45 $settings = new LSGlobalSettings(12);
46 $uri = $data_factory->uri('http://ilias.de/some/other/path');
47 $lp_url_builder = new LSUrlBuilder($uri);
48
49 $this->control_builder = new LSControlBuilder($ui_factory, $url_builder, $lang, $settings, $lp_url_builder);
50 }
Global Settings of the Learning Sequence.
$lang
Definition: xapiexit.php:25

References $lang.

◆ testConstruction()

LSControlBuilderTest::testConstruction ( )

Definition at line 52 of file LSControlBuilderTest.php.

52 : void
53 {
54 $this->assertInstanceOf(ControlBuilder::class, $this->control_builder);
55 }

◆ testDone()

LSControlBuilderTest::testDone ( )

Definition at line 156 of file LSControlBuilderTest.php.

156 : void
157 {
158 $cb = $this->control_builder->done('cmd', 1);
159 $this->assertInstanceOf(ControlBuilder::class, $cb);
160 $this->assertInstanceOf(Button\Primary::class, $cb->getDoneControl());
161 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: Bulky.php:21

◆ testExit()

LSControlBuilderTest::testExit ( )

Definition at line 67 of file LSControlBuilderTest.php.

67 : void
68 {
69 $cb = $this->control_builder->exit('cmd');
70 $this->assertInstanceOf(ControlBuilder::class, $cb);
71 $this->assertInstanceOf(Button\Bulky::class, $cb->getExitControl());
72 }

◆ testGeneric()

LSControlBuilderTest::testGeneric ( )

Definition at line 140 of file LSControlBuilderTest.php.

140 : void
141 {
142 $cb = $this->control_builder->generic('label', 'cmd', 1);
143 $this->assertInstanceOf(ControlBuilder::class, $cb);
144 $this->assertInstanceOf(Button\Standard::class, $cb->getControls()[0]);
145 }

◆ testInitialValues()

LSControlBuilderTest::testInitialValues ( )

Definition at line 57 of file LSControlBuilderTest.php.

57 : void
58 {
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());
65 }

◆ testLocator()

LSControlBuilderTest::testLocator ( )

Definition at line 182 of file LSControlBuilderTest.php.

182 : void
183 {
184 $cb = $this->control_builder->locator('cmd');
185 $this->assertInstanceOf(LocatorBuilder::class, $cb);
186 }

◆ testMode()

LSControlBuilderTest::testMode ( )

Definition at line 175 of file LSControlBuilderTest.php.

175 : void
176 {
177 $cb = $this->control_builder->mode('cmd', ['m1', 'm2']);
178 $this->assertInstanceOf(ControlBuilder::class, $cb);
179 $this->assertInstanceOf(ViewControl\Mode::class, $cb->getModeControls()[0]);
180 }

◆ testMultipleGeneric()

LSControlBuilderTest::testMultipleGeneric ( )

Definition at line 147 of file LSControlBuilderTest.php.

147 : void
148 {
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());
154 }

◆ testNavigationControls()

LSControlBuilderTest::testNavigationControls ( )

Definition at line 87 of file LSControlBuilderTest.php.

87 : void
88 {
89 $cb = $this->control_builder
90 ->previous('cmd', -1)
91 ->next('cmd', 1);
92 $this->assertInstanceOf(ControlBuilder::class, $cb);
93 $this->assertInstanceOf(Button\Standard::class, $cb->getPreviousControl());
94 $this->assertInstanceOf(Button\Standard::class, $cb->getNextControl());
95 }

◆ testToC()

LSControlBuilderTest::testToC ( )

Definition at line 121 of file LSControlBuilderTest.php.

121 : void
122 {
123 $toc = $this->control_builder->tableOfContent('cmd', 'rootnode');
124 $this->assertInstanceOf(TOCBuilder::class, $toc);
125 $this->assertEquals($toc, $this->control_builder->getToc());
126 }

◆ testUniqueDone()

LSControlBuilderTest::testUniqueDone ( )

Definition at line 163 of file LSControlBuilderTest.php.

163 : void
164 {
165 try {
166 $this->control_builder
167 ->done('cmd', 1)
168 ->done('cmd', 1);
169 $this->assertFalse("This should not happen");
170 } catch (LogicException $e) {
171 $this->assertTrue(true);
172 }
173 }

References Vendor\Package\$e.

◆ testUniqueExit()

LSControlBuilderTest::testUniqueExit ( )

Definition at line 74 of file LSControlBuilderTest.php.

74 : void
75 {
76 try {
77 //must not be able to set a second exit-control
78 $this->control_builder
79 ->exit('cmd')
80 ->exit('cmd');
81 $this->assertFalse("This should not happen");
82 } catch (LogicException $e) {
83 $this->assertTrue(true);
84 }
85 }

References Vendor\Package\$e.

◆ testUniqueLocator()

LSControlBuilderTest::testUniqueLocator ( )

Definition at line 188 of file LSControlBuilderTest.php.

188 : void
189 {
190 try {
191 $this->control_builder->locator('cmd')
192 ->end();
193 $this->control_builder->locator('cmd');
194 $this->assertFalse("This should not happen");
195 } catch (LogicException $e) {
196 $this->assertTrue(true);
197 }
198 }

References Vendor\Package\$e.

◆ testUniqueNext()

LSControlBuilderTest::testUniqueNext ( )

Definition at line 109 of file LSControlBuilderTest.php.

109 : void
110 {
111 try {
112 $this->control_builder
113 ->next('cmd', 1)
114 ->next('cmd', 1);
115 $this->assertFalse("This should not happen");
116 } catch (LogicException $e) {
117 $this->assertTrue(true);
118 }
119 }

References Vendor\Package\$e.

◆ testUniquePrevious()

LSControlBuilderTest::testUniquePrevious ( )

Definition at line 97 of file LSControlBuilderTest.php.

97 : void
98 {
99 try {
100 $this->control_builder
101 ->previous('cmd', 1)
102 ->previous('cmd', 1);
103 $this->assertFalse("This should not happen");
104 } catch (LogicException $e) {
105 $this->assertTrue(true);
106 }
107 }

References Vendor\Package\$e.

◆ testUniqueToC()

LSControlBuilderTest::testUniqueToC ( )

Definition at line 128 of file LSControlBuilderTest.php.

128 : void
129 {
130 try {
131 $this->control_builder->tableOfContent('cmd', 'rootnode')
132 ->end();
133 $this->control_builder->tableOfContent('cmd', 'rootnode');
134 $this->assertFalse("This should not happen");
135 } catch (LogicException $e) {
136 $this->assertTrue(true);
137 }
138 }

References Vendor\Package\$e.

Field Documentation

◆ $control_builder

LSControlBuilder LSControlBuilderTest::$control_builder
protected

Definition at line 35 of file LSControlBuilderTest.php.


The documentation for this class was generated from the following file: