36 : void
37 {
38 $cb = $this->createMock(LSControlBuilder::class);
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 }