| @@ 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 | static::assertSame($menu->reveal(), $configProvider->get('foo', ['a' => 'b'])); |
|
| 38 | } |
|
| 39 | ||
| 40 | public function testGetDoesNotExist(): void |
|
| 41 | { |
|
| @@ 53-77 (lines=25) @@ | ||
| 50 | static::assertSame($mainMenu->reveal(), $builder->buildMenu([], [])); |
|
| 51 | } |
|
| 52 | ||
| 53 | public function testBuildMenuWithOptions(): void |
|
| 54 | { |
|
| 55 | $builder = new ConfigBuilder( |
|
| 56 | $this->factory->reveal(), |
|
| 57 | $this->translator->reveal() |
|
| 58 | ); |
|
| 59 | ||
| 60 | $mainMenu = $this->prophesize(ItemInterface::class); |
|
| 61 | ||
| 62 | $this->factory->createItem('main', [ |
|
| 63 | 'attributes' => [ |
|
| 64 | 'class' => 'nav', |
|
| 65 | ], |
|
| 66 | 'childrenAttributes' => [ |
|
| 67 | 'class' => 'nav nav-pills', |
|
| 68 | ], |
|
| 69 | 'foo' => 'bar', |
|
| 70 | ]) |
|
| 71 | ->willReturn($mainMenu) |
|
| 72 | ; |
|
| 73 | ||
| 74 | static::assertSame($mainMenu->reveal(), $builder->buildMenu([], [ |
|
| 75 | 'foo' => 'bar', |
|
| 76 | ])); |
|
| 77 | } |
|
| 78 | ||
| 79 | public function testBuildMenuWithMenuAttributes(): void |
|
| 80 | { |
|
| @@ 79-104 (lines=26) @@ | ||
| 76 | ])); |
|
| 77 | } |
|
| 78 | ||
| 79 | public function testBuildMenuWithMenuAttributes(): void |
|
| 80 | { |
|
| 81 | $builder = new ConfigBuilder( |
|
| 82 | $this->factory->reveal(), |
|
| 83 | $this->translator->reveal() |
|
| 84 | ); |
|
| 85 | ||
| 86 | $mainMenu = $this->prophesize(ItemInterface::class); |
|
| 87 | ||
| 88 | $this->factory->createItem('main', [ |
|
| 89 | 'attributes' => [ |
|
| 90 | 'class' => 'nav', |
|
| 91 | ], |
|
| 92 | 'childrenAttributes' => [ |
|
| 93 | 'attr-foo' => 'custom', |
|
| 94 | ], |
|
| 95 | ]) |
|
| 96 | ->willReturn($mainMenu) |
|
| 97 | ; |
|
| 98 | ||
| 99 | static::assertSame($mainMenu->reveal(), $builder->buildMenu([ |
|
| 100 | 'attributes' => [ |
|
| 101 | 'attr-foo' => 'custom', |
|
| 102 | ], |
|
| 103 | ], [])); |
|
| 104 | } |
|
| 105 | ||
| 106 | public function testBuildMenuWithItems(): void |
|
| 107 | { |
|