本文整理匯總了PHP中Zend\Di\Di::getDefinition方法的典型用法代碼示例。如果您正苦於以下問題:PHP Di::getDefinition方法的具體用法?PHP Di::getDefinition怎麽用?PHP Di::getDefinition使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Zend\Di\Di
的用法示例。
在下文中一共展示了Di::getDefinition方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: testConfigurationCanConfigureBuilderDefinitionFromIni
public function testConfigurationCanConfigureBuilderDefinitionFromIni()
{
$this->markTestIncomplete('Builder not updated to new DI yet');
$ini = new \Zend\Config\Ini(__DIR__ . '/_files/sample.ini', 'section-b');
$config = new Configuration($ini->di);
$di = new Di($config);
$definition = $di->getDefinition();
$this->assertTrue($definition->hasClass('My\DbAdapter'));
$this->assertEquals('__construct', $definition->getInstantiator('My\DbAdapter'));
$this->assertEquals(
array('username' => null, 'password' => null),
$definition->getInjectionMethodParameters('My\DbAdapter', '__construct')
);
$this->assertTrue($definition->hasClass('My\Mapper'));
$this->assertEquals('__construct', $definition->getInstantiator('My\Mapper'));
$this->assertEquals(
array('dbAdapter' => 'My\DbAdapter'),
$definition->getInjectionMethodParameters('My\Mapper', '__construct')
);
$this->assertTrue($definition->hasClass('My\Repository'));
$this->assertEquals('__construct', $definition->getInstantiator('My\Repository'));
$this->assertEquals(
array('mapper' => 'My\Mapper'),
$definition->getInjectionMethodParameters('My\Repository', '__construct')
);
}