This repository was archived by the owner on Jan 21, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change 9
9
10
10
namespace Zend \ContainerConfigTest ;
11
11
12
+ use ArgumentCountError ;
12
13
use Psr \Container \ContainerExceptionInterface ;
13
14
use Throwable ;
14
15
use TypeError ;
@@ -109,4 +110,28 @@ public function testFetchingInvokableThatHasRequiredConstructorParametersResults
109
110
110
111
$ this ->assertTrue ($ caught , 'No TypeError or ContainerExceptionInterface thrown when one was expected ' );
111
112
}
113
+
114
+ public function testFetchingInvalidInvokableServiceByAliasResultsInException ()
115
+ {
116
+ $ config = [
117
+ 'invokables ' => [
118
+ 'alias ' => TestAsset \FactoryWithRequiredParameters::class,
119
+ ],
120
+ ];
121
+
122
+ $ container = $ this ->createContainer ($ config );
123
+
124
+ self ::assertTrue ($ container ->has ('alias ' ));
125
+
126
+ $ caught = false ;
127
+ try {
128
+ $ container ->get ('alias ' );
129
+ } catch (Throwable $ e ) {
130
+ if ($ e instanceof ArgumentCountError || $ e instanceof ContainerExceptionInterface) {
131
+ $ caught = true ;
132
+ }
133
+ }
134
+
135
+ $ this ->assertTrue ($ caught , 'No ArgumentError or ContainerExceptionInterface thrown when one was expected ' );
136
+ }
112
137
}
You can’t perform that action at this time.
0 commit comments