コード例 #1
0
 public function testCanMergeConfigFromArrayOfGlobs()
 {
     $configListener = new ConfigListener();
     $configListener->addConfigGlobPaths(new ArrayObject(array(__DIR__ . '/_files/good/*.ini', __DIR__ . '/_files/good/*.php', __DIR__ . '/_files/good/*.xml')));
     $moduleManager = $this->moduleManager;
     $moduleManager->setModules(array('SomeModule'));
     $moduleManager->events()->attachAggregate($configListener);
     $moduleManager->loadModules();
     // Test as object
     $configObject = $configListener->getMergedConfig();
     $this->assertSame('loaded', $configObject->ini);
     $this->assertSame('loaded', $configObject->php);
     $this->assertSame('loaded', $configObject->xml);
 }
コード例 #2
0
ファイル: ConfigListenerTest.php プロジェクト: ranxin1022/zf2
 public function testPhpConfigFileReturningInvalidConfigRaisesException()
 {
     $this->setExpectedException('Zend\\Module\\Listener\\Exception\\RuntimeException', 'Invalid configuration');
     $configListener = new ConfigListener();
     $configListener->addConfigGlobPaths(new ArrayObject(array(__DIR__ . '/_files/bad/*.php')));
     $moduleManager = $this->moduleManager;
     $moduleManager->setModules(array('SomeModule'));
     $moduleManager->events()->attach('loadModule', $configListener);
     $moduleManager->events()->attach('loadModules.post', array($configListener, 'loadModulesPost'), 1000);
     $moduleManager->loadModules();
 }