Skip to content
This repository has been archived by the owner on Jan 29, 2020. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Maks3w committed Feb 19, 2014
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 14 deletions.
5 changes: 3 additions & 2 deletions test/Listener/AutoloaderListenerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use Zend\ModuleManager\Listener\AutoloaderListener;
use Zend\ModuleManager\Listener\ModuleResolverListener;
use Zend\ModuleManager\ModuleManager;
use Zend\ModuleManager\ModuleEvent;

class AutoloaderListenerTest extends TestCase
{
Expand All @@ -37,8 +38,8 @@ public function setUp()
$autoloader->register();

$this->moduleManager = new ModuleManager(array());
$this->moduleManager->getEventManager()->attach('loadModule.resolve', new ModuleResolverListener, 1000);
$this->moduleManager->getEventManager()->attach('loadModule', new AutoloaderListener, 2000);
$this->moduleManager->getEventManager()->attach(ModuleEvent::EVENT_LOAD_MODULE_RESOLVE, new ModuleResolverListener, 1000);
$this->moduleManager->getEventManager()->attach(ModuleEvent::EVENT_LOAD_MODULE, new AutoloaderListener, 2000);
}

public function tearDown()
Expand Down
9 changes: 5 additions & 4 deletions test/Listener/ConfigListenerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
use Zend\ModuleManager\Listener\ModuleResolverListener;
use Zend\ModuleManager\Listener\ListenerOptions;
use Zend\ModuleManager\ModuleManager;
use Zend\ModuleManager\ModuleEvent;

class ConfigListenerTest extends TestCase
{
Expand All @@ -43,7 +44,7 @@ public function setUp()
$autoloader->register();

$this->moduleManager = new ModuleManager(array());
$this->moduleManager->getEventManager()->attach('loadModule.resolve', new ModuleResolverListener, 1000);
$this->moduleManager->getEventManager()->attach(ModuleEvent::EVENT_LOAD_MODULE_RESOLVE, new ModuleResolverListener, 1000);
}

public function tearDown()
Expand Down Expand Up @@ -104,7 +105,7 @@ public function testCanCacheMergedConfig()
// Now we check to make sure it uses the config and doesn't hit
// the module objects getConfig() method(s)
$moduleManager = new ModuleManager(array('SomeModule', 'ListenerTestModule'));
$moduleManager->getEventManager()->attach('loadModule.resolve', new ModuleResolverListener, 1000);
$moduleManager->getEventManager()->attach(ModuleEvent::EVENT_LOAD_MODULE_RESOLVE, new ModuleResolverListener, 1000);
$configListener = new ConfigListener($options);
$configListener->attach($moduleManager->getEventManager());
$moduleManager->loadModules();
Expand Down Expand Up @@ -249,7 +250,7 @@ public function testCanCacheMergedConfigFromGlob()
// This time, don't add the glob path
$configListener = new ConfigListener($options);
$moduleManager = new ModuleManager(array('SomeModule'));
$moduleManager->getEventManager()->attach('loadModule.resolve', new ModuleResolverListener, 1000);
$moduleManager->getEventManager()->attach(ModuleEvent::EVENT_LOAD_MODULE_RESOLVE, new ModuleResolverListener, 1000);

$moduleManager->getEventManager()->attachAggregate($configListener);

Expand Down Expand Up @@ -289,7 +290,7 @@ public function testCanCacheMergedConfigFromStatic()
// This time, don't add the glob path
$configListener = new ConfigListener($options);
$moduleManager = new ModuleManager(array('SomeModule'));
$moduleManager->getEventManager()->attach('loadModule.resolve', new ModuleResolverListener, 1000);
$moduleManager->getEventManager()->attach(ModuleEvent::EVENT_LOAD_MODULE_RESOLVE, new ModuleResolverListener, 1000);

$moduleManager->getEventManager()->attachAggregate($configListener);

Expand Down
5 changes: 3 additions & 2 deletions test/Listener/InitTriggerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use Zend\ModuleManager\Listener\InitTrigger;
use Zend\ModuleManager\Listener\ModuleResolverListener;
use Zend\ModuleManager\ModuleManager;
use Zend\ModuleManager\ModuleEvent;

class InitTriggerTest extends TestCase
{
Expand All @@ -37,8 +38,8 @@ public function setUp()
$autoloader->register();

$this->moduleManager = new ModuleManager(array());
$this->moduleManager->getEventManager()->attach('loadModule.resolve', new ModuleResolverListener, 1000);
$this->moduleManager->getEventManager()->attach('loadModule', new InitTrigger, 2000);
$this->moduleManager->getEventManager()->attach(ModuleEvent::EVENT_LOAD_MODULE_RESOLVE, new ModuleResolverListener, 1000);
$this->moduleManager->getEventManager()->attach(ModuleEvent::EVENT_LOAD_MODULE, new InitTrigger, 2000);
}

public function tearDown()
Expand Down
5 changes: 3 additions & 2 deletions test/Listener/LocatorRegistrationListenerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
use Zend\ModuleManager\Listener\LocatorRegistrationListener;
use Zend\ModuleManager\Listener\ModuleResolverListener;
use Zend\ModuleManager\ModuleManager;
use Zend\ModuleManager\ModuleEvent;
use Zend\Mvc\Application;
use Zend\ServiceManager\ServiceManager;
use ZendTest\ModuleManager\TestAsset\MockApplication;
Expand Down Expand Up @@ -49,7 +50,7 @@ public function setUp()

$this->moduleManager = new ModuleManager(array('ListenerTestModule'));
$this->moduleManager->getEventManager()->setSharedManager($this->sharedEvents);
$this->moduleManager->getEventManager()->attach('loadModule.resolve', new ModuleResolverListener, 1000);
$this->moduleManager->getEventManager()->attach(ModuleEvent::EVENT_LOAD_MODULE_RESOLVE, new ModuleResolverListener, 1000);

$this->application = new MockApplication;
$events = new EventManager(array('Zend\Mvc\Application', 'ZendTest\Module\TestAsset\MockApplication', 'application'));
Expand Down Expand Up @@ -93,7 +94,7 @@ public function testModuleClassIsRegisteredWithDiAndInjectedWithSharedInstances(
$locatorRegistrationListener = new LocatorRegistrationListener;
$this->moduleManager->getEventManager()->attachAggregate($locatorRegistrationListener);
$test = $this;
$this->moduleManager->getEventManager()->attach('loadModule', function ($e) use ($test) {
$this->moduleManager->getEventManager()->attach(ModuleEvent::EVENT_LOAD_MODULE, function ($e) use ($test) {
$test->module = $e->getModule();
}, -1000);
$this->moduleManager->loadModules();
Expand Down
3 changes: 2 additions & 1 deletion test/Listener/ModuleDependencyCheckerListenerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
use PHPUnit_Framework_TestCase as TestCase;
use Zend\ModuleManager\Listener\ModuleDependencyCheckerListener;
use Zend\ModuleManager\ModuleManager;
use Zend\ModuleManager\ModuleEvent;

class ModuleDependencyCheckerListenerTest extends TestCase
{
Expand All @@ -21,7 +22,7 @@ class ModuleDependencyCheckerListenerTest extends TestCase
public function testCallsGetModuleDependenciesOnModuleImplementingInterface()
{
//$moduleManager = new ModuleManager(array());
//$moduleManager->getEventManager()->attach('loadModule', new ModuleDependencyCheckerListener(), 2000);
//$moduleManager->getEventManager()->attach(ModuleEvent::EVENT_LOAD_MODULE, new ModuleDependencyCheckerListener(), 2000);

$module = $this->getMock('Zend\ModuleManager\Feature\DependencyIndicatorInterface');
$module->expects($this->once())->method('getModuleDependencies')->will($this->returnValue(array()));
Expand Down
2 changes: 1 addition & 1 deletion test/Listener/ModuleLoaderListenerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public function setUp()
@mkdir($this->tmpdir);

$this->moduleManager = new ModuleManager(array());
$this->moduleManager->getEventManager()->attach('loadModule.resolve', new ModuleResolverListener, 1000);
$this->moduleManager->getEventManager()->attach(ModuleEvent::EVENT_LOAD_MODULE_RESOLVE, new ModuleResolverListener, 1000);
}

public function tearDown()
Expand Down
5 changes: 3 additions & 2 deletions test/Listener/OnBootstrapListenerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
use Zend\ModuleManager\Listener\ModuleResolverListener;
use Zend\ModuleManager\Listener\OnBootstrapListener;
use Zend\ModuleManager\ModuleManager;
use Zend\ModuleManager\ModuleEvent;
use Zend\Mvc\Application;
use ZendTest\ModuleManager\TestAsset\MockApplication;

Expand All @@ -43,8 +44,8 @@ public function setUp()
$sharedEvents = new SharedEventManager();
$this->moduleManager = new ModuleManager(array());
$this->moduleManager->getEventManager()->setSharedManager($sharedEvents);
$this->moduleManager->getEventManager()->attach('loadModule.resolve', new ModuleResolverListener, 1000);
$this->moduleManager->getEventManager()->attach('loadModule', new OnBootstrapListener, 1000);
$this->moduleManager->getEventManager()->attach(ModuleEvent::EVENT_LOAD_MODULE_RESOLVE, new ModuleResolverListener, 1000);
$this->moduleManager->getEventManager()->attach(ModuleEvent::EVENT_LOAD_MODULE, new OnBootstrapListener, 1000);

$this->application = new MockApplication;
$events = new EventManager(array('Zend\Mvc\Application', 'ZendTest\Module\TestAsset\MockApplication', 'application'));
Expand Down

0 comments on commit 5560ba8

Please sign in to comment.