public function testSimpleInjection() { $di = new Di(); $di->getInjector()->resolveUnknownClass(true); $service = function (A $a, $suffix = '') { return $a->foo . $suffix; }; $baz = new Baz(); $this->assertEquals('this is foo', $di->call($service)); $this->assertEquals('this is foo meet baz', $di->call($service, array('suffix' => ' meet baz'))); $this->assertEquals('this is foo meet baz', $di->call(array($baz, 'helloBaz'))); }
/** * Call method with auto resolution. * * @param string $method * @param array $arguments * * @return mixed */ public function callMethod($method, array $arguments = array()) { return $this->di->call(array($this->service, $method), $arguments); }