|
145 | 145 |
|
146 | 146 | $config = $this->config; |
147 | 147 | unset($config['db']); |
148 | | - $container = Double::instance(['extends' => ServiceManager::class, 'methods' => '__construct']); |
149 | | - allow($container)->toReceive('get')->with('config') |
150 | | - ->andReturn($config); |
| 148 | + $container = new ServiceManager(); |
| 149 | + $container->setService('config', $config); |
151 | 150 |
|
152 | 151 | allow($container)->toReceive('has')->with(EntityManager::class)->andReturn(true); |
153 | 152 | $entityManager = Double::instance(['extends' => EntityManager::class, 'methods' => '__construct']); |
|
170 | 169 | ); |
171 | 170 |
|
172 | 171 | $logging = Double::instance(['extends' => Logging::class, 'methods' => '__construct']); |
173 | | - allow($container)->toReceive('get')->with(Logging::class) |
174 | | - ->andReturn($logging); |
| 172 | + $container->setService(Logging::class, $logging); |
175 | 173 |
|
176 | 174 | $renderer = Double::instance(['implements' => TemplateRendererInterface::class]); |
177 | 175 | allow($container)->toReceive('get')->with(TemplateRendererInterface::class) |
178 | 176 | ->andReturn($renderer); |
179 | 177 |
|
180 | | - expect($container->has('ErrorHeroModuleLogger'))->toBeFalsy(); |
181 | 178 | $actual = $this->factory($container); |
182 | 179 | expect($actual)->toBeAnInstanceOf(Mezzio::class); |
183 | | - expect($container->has('ErrorHeroModuleLogger'))->toBeTruthy(); |
184 | | - |
185 | 180 |
|
186 | 181 | }); |
187 | 182 |
|
188 | 183 | it('returns Mezzio Middleware instance without doctrine to laminas-db conversion', function () { |
189 | 184 |
|
190 | | - $container = Double::instance(['extends' => ServiceManager::class, 'methods' => '__construct']); |
191 | | - allow($container)->toReceive('get')->with('config') |
192 | | - ->andReturn($this->config); |
| 185 | + $container = new ServiceManager(); |
| 186 | + $container->setService('config', $this->config); |
193 | 187 |
|
194 | 188 | $logging = Double::instance(['extends' => Logging::class, 'methods' => '__construct']); |
195 | | - allow($container)->toReceive('get')->with(Logging::class) |
196 | | - ->andReturn($logging); |
| 189 | + $container->setService(Logging::class, $logging); |
197 | 190 |
|
198 | 191 | $renderer = Double::instance(['implements' => TemplateRendererInterface::class]); |
199 | | - allow($container)->toReceive('get')->with(TemplateRendererInterface::class) |
200 | | - ->andReturn($renderer); |
| 192 | + $container->setService(TemplateRendererInterface::class, $renderer); |
201 | 193 |
|
202 | 194 | $actual = $this->factory($container); |
203 | 195 | expect($actual)->toBeAnInstanceOf(Mezzio::class); |
|
0 commit comments