8
8
namespace ZendTest \ServiceManager ;
9
9
10
10
use DateTime ;
11
- use Interop \Container \Exception \ContainerException ;
12
11
use PHPUnit \Framework \TestCase ;
13
12
use Psr \Container \ContainerInterface ;
14
13
use stdClass ;
15
- use Zend \ServiceManager \Exception \ServiceNotCreatedException ;
16
- use Zend \ServiceManager \Exception \ServiceNotFoundException ;
17
14
use Zend \ServiceManager \Factory \AbstractFactoryInterface ;
18
15
use Zend \ServiceManager \Factory \FactoryInterface ;
19
16
use Zend \ServiceManager \Factory \InvokableFactory ;
@@ -318,7 +315,7 @@ public function testResolvedAliasFromAbstractFactory()
318
315
$ abstractFactory = $ this ->createMock (AbstractFactoryInterface::class);
319
316
320
317
$ serviceManager = new SimpleServiceManager ([
321
- 'aliases ' => [
318
+ 'aliases ' => [
322
319
'Alias ' => 'ServiceName ' ,
323
320
],
324
321
'abstract_factories ' => [
@@ -327,26 +324,25 @@ public function testResolvedAliasFromAbstractFactory()
327
324
]);
328
325
329
326
$ abstractFactory
330
- ->expects ($ this -> any ())
327
+ ->expects (self :: any ())
331
328
->method ('canCreate ' )
332
329
->withConsecutive (
333
- [ $ this -> anything (), $ this -> equalTo ( 'Alias ' ) ],
334
- [ $ this -> anything (), $ this -> equalTo ( 'ServiceName ' ) ]
330
+ [self :: anything (), 'Alias ' ],
331
+ [self :: anything (), 'ServiceName ' ]
335
332
)
336
- ->will (self ::returnCallback (
337
- function ($ context , $ name ) {
338
- return $ name === 'ServiceName ' ;
339
- }
340
- ));
341
- $ this ->assertTrue ($ serviceManager ->has ('Alias ' ));
333
+ ->will (self ::returnCallback (function ($ context , $ name ) {
334
+ return $ name === 'ServiceName ' ;
335
+ }));
336
+
337
+ self ::assertTrue ($ serviceManager ->has ('Alias ' ));
342
338
}
343
339
344
340
public function testResolvedAliasNoMatchingAbstractFactoryReturnsFalse ()
345
341
{
346
342
$ abstractFactory = $ this ->createMock (AbstractFactoryInterface::class);
347
343
348
344
$ serviceManager = new SimpleServiceManager ([
349
- 'aliases ' => [
345
+ 'aliases ' => [
350
346
'Alias ' => 'ServiceName ' ,
351
347
],
352
348
'abstract_factories ' => [
@@ -355,13 +351,14 @@ public function testResolvedAliasNoMatchingAbstractFactoryReturnsFalse()
355
351
]);
356
352
357
353
$ abstractFactory
358
- ->expects ($ this -> any ())
354
+ ->expects (self :: any ())
359
355
->method ('canCreate ' )
360
356
->withConsecutive (
361
- [ $ this -> anything (), $ this -> equalTo ( 'Alias ' ) ],
362
- [ $ this -> anything (), $ this -> equalTo ( 'ServiceName ' ) ]
357
+ [self :: anything (), 'Alias ' ],
358
+ [self :: anything (), 'ServiceName ' ]
363
359
)
364
360
->willReturn (false );
365
- $ this ->assertFalse ($ serviceManager ->has ('Alias ' ));
361
+
362
+ self ::assertFalse ($ serviceManager ->has ('Alias ' ));
366
363
}
367
364
}
0 commit comments