This repository was archived by the owner on Jan 21, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +30
-0
lines changed Expand file tree Collapse file tree 3 files changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -40,6 +40,7 @@ following traits into your test case:
40
40
- ` Zend\ContainerTest\AliasTestTrait ` - to support ` aliases ` configuration,
41
41
- ` Zend\ContainerTest\FactoryTestTrait ` - to support ` factories ` configuration,
42
42
- ` Zend\ContainerTest\InvokableTestTrait ` - to support ` invokables ` configuration,
43
+ - ` Zend\ContainerTest\ServiceTestTrait ` - to support ` services ` configuration,
43
44
- ` Zend\ContainerTest\SharedTestTrait ` - to support ` shared ` and ` shared_by_default ` configurations,
44
45
45
46
or use ` Zend\ContainerTest\AllTestTrait ` to support whole ` zend-servicemanager ` configuration.
Original file line number Diff line number Diff line change @@ -14,5 +14,6 @@ trait AllTestTrait
14
14
use AliasTestTrait;
15
15
use FactoryTestTrait;
16
16
use InvokableTestTrait;
17
+ use ServiceTestTrait;
17
18
use SharedTestTrait;
18
19
}
Original file line number Diff line number Diff line change
1
+ <?php
2
+ /**
3
+ * @see https://github.com/zendframework/zend-container-test for the canonical source repository
4
+ * @copyright Copyright (c) 2018 Zend Technologies USA Inc. (https://www.zend.com)
5
+ * @license https://github.com/zendframework/zend-container-test/blob/master/LICENSE.md New BSD License
6
+ */
7
+
8
+ declare (strict_types=1 );
9
+
10
+ namespace Zend \ContainerTest ;
11
+
12
+ trait ServiceTestTrait
13
+ {
14
+ public function testService ()
15
+ {
16
+ $ service = new TestAsset \Service ();
17
+ $ config = [
18
+ 'services ' => [
19
+ 'foo-bar ' => $ service ,
20
+ ],
21
+ ];
22
+
23
+ $ container = $ this ->createContainer ($ config );
24
+
25
+ self ::assertTrue ($ container ->has ('foo-bar ' ));
26
+ self ::assertSame ($ service , $ container ->get ('foo-bar ' ));
27
+ }
28
+ }
You can’t perform that action at this time.
0 commit comments