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

Public Member Functions

 testConstruction ()
 
 testRecursion ()
 
 testToCEnd ()
 

Detailed Description

Definition at line 24 of file LSTOCBuilderTest.php.

Member Function Documentation

◆ testConstruction()

LSTOCBuilderTest::testConstruction ( )

Definition at line 26 of file LSTOCBuilderTest.php.

26 : void
27 {
28 $cb = $this->createMock(LSControlBuilder::class);
29 $tb = new LSTOCBuilder($cb, '');
30 $this->assertEquals(
31 json_encode(["label" => "","command" => "","parameter" => null,"state" => null,"childs" => []]),
32 $tb->toJSON()
33 );
34 }
Class LSTOCBuilder.

◆ testRecursion()

LSTOCBuilderTest::testRecursion ( )

Definition at line 36 of file LSTOCBuilderTest.php.

36 : void
37 {
38 $cb = $this->createMock(LSControlBuilder::class);
39 $tb = new LSTOCBuilder($cb, '');
40 $tb
41 ->node('node1')
42 ->item('item1.1', 1)
43 ->item('item1.2', 2)
44 ->end()
45 ->item('item2', 3)
46 ->node('node3')
47 ->item('item3.1', 4)
48 ->node('node3.2', 5)
49 ->item('item3.2.1', 6)
50 ->end()
51 ->end()
52 ->end();
53
54 $expected = [
55 "label" => "","command" => "","parameter" => null,"state" => null,"childs" => [
56 ["label" => "node1","command" => "","parameter" => null,"state" => null,"childs" => [
57 ["label" => "item1.1","command" => "","parameter" => 1,"state" => null,"current" => false],
58 ["label" => "item1.2","command" => "","parameter" => 2,"state" => null,"current" => false]
59 ]],
60 ["label" => "item2","command" => "","parameter" => 3,"state" => null, "current" => false],
61 ["label" => "node3","command" => "","parameter" => null,"state" => null,"childs" => [
62 ["label" => "item3.1","command" => "","parameter" => 4,"state" => null,"current" => false],
63 ["label" => "node3.2","command" => "","parameter" => 5,"state" => null,"childs" => [
64 ["label" => "item3.2.1","command" => "","parameter" => 6,"state" => null,"current" => false]
65 ]
66 ]]]]];
67
68 $this->assertEquals(
69 json_encode($expected),
70 $tb->toJSON()
71 );
72 }

◆ testToCEnd()

LSTOCBuilderTest::testToCEnd ( )

Definition at line 74 of file LSTOCBuilderTest.php.

74 : void
75 {
76 $cb = $this->createMock(LSControlBuilder::class);
77 $tb = new LSTOCBuilder($cb, '');
78 $tb = $tb->end();
79 $this->assertInstanceOf(ControlBuilder::class, $tb);
80 }

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