public function testLoadIniFile()
 {
     $this->loader->addConfig(__DIR__ . '/contextLoad.xml');
     $this->assertEquals('value', $this->context->getIniValue('section.name'));
     $this->assertEquals(array('value1', 'value2'), $this->context->getIniValue('section.table'));
     $this->assertEquals('root', $this->context->getIniValue('db.login'));
     $this->assertEquals('', $this->context->getIniValue('db.password'));
 }
 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());
     }
 }
 /**
  * Load the application context Xml File, if a cache file name is provided
  * check if the context is in cache before loading 
  */
 public function loadContext($configFile, array $includePath, $cacheFile = null)
 {
     $cache = null;
     if ($cacheFile != null) {
         $cache = new \org\equinox\utils\cache\CacheFile();
         $cache->setFileName($cacheFile);
         $cache->load();
         $cachedContext = $cache->get('applicationContext');
         if ($cachedContext != null) {
             $this->context = $cachedContext;
             $this->context->initializeNotLazyBeans();
             return;
         }
     }
     $this->context = new ApplicationContext();
     $loader = new XmlContextLoader($this->context, $includePath);
     $loader->addConfig($configFile);
     if (!empty($cache)) {
         $cache->put('applicationContext', $this->context);
     }
     $this->context->initializeNotLazyBeans();
 }