ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
LSTOCBuilderTest Class Reference
+ Inheritance diagram for LSTOCBuilderTest:
+ Collaboration diagram for LSTOCBuilderTest:

Public Member Functions

 testConstruction ()
 
 testRecursion ()
 
 testToCEnd ()
 

Detailed Description

Definition at line 6 of file LSTOCBuilderTest.php.

Member Function Documentation

◆ testConstruction()

LSTOCBuilderTest::testConstruction ( )

Definition at line 8 of file LSTOCBuilderTest.php.

9 {
10 $cb = $this->createMock(LSControlBuilder::class);
11 $tb = new LSTOCBuilder($cb, '');
12 $this->assertEquals(
13 json_encode(["label" => "","command" => "","parameter" => null,"state" => null,"childs" => []]),
14 $tb->toJSON()
15 );
16 }
Class LSTOCBuilder.

◆ testRecursion()

LSTOCBuilderTest::testRecursion ( )

Definition at line 18 of file LSTOCBuilderTest.php.

19 {
20 $cb = $this->createMock(LSControlBuilder::class);
21 $tb = new LSTOCBuilder($cb, '');
22 $tb
23 ->node('node1')
24 ->item('item1.1', 1)
25 ->item('item1.2', 2)
26 ->end()
27 ->item('item2', 3)
28 ->node('node3')
29 ->item('item3.1', 4)
30 ->node('node3.2', 5)
31 ->item('item3.2.1', 6)
32 ->end()
33 ->end()
34 ->end();
35
36 $expected = [
37 "label" => "","command" => "","parameter" => null,"state" => null,"childs" => [
38 ["label" => "node1","command" => "","parameter" => null,"state" => null,"childs" => [
39 ["label" => "item1.1","command" => "","parameter" => 1,"state" => null],
40 ["label" => "item1.2","command" => "","parameter" => 2,"state" => null]
41 ]],
42 ["label" => "item2","command" => "","parameter" => 3,"state" => null],
43 ["label" => "node3","command" => "","parameter" => null,"state" => null,"childs" => [
44 ["label" => "item3.1","command" => "","parameter" => 4,"state" => null],
45 ["label" => "node3.2","command" => "","parameter" => 5,"state" => null,"childs" => [
46 ["label" => "item3.2.1","command" => "","parameter" => 6,"state" => null]
47 ]
48 ]]]]];
49
50 $this->assertEquals(
51 json_encode($expected),
52 $tb->toJSON()
53 );
54 }

◆ testToCEnd()

LSTOCBuilderTest::testToCEnd ( )

Definition at line 56 of file LSTOCBuilderTest.php.

57 {
58 $cb = $this->createMock(LSControlBuilder::class);
59 $tb = new LSTOCBuilder($cb, '');
60 $tb = $tb->end();
61 $this->assertInstanceOf(ControlBuilder::class, $tb);
62 }

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