Exemplo n.º 1
0
/**
 * @return \Elgg\Di\ServiceProvider
 * @access private
 */
function _elgg_services()
{
    static $provider;
    if (null === $provider) {
        $provider = _elgg_create_service_provider();
    }
    return $provider;
}
Exemplo n.º 2
0
 /**
  * Inspect instances in DI container to get correct classnames for
  * Database API.
  */
 public function setUp()
 {
     // Database class
     // Cannot user _elgg_services() because ElggEntityTest replace
     // the database instance with a mock.
     $db = _elgg_create_service_provider()->db;
     $this->dbClass = get_class($db);
     // Config class
     $reflectionClass = new ReflectionClass($db);
     $reflectionProperty = $reflectionClass->getProperty('config');
     if (method_exists($reflectionProperty, 'setAccessible')) {
         $reflectionProperty->setAccessible(true);
         $config = $reflectionProperty->getValue($db);
         $this->configClass = get_class($config);
     } else {
         $this->configClass = 'Elgg_Database_Config';
     }
 }