|
240 | 240 | $config = $this->config; |
241 | 241 | unset($config['db']['adapters']); |
242 | 242 |
|
243 | | - foreach ($this->mapCreateContainers as $container) { |
| 243 | + foreach ($this->mapCreateContainers as $mapCreateContainer) { |
244 | 244 | $config['log']['ErrorHeroModuleLogger']['writers'][0]['options']['db'] = AdapterInterface::class; |
245 | | - if ($container instanceof AuraContainer) { |
| 245 | + if ($mapCreateContainer instanceof AuraContainer) { |
246 | 246 | $config = new ArrayObject($config); |
247 | 247 | } |
248 | 248 |
|
249 | | - allow($container)->toReceive('get')->with('config') |
| 249 | + allow($mapCreateContainer)->toReceive('get')->with('config') |
250 | 250 | ->andReturn($config); |
251 | | - if ($container instanceof AuraContainer) { |
| 251 | + if ($mapCreateContainer instanceof AuraContainer) { |
252 | 252 | $config = $config->getArrayCopy(); |
253 | 253 | } |
254 | 254 |
|
255 | | - allow($container)->toReceive('has')->with(EntityManager::class)->andReturn(false); |
| 255 | + allow($mapCreateContainer)->toReceive('has')->with(EntityManager::class)->andReturn(false); |
256 | 256 |
|
257 | 257 | $logging = Double::instance(['extends' => Logging::class, 'methods' => '__construct']); |
258 | | - allow($container)->toReceive('get')->with(Logging::class) |
| 258 | + allow($mapCreateContainer)->toReceive('get')->with(Logging::class) |
259 | 259 | ->andReturn($logging); |
260 | 260 |
|
261 | 261 | $renderer = Double::instance(['implements' => TemplateRendererInterface::class]); |
262 | | - allow($container)->toReceive('get')->with(TemplateRendererInterface::class) |
| 262 | + allow($mapCreateContainer)->toReceive('get')->with(TemplateRendererInterface::class) |
263 | 263 | ->andReturn($renderer); |
264 | 264 |
|
265 | | - expect($container->has('ErrorHeroModuleLogger'))->toBeFalsy(); |
266 | | - $actual = $this->factory($container); |
| 265 | + expect($mapCreateContainer->has('ErrorHeroModuleLogger'))->toBeFalsy(); |
| 266 | + $actual = $this->factory($mapCreateContainer); |
267 | 267 | expect($actual)->toBeAnInstanceOf(Mezzio::class); |
268 | | - expect($container->has('ErrorHeroModuleLogger'))->toBeTruthy(); |
| 268 | + expect($mapCreateContainer->has('ErrorHeroModuleLogger'))->toBeTruthy(); |
269 | 269 | } |
270 | 270 |
|
271 | 271 | }); |
272 | 272 |
|
273 | 273 | it('returns Mezzio Middleware instance with create service first for mapped containers and db name found in adapters', function (): void { |
274 | 274 |
|
275 | | - foreach ($this->mapCreateContainers as $container) { |
| 275 | + foreach ($this->mapCreateContainers as $mapCreateContainer) { |
276 | 276 | $config = $this->config; |
277 | 277 | $config['log']['ErrorHeroModuleLogger']['writers'][0]['options']['db'] = 'my-adapter'; |
278 | | - if ($container instanceof AuraContainer) { |
| 278 | + if ($mapCreateContainer instanceof AuraContainer) { |
279 | 279 | $config = new ArrayObject($config); |
280 | 280 | } |
281 | 281 |
|
282 | | - allow($container)->toReceive('get')->with('config') |
| 282 | + allow($mapCreateContainer)->toReceive('get')->with('config') |
283 | 283 | ->andReturn($config); |
284 | | - if ($container instanceof AuraContainer) { |
| 284 | + if ($mapCreateContainer instanceof AuraContainer) { |
285 | 285 | $config = $config->getArrayCopy(); |
286 | 286 | } |
287 | 287 |
|
288 | | - allow($container)->toReceive('has')->with(EntityManager::class)->andReturn(false); |
| 288 | + allow($mapCreateContainer)->toReceive('has')->with(EntityManager::class)->andReturn(false); |
289 | 289 |
|
290 | 290 | $logging = Double::instance(['extends' => Logging::class, 'methods' => '__construct']); |
291 | | - allow($container)->toReceive('get')->with(Logging::class) |
| 291 | + allow($mapCreateContainer)->toReceive('get')->with(Logging::class) |
292 | 292 | ->andReturn($logging); |
293 | 293 |
|
294 | 294 | $renderer = Double::instance(['implements' => TemplateRendererInterface::class]); |
295 | | - allow($container)->toReceive('get')->with(TemplateRendererInterface::class) |
| 295 | + allow($mapCreateContainer)->toReceive('get')->with(TemplateRendererInterface::class) |
296 | 296 | ->andReturn($renderer); |
297 | 297 |
|
298 | | - expect($container->has('ErrorHeroModuleLogger'))->toBeFalsy(); |
299 | | - $actual = $this->factory($container); |
| 298 | + expect($mapCreateContainer->has('ErrorHeroModuleLogger'))->toBeFalsy(); |
| 299 | + $actual = $this->factory($mapCreateContainer); |
300 | 300 | expect($actual)->toBeAnInstanceOf(Mezzio::class); |
301 | | - expect($container->has('ErrorHeroModuleLogger'))->toBeTruthy(); |
| 301 | + expect($mapCreateContainer->has('ErrorHeroModuleLogger'))->toBeTruthy(); |
302 | 302 | } |
303 | 303 |
|
304 | 304 | }); |
305 | 305 |
|
306 | 306 | it('returns Mezzio Middleware instance with create services first for mapped containers and db name not found in adapters, which means use "Laminas\Db\Adapter\Adapter" name', function (): void { |
307 | 307 |
|
308 | 308 | $config = $this->config; |
309 | | - foreach ($this->mapCreateContainers as $container) { |
310 | | - if ($container instanceof AuraContainer) { |
| 309 | + foreach ($this->mapCreateContainers as $mapCreateContainer) { |
| 310 | + if ($mapCreateContainer instanceof AuraContainer) { |
311 | 311 | $config = new ArrayObject($config); |
312 | 312 | } |
313 | 313 |
|
314 | | - allow($container)->toReceive('get')->with('config') |
| 314 | + allow($mapCreateContainer)->toReceive('get')->with('config') |
315 | 315 | ->andReturn($config); |
316 | | - if ($container instanceof AuraContainer) { |
| 316 | + if ($mapCreateContainer instanceof AuraContainer) { |
317 | 317 | $config = $config->getArrayCopy(); |
318 | 318 | } |
319 | 319 |
|
320 | | - allow($container)->toReceive('has')->with(EntityManager::class)->andReturn(false); |
| 320 | + allow($mapCreateContainer)->toReceive('has')->with(EntityManager::class)->andReturn(false); |
321 | 321 |
|
322 | 322 | $logging = Double::instance(['extends' => Logging::class, 'methods' => '__construct']); |
323 | | - allow($container)->toReceive('get')->with(Logging::class) |
| 323 | + allow($mapCreateContainer)->toReceive('get')->with(Logging::class) |
324 | 324 | ->andReturn($logging); |
325 | 325 |
|
326 | 326 | $renderer = Double::instance(['implements' => TemplateRendererInterface::class]); |
327 | | - allow($container)->toReceive('get')->with(TemplateRendererInterface::class) |
| 327 | + allow($mapCreateContainer)->toReceive('get')->with(TemplateRendererInterface::class) |
328 | 328 | ->andReturn($renderer); |
329 | 329 |
|
330 | | - expect($container->has('ErrorHeroModuleLogger'))->toBeFalsy(); |
331 | | - $actual = $this->factory($container); |
| 330 | + expect($mapCreateContainer->has('ErrorHeroModuleLogger'))->toBeFalsy(); |
| 331 | + $actual = $this->factory($mapCreateContainer); |
332 | 332 | expect($actual)->toBeAnInstanceOf(Mezzio::class); |
333 | | - expect($container->has('ErrorHeroModuleLogger'))->toBeTruthy(); |
| 333 | + expect($mapCreateContainer->has('ErrorHeroModuleLogger'))->toBeTruthy(); |
334 | 334 | } |
335 | 335 |
|
336 | 336 | }); |
|
0 commit comments