| @@ 182-208 (lines=27) @@ | ||
| 179 | $loader->populate($container, $config); |
|
| 180 | } |
|
| 181 | ||
| 182 | public function testAddingAliasWithArgument() |
|
| 183 | { |
|
| 184 | $loader = new ContainerHydrator(); |
|
| 185 | ||
| 186 | $config = [ |
|
| 187 | 'TestInterface' => [ |
|
| 188 | 'class' => 'TestWithArguments', |
|
| 189 | 'arguments' => ['test', 'arguments'], |
|
| 190 | ], |
|
| 191 | ]; |
|
| 192 | ||
| 193 | $container = $this->getContainerMock(); |
|
| 194 | ||
| 195 | $definition = $this->getDefinitionMock(); |
|
| 196 | ||
| 197 | $definition->expects($this->once()) |
|
| 198 | ->method('withArguments') |
|
| 199 | ->with(['test', 'arguments']) |
|
| 200 | ->willReturn($definition); |
|
| 201 | ||
| 202 | $container->expects($this->once()) |
|
| 203 | ->method('add') |
|
| 204 | ->with('TestInterface', 'TestWithArguments', false) |
|
| 205 | ->willReturn($definition); |
|
| 206 | ||
| 207 | $loader->populate($container, $config); |
|
| 208 | } |
|
| 209 | ||
| 210 | ||
| 211 | public function testAddingAliasWithMethodCalls() |
|
| @@ 211-239 (lines=29) @@ | ||
| 208 | } |
|
| 209 | ||
| 210 | ||
| 211 | public function testAddingAliasWithMethodCalls() |
|
| 212 | { |
|
| 213 | $loader = new ContainerHydrator(); |
|
| 214 | ||
| 215 | $config = [ |
|
| 216 | 'TestInterface' => [ |
|
| 217 | 'class' => 'TestWithMethodCalls', |
|
| 218 | 'methods' => [ |
|
| 219 | 'setValue' => ['test value'], |
|
| 220 | ], |
|
| 221 | ], |
|
| 222 | ]; |
|
| 223 | ||
| 224 | $container = $this->getContainerMock(); |
|
| 225 | ||
| 226 | $definition = $this->getClassDefinitionMock(); |
|
| 227 | ||
| 228 | $definition->expects($this->once()) |
|
| 229 | ->method('withMethodCalls') |
|
| 230 | ->with(['setValue' => ['test value']]) |
|
| 231 | ->willReturn($definition); |
|
| 232 | ||
| 233 | $container->expects($this->once()) |
|
| 234 | ->method('add') |
|
| 235 | ->with('TestInterface', 'TestWithMethodCalls', false) |
|
| 236 | ->willReturn($definition); |
|
| 237 | ||
| 238 | $loader->populate($container, $config); |
|
| 239 | } |
|
| 240 | ||
| 241 | public function testAddingAliasWithArgumentsAndMethodCalls() |
|
| 242 | { |
|