本文整理汇总了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')
);
}