ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
LSControlBuilderTest Class Reference
+ Inheritance diagram for LSControlBuilderTest:
+ Collaboration diagram for LSControlBuilderTest:

Public Member Functions

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

Detailed Description

Definition at line 13 of file LSControlBuilderTest.php.

Member Function Documentation

◆ setUp()

LSControlBuilderTest::setUp ( )

Definition at line 17 of file LSControlBuilderTest.php.

References $lang.

18  {
19  $ui_factory = $this->mockUIFactory();
20  $lang = $this->mockIlLanguage();
21 
22  $data_factory = new DataFactory();
23  $uri = $data_factory->uri('http://ilias.de/somepath');
24  $url_builder = new LSUrlBuilder($uri);
25  $settings = new LSGlobalSettings(12);
26 
27  $this->control_builder = new LSControlBuilder($ui_factory, $url_builder, $lang, $settings);
28  }
Global Settings of the Learning Sequence.
Class LSUrlBuilder.
Class LSControlBuilder.
for($i=1; $i<=count($kw_cases_sel); $i+=1) $lang
Definition: langwiz.php:349

◆ testConstruction()

LSControlBuilderTest::testConstruction ( )

Definition at line 30 of file LSControlBuilderTest.php.

31  {
32  $this->assertInstanceOf(ControlBuilder::class, $this->control_builder);
33  }

◆ testDone()

LSControlBuilderTest::testDone ( )

Definition at line 134 of file LSControlBuilderTest.php.

135  {
136  $cb = $this->control_builder->done('cmd', 1);
137  $this->assertInstanceOf(ControlBuilder::class, $cb);
138  $this->assertInstanceOf(Button\Primary::class, $cb->getDoneControl());
139  }

◆ testExit()

LSControlBuilderTest::testExit ( )

Definition at line 45 of file LSControlBuilderTest.php.

46  {
47  $cb = $this->control_builder->exit('cmd');
48  $this->assertInstanceOf(ControlBuilder::class, $cb);
49  $this->assertInstanceOf(Button\Shy::class, $cb->getExitControl());
50  }

◆ testGeneric()

LSControlBuilderTest::testGeneric ( )

Definition at line 118 of file LSControlBuilderTest.php.

119  {
120  $cb = $this->control_builder->generic('label', 'cmd', 1);
121  $this->assertInstanceOf(ControlBuilder::class, $cb);
122  $this->assertInstanceOf(Button\Standard::class, $cb->getControls()[0]);
123  }

◆ testInitialValues()

LSControlBuilderTest::testInitialValues ( )

Definition at line 35 of file LSControlBuilderTest.php.

36  {
37  $this->assertNull($this->control_builder->getExitControl());
38  $this->assertNull($this->control_builder->getNextControl());
39  $this->assertNull($this->control_builder->getPreviousControl());
40  $this->assertNull($this->control_builder->getDoneControl());
41  $this->assertEquals([], $this->control_builder->getControls());
42  $this->assertNull($this->control_builder->getToc());
43  }

◆ testLocator()

LSControlBuilderTest::testLocator ( )

Definition at line 160 of file LSControlBuilderTest.php.

161  {
162  $cb = $this->control_builder->locator('cmd');
163  $this->assertInstanceOf(LocatorBuilder::class, $cb);
164  }

◆ testMode()

LSControlBuilderTest::testMode ( )

Definition at line 153 of file LSControlBuilderTest.php.

154  {
155  $cb = $this->control_builder->mode('cmd', ['m1', 'm2']);
156  $this->assertInstanceOf(ControlBuilder::class, $cb);
157  $this->assertInstanceOf(ViewControl\Mode::class, $cb->getModeControls()[0]);
158  }

◆ testMultipleGeneric()

LSControlBuilderTest::testMultipleGeneric ( )

Definition at line 125 of file LSControlBuilderTest.php.

126  {
127  $cb = $this->control_builder
128  ->generic('label', 'cmd', 1)
129  ->generic('label', 'cmd', 2)
130  ->generic('label', 'cmd', 3);
131  $this->assertEquals(3, count($cb->getControls()));
132  }

◆ testNavigationControls()

LSControlBuilderTest::testNavigationControls ( )

Definition at line 65 of file LSControlBuilderTest.php.

66  {
67  $cb = $this->control_builder
68  ->previous('cmd', -1)
69  ->next('cmd', 1);
70  $this->assertInstanceOf(ControlBuilder::class, $cb);
71  $this->assertInstanceOf(Button\Standard::class, $cb->getPreviousControl());
72  $this->assertInstanceOf(Button\Standard::class, $cb->getNextControl());
73  }

◆ testToC()

LSControlBuilderTest::testToC ( )

Definition at line 99 of file LSControlBuilderTest.php.

100  {
101  $toc = $this->control_builder->tableOfContent('cmd', 'rootnode');
102  $this->assertInstanceOf(TOCBuilder::class, $toc);
103  $this->assertEquals($toc, $this->control_builder->getToc());
104  }

◆ testUniqueDone()

LSControlBuilderTest::testUniqueDone ( )

Definition at line 141 of file LSControlBuilderTest.php.

142  {
143  try {
144  $cb = $this->control_builder
145  ->done('cmd', 1)
146  ->done('cmd', 1);
147  $this->assertFalse("This should not happen");
148  } catch (\LogicException $e) {
149  $this->assertTrue(true);
150  }
151  }

◆ testUniqueExit()

LSControlBuilderTest::testUniqueExit ( )

Definition at line 52 of file LSControlBuilderTest.php.

53  {
54  try {
55  //must not be able to set a second exit-control
56  $cb = $this->control_builder
57  ->exit('cmd')
58  ->exit('cmd');
59  $this->assertFalse("This should not happen");
60  } catch (\LogicException $e) {
61  $this->assertTrue(true);
62  }
63  }

◆ testUniqueLocator()

LSControlBuilderTest::testUniqueLocator ( )

Definition at line 166 of file LSControlBuilderTest.php.

167  {
168  try {
169  $loc = $this->control_builder->locator('cmd')
170  ->end();
171  $loc = $this->control_builder->locator('cmd');
172  $this->assertFalse("This should not happen");
173  } catch (\LogicException $e) {
174  $this->assertTrue(true);
175  }
176  }

◆ testUniqueNext()

LSControlBuilderTest::testUniqueNext ( )

Definition at line 87 of file LSControlBuilderTest.php.

88  {
89  try {
90  $cb = $this->control_builder
91  ->next('cmd', 1)
92  ->next('cmd', 1);
93  $this->assertFalse("This should not happen");
94  } catch (\LogicException $e) {
95  $this->assertTrue(true);
96  }
97  }

◆ testUniquePrevious()

LSControlBuilderTest::testUniquePrevious ( )

Definition at line 75 of file LSControlBuilderTest.php.

76  {
77  try {
78  $cb = $this->control_builder
79  ->previous('cmd', 1)
80  ->previous('cmd', 1);
81  $this->assertFalse("This should not happen");
82  } catch (\LogicException $e) {
83  $this->assertTrue(true);
84  }
85  }

◆ testUniqueToC()

LSControlBuilderTest::testUniqueToC ( )

Definition at line 106 of file LSControlBuilderTest.php.

107  {
108  try {
109  $toc = $this->control_builder->tableOfContent('cmd', 'rootnode')
110  ->end();
111  $toc = $this->control_builder->tableOfContent('cmd', 'rootnode');
112  $this->assertFalse("This should not happen");
113  } catch (\LogicException $e) {
114  $this->assertTrue(true);
115  }
116  }

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