@@ -131,4 +131,26 @@ public function testExcludeAwareMethodsWithoutParameters()
131
131
$ this ->assertTrue ($ definition ->hasMethod ('ZendTest\Di\TestAsset\AwareClasses\B ' , 'setSomething ' ));
132
132
$ this ->assertFalse ($ definition ->hasMethod ('ZendTest\Di\TestAsset\AwareClasses\B ' , 'getSomething ' ));
133
133
}
134
+
135
+ public function testHasMethodParameters ()
136
+ {
137
+ $ definition = new CompilerDefinition ();
138
+ $ definition ->addDirectory (__DIR__ . '/../TestAsset/ConstructorInjection ' );
139
+ $ definition ->addDirectory (__DIR__ . '/../TestAsset/SetterInjection ' );
140
+ $ definition ->addDirectory (__DIR__ . '/../TestAsset/CompilerClasses ' );
141
+ $ definition ->compile ();
142
+
143
+ // constructor injection
144
+ $ this ->assertTrue ($ definition ->hasMethodParameters ('ZendTest\Di\TestAsset\ConstructorInjection\B ' , '__construct ' ));
145
+ // setter injection
146
+ $ this ->assertTrue ($ definition ->hasMethodParameters ('ZendTest\Di\TestAsset\SetterInjection\B ' , 'setA ' ));
147
+ // setter injection with method from derived class
148
+ $ this ->assertTrue ($ definition ->hasMethodParameters ('ZendTest\Di\TestAsset\CompilerClasses\D ' , 'setB ' ));
149
+ // class does not exist
150
+ $ this ->assertFalse ($ definition ->hasMethodParameters ('ZendTest\Di\TestAsset\ConstructorInjection\BB ' , '__construct ' ));
151
+ // method not existing
152
+ $ this ->assertFalse ($ definition ->hasMethodParameters ('ZendTest\Di\TestAsset\SetterInjection\B ' , 'setB ' ));
153
+ // method exists but has no parameters
154
+ $ this ->assertFalse ($ definition ->hasMethodParameters ('ZendTest\Di\TestAsset\SetterInjection\StaticSetter ' , 'setFoo ' ));
155
+ }
134
156
}
0 commit comments