public function testImport() { $this->loader->addConfig(__DIR__ . '/contextLoad.xml'); $bean = $this->context->getBeanDefinition('test9'); $this->assertNotNull($bean); $this->assertInstanceOf('\\org\\equinox\\ioc\\BeanDefinition', $bean); $this->assertEquals('TestClass9', $bean->getClassName()); }
public function testStaticProperty() { $this->loader->addConfig(__DIR__ . '/contextStaticProperty.xml'); $bean = $this->context->getBeanDefinition('test3'); $this->assertInstanceOf('\\org\\equinox\\ioc\\BeanDefinition', $bean); $properties = $bean->getProperties(); $this->assertInternalType('array', $properties); $this->assertEquals(4, count($properties)); $prop = new BeanProperty(); $expected = array(array('name' => 'prop1', 'value' => 'biloubila', 'ref' => null), array('name' => 'prop2', 'value' => '<bold>créée</bold>', 'ref' => null), array('name' => 'prop66', 'value' => null, 'ref' => 'otherBean'), array('name' => 'dataSource', 'value' => null, 'ref' => 'dsn')); for ($i = 0; $i < 4; $i++) { $prop = $properties[$i]; $this->assertInstanceOf('\\org\\equinox\\ioc\\BeanProperty', $prop); $this->assertEquals($expected[$i]['name'], $prop->getName()); $this->assertEquals($expected[$i]['value'], $prop->getValue()); $this->assertEquals($expected[$i]['ref'], $prop->getRef()); } }
/** * return the bean definined in parameter * @param $beanName String contain the id of the bean we want to get * @return Object : an instance of the bean * @throw Exception */ public function getBean($beanName) { $definition = $this->context->getBeanDefinition($beanName); return $this->getBeanInstance($definition); }