@@ 64-88 (lines=25) @@ | ||
61 | $this->assertSame($mainMenu->reveal(), $builder->buildMenu([], [])); |
|
62 | } |
|
63 | ||
64 | public function testBuildMenuWithOptions(): void |
|
65 | { |
|
66 | $builder = new ConfigBuilder( |
|
67 | $this->factory->reveal(), |
|
68 | $this->translator->reveal() |
|
69 | ); |
|
70 | ||
71 | $mainMenu = $this->prophesize(ItemInterface::class); |
|
72 | ||
73 | $this->factory->createItem('main', [ |
|
74 | 'attributes' => [ |
|
75 | 'class' => 'nav', |
|
76 | ], |
|
77 | 'childrenAttributes' => [ |
|
78 | 'class' => 'nav nav-pills', |
|
79 | ], |
|
80 | 'foo' => 'bar', |
|
81 | ]) |
|
82 | ->willReturn($mainMenu) |
|
83 | ; |
|
84 | ||
85 | $this->assertSame($mainMenu->reveal(), $builder->buildMenu([], [ |
|
86 | 'foo' => 'bar', |
|
87 | ])); |
|
88 | } |
|
89 | ||
90 | public function testBuildMenuWithMenuAttributes(): void |
|
91 | { |
|
@@ 90-115 (lines=26) @@ | ||
87 | ])); |
|
88 | } |
|
89 | ||
90 | public function testBuildMenuWithMenuAttributes(): void |
|
91 | { |
|
92 | $builder = new ConfigBuilder( |
|
93 | $this->factory->reveal(), |
|
94 | $this->translator->reveal() |
|
95 | ); |
|
96 | ||
97 | $mainMenu = $this->prophesize(ItemInterface::class); |
|
98 | ||
99 | $this->factory->createItem('main', [ |
|
100 | 'attributes' => [ |
|
101 | 'class' => 'nav', |
|
102 | ], |
|
103 | 'childrenAttributes' => [ |
|
104 | 'attr-foo' => 'custom', |
|
105 | ], |
|
106 | ]) |
|
107 | ->willReturn($mainMenu) |
|
108 | ; |
|
109 | ||
110 | $this->assertSame($mainMenu->reveal(), $builder->buildMenu([ |
|
111 | 'attributes' => [ |
|
112 | 'attr-foo' => 'custom', |
|
113 | ], |
|
114 | ], [])); |
|
115 | } |
|
116 | ||
117 | public function testBuildMenuWithItems(): void |
|
118 | { |
@@ 27-38 (lines=12) @@ | ||
24 | $this->configBuilder = $this->prophesize(ConfigBuilderInterface::class); |
|
25 | } |
|
26 | ||
27 | public function testGet(): void |
|
28 | { |
|
29 | $menu = $this->prophesize(ItemInterface::class); |
|
30 | ||
31 | $this->configBuilder->buildMenu(['name' => 'foo'], ['a' => 'b'])->willReturn($menu); |
|
32 | ||
33 | $configProvider = new ConfigProvider($this->configBuilder->reveal(), [ |
|
34 | 'foo' => ['name' => 'foo'], |
|
35 | 'bar' => ['name' => 'bar'], |
|
36 | ]); |
|
37 | $this->assertSame($menu->reveal(), $configProvider->get('foo', ['a' => 'b'])); |
|
38 | } |
|
39 | ||
40 | public function testGetDoesNotExist(): void |
|
41 | { |