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

Commit

Permalink
Merge branch
Browse files Browse the repository at this point in the history
  • Loading branch information
Show file tree
Hide file tree
Showing 33 changed files with 28 additions and 52 deletions.
4 changes: 3 additions & 1 deletion src/Listener/LocatorRegistrationListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,12 @@ public function onLoadModules(Event $e)
// Shared instance for module manager
$events->attach('Zend\Mvc\Application', MvcEvent::EVENT_BOOTSTRAP, function ($e) use ($moduleManager) {
$moduleClassName = get_class($moduleManager);
$moduleClassNameArray = explode('\\', $moduleClassName);
$moduleClassNameAlias = end($moduleClassNameArray);
$application = $e->getApplication();
$services = $application->getServiceManager();
if (!$services->has($moduleClassName)) {
$services->setService($moduleClassName, $moduleManager);
$services->setAlias($moduleClassName, $moduleClassNameAlias);
}
}, 1000);

Expand Down
2 changes: 1 addition & 1 deletion src/Listener/ServiceListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ protected function serviceConfigToArray($config)
if (!$config instanceof ServiceConfig) {
throw new Exception\RuntimeException(sprintf(
'Invalid service manager configuration class provided; received "%s", expected an instance of Zend\ServiceManager\Config',
$class
(is_object($config) ? get_class($config) : (is_scalar($config) ? $config : gettype($config)))
));
}

Expand Down
10 changes: 5 additions & 5 deletions src/ModuleEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ class ModuleEvent extends Event
/**
* Module events triggered by eventmanager
*/
CONST EVENT_MERGE_CONFIG = 'mergeConfig';
CONST EVENT_LOAD_MODULES = 'loadModules';
CONST EVENT_LOAD_MODULE_RESOLVE = 'loadModule.resolve';
CONST EVENT_LOAD_MODULE = 'loadModule';
CONST EVENT_LOAD_MODULES_POST = 'loadModules.post';
const EVENT_MERGE_CONFIG = 'mergeConfig';
const EVENT_LOAD_MODULES = 'loadModules';
const EVENT_LOAD_MODULE_RESOLVE = 'loadModule.resolve';
const EVENT_LOAD_MODULE = 'loadModule';
const EVENT_LOAD_MODULES_POST = 'loadModules.post';

/**
* @var mixed
Expand Down
1 change: 0 additions & 1 deletion test/Listener/AutoloaderListenerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_ModuleManager
*/

namespace ZendTest\ModuleManager\Listener;
Expand Down
1 change: 0 additions & 1 deletion test/Listener/ConfigListenerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_ModuleManager
*/

namespace ZendTest\ModuleManager\Listener;
Expand Down
1 change: 0 additions & 1 deletion test/Listener/DefaultListenerAggregateTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_ModuleManager
*/

namespace ZendTest\ModuleManager\Listener;
Expand Down
1 change: 0 additions & 1 deletion test/Listener/InitTriggerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_ModuleManager
*/

namespace ZendTest\ModuleManager\Listener;
Expand Down
1 change: 0 additions & 1 deletion test/Listener/ListenerOptionsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_ModuleManager
*/

namespace ZendTest\ModuleManager\Listener;
Expand Down
20 changes: 19 additions & 1 deletion test/Listener/LocatorRegistrationListenerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_ModuleManager
*/

namespace ZendTest\ModuleManager\Listener;
Expand Down Expand Up @@ -122,4 +121,23 @@ public function testModuleClassIsRegisteredWithDiAndInjectedWithSharedInstances(
$this->assertInstanceOf('Zend\ModuleManager\ModuleManager', $sharedInstance2);
$this->assertSame($this->moduleManager, $locator->get('Foo\Bar')->moduleManager);
}

public function testNoDuplicateServicesAreDefinedForModuleManager()
{
$locatorRegistrationListener = new LocatorRegistrationListener;
$this->moduleManager->getEventManager()->attachAggregate($locatorRegistrationListener);

$this->moduleManager->loadModules();
$this->application->bootstrap();
$registeredServices = $this->application->getServiceManager()->getRegisteredServices();

$aliases = $registeredServices['aliases'];
$instances = $registeredServices['instances'];

$this->assertContains('zendmodulemanagermodulemanager', $aliases);
$this->assertFalse(in_array('modulemanager', $aliases));

$this->assertContains('modulemanager', $instances);
$this->assertFalse(in_array('zendmodulemanagermodulemanager', $instances));
}
}
1 change: 0 additions & 1 deletion test/Listener/ModuleDependencyCheckerListenerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_ModuleManager
*/

namespace ZendTest\ModuleManager\Listener;
Expand Down
1 change: 0 additions & 1 deletion test/Listener/ModuleLoaderListenerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_ModuleManager
*/

namespace ZendTest\ModuleManager\Listener;
Expand Down
1 change: 0 additions & 1 deletion test/Listener/ModuleResolverListenerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_ModuleManager
*/

namespace ZendTest\ModuleManager\Listener;
Expand Down
1 change: 0 additions & 1 deletion test/Listener/OnBootstrapListenerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_ModuleManager
*/

namespace ZendTest\ModuleManager\Listener;
Expand Down
1 change: 0 additions & 1 deletion test/Listener/ServiceListenerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_ModuleManager
*/

namespace ZendTest\ModuleManager\Listener;
Expand Down
6 changes: 0 additions & 6 deletions test/Listener/TestAsset/ServiceInvalidReturnModule.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,12 @@
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_ModuleManager
*/

namespace ZendTest\ModuleManager\Listener\TestAsset;

use stdClass;

/**
* @category Zend
* @package Zend_ModuleManager
* @subpackage UnitTest
*/
class ServiceInvalidReturnModule
{
public function getServiceConfiguration()
Expand Down
6 changes: 0 additions & 6 deletions test/Listener/TestAsset/ServiceProviderModule.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,10 @@
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_ModuleManager
*/

namespace ZendTest\ModuleManager\Listener\TestAsset;

/**
* @category Zend
* @package Zend_ModuleManager
* @subpackage UnitTest
*/
class ServiceProviderModule
{
public $config;
Expand Down
1 change: 0 additions & 1 deletion test/ModuleEventTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_ModuleManager
*/

namespace ZendTest\ModuleManager;
Expand Down
1 change: 0 additions & 1 deletion test/ModuleManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_ModuleManager
*/

namespace ZendTest\ModuleManager;
Expand Down
1 change: 0 additions & 1 deletion test/TestAsset/BadConfigModule/Module.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_ModuleManager
*/

namespace BadConfigModule;
Expand Down
1 change: 0 additions & 1 deletion test/TestAsset/BafModule/Module.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_ModuleManager
*/

namespace BafModule;
Expand Down
1 change: 0 additions & 1 deletion test/TestAsset/BamModule/Module.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_ModuleManager
*/

namespace BamModule;
Expand Down
1 change: 0 additions & 1 deletion test/TestAsset/BarModule/Module.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_ModuleManager
*/

namespace BarModule;
Expand Down
1 change: 0 additions & 1 deletion test/TestAsset/BazModule/Module.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_ModuleManager
*/

namespace BazModule;
Expand Down
1 change: 0 additions & 1 deletion test/TestAsset/BooModule/Module.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_ModuleManager
*/

namespace BooModule;
Expand Down
1 change: 0 additions & 1 deletion test/TestAsset/BorModule/Module.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_ModuleManager
*/

namespace BorModule;
Expand Down
6 changes: 0 additions & 6 deletions test/TestAsset/ListenerTestModule/Module.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_ModuleManager
*/

namespace ListenerTestModule;
Expand All @@ -15,11 +14,6 @@
use Zend\ModuleManager\Feature\BootstrapListenerInterface;
use Zend\EventManager\EventInterface;

/**
* @category Zend
* @package Zend_ModuleManager
* @subpackage UnitTest
*/
class Module implements
AutoloaderProviderInterface,
LocatorRegisteredInterface,
Expand Down
1 change: 0 additions & 1 deletion test/TestAsset/ListenerTestModule/src/Foo/Bar.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_ModuleManager
*/

namespace Foo;
Expand Down
1 change: 0 additions & 1 deletion test/TestAsset/LoadOtherModule/Module.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_ModuleManager
*/

namespace LoadOtherModule;
Expand Down
1 change: 0 additions & 1 deletion test/TestAsset/MockApplication.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_ModuleManager
*/

namespace ZendTest\ModuleManager\TestAsset;
Expand Down
1 change: 0 additions & 1 deletion test/TestAsset/NotAutoloaderModule/Module.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_ModuleManager
*/

namespace NotAutoloaderModule;
Expand Down
1 change: 0 additions & 1 deletion test/TestAsset/NotAutoloaderModule/src/Foo/Bar.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_ModuleManager
*/

namespace Foo;
Expand Down
1 change: 0 additions & 1 deletion test/TestAsset/SomeModule/Module.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_ModuleManager
*/

namespace SomeModule;
Expand Down
1 change: 0 additions & 1 deletion test/TestAsset/SubModule/Sub/Module.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_ModuleManager
*/

namespace SubModule\Sub;
Expand Down

0 comments on commit 1822787

Please sign in to comment.