コード例 #1
0
 /**
  * @covers MaglLegacyApplication\Module::getControllerConfig
  */
 public function testGetControllerFromServiceManager()
 {
     //$this->markTestSkipped();
     $sm = Bootstrap::getServiceManager();
     $controller = $sm->get('ControllerLoader')->get('MaglLegacyApplication\\Controller\\Legacy');
     $this->assertInstanceOf('\\MaglLegacyApplication\\Controller\\LegacyController', $controller);
 }
コード例 #2
0
    public static function getServiceManager()
    {
        return static::$serviceManager;
    }
    protected static function initAutoloader()
    {
        $vendorPath = static::findParentPath('vendor');
        // Composer autoloading
        if (file_exists($vendorPath . '/autoload.php')) {
            include $vendorPath . '/autoload.php';
        } else {
            throw new RuntimeException('Unable to find composer autoloader. Run `php composer.phar install`.');
        }
        AutoloaderFactory::factory(array('Zend\\Loader\\StandardAutoloader' => array('autoregister_zf' => true, 'namespaces' => array(__NAMESPACE__ => __DIR__ . '/' . __NAMESPACE__))));
    }
    protected static function findParentPath($path)
    {
        $dir = __DIR__;
        $previousDir = '.';
        while (!is_dir($dir . '/' . $path)) {
            $dir = dirname($dir);
            if ($previousDir === $dir) {
                return false;
            }
            $previousDir = $dir;
        }
        return $dir . '/' . $path;
    }
}
Bootstrap::init();
コード例 #3
0
 public function setUp()
 {
     $this->instance = Bootstrap::getServiceManager()->get('MaglControllerService');
 }
コード例 #4
0
 public function setUp()
 {
     $sm = \MaglLegacyApplicationTest\Bootstrap::getServiceManager();
     $this->setApplicationConfig($sm->get('ApplicationConfig'));
     parent::setUp();
 }