/** * @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); }
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();
public function setUp() { $this->instance = Bootstrap::getServiceManager()->get('MaglControllerService'); }
public function setUp() { $sm = \MaglLegacyApplicationTest\Bootstrap::getServiceManager(); $this->setApplicationConfig($sm->get('ApplicationConfig')); parent::setUp(); }