diff --git a/composer.json b/composer.json index c840b0f6d..7291374c5 100644 --- a/composer.json +++ b/composer.json @@ -16,7 +16,6 @@ "php": "^5.5 || ^7.0", "zendframework/zend-eventmanager": "^2.6.2 || ^3.0", "zendframework/zend-servicemanager": "^2.7.5 || ^3.0.3", - "zendframework/zend-servicemanager-di": "^1.0.1", "zendframework/zend-hydrator": "^1.1 || ^2.1", "zendframework/zend-form": "^2.7", "zendframework/zend-stdlib": "^2.7.5 || ^3.0", @@ -42,7 +41,7 @@ "zendframework/zend-validator": "^2.6", "zendframework/zend-version": "^2.5", "zendframework/zend-view": "^2.6.3", - "fabpot/php-cs-fixer": "1.7.*", + "friendsofphp/php-cs-fixer": "1.7.*", "phpunit/PHPUnit": "^4.5", "sebastian/version": "^1.0.4" }, @@ -59,6 +58,7 @@ "zendframework/zend-log": "Zend\\Log component", "zendframework/zend-modulemanager": "Zend\\ModuleManager component", "zendframework/zend-serializer": "Zend\\Serializer component", + "zendframework/zend-servicemanager-di": "^1.0.1, if using zend-servicemanager v3 and requiring the zend-di integration", "zendframework/zend-session": "Zend\\Session component for FlashMessenger, PRG, and FPRG plugins", "zendframework/zend-text": "Zend\\Text component", "zendframework/zend-uri": "Zend\\Uri component", diff --git a/composer.lock b/composer.lock index 1334eadda..884b62dad 100644 --- a/composer.lock +++ b/composer.lock @@ -4,8 +4,8 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "5f138a5ebde4fab2be821687b60a367d", - "content-hash": "b43c5894b1a9b18d8f31f42864293f06", + "hash": "4426c8b988d640f73cf28e79abdde9eb", + "content-hash": "f98bd21f26f74693a5757438e657f1db", "packages": [ { "name": "container-interop/container-interop", @@ -83,106 +83,6 @@ ], "time": "2015-05-04 20:22:00" }, - { - "name": "zendframework/zend-code", - "version": "3.0.1", - "source": { - "type": "git", - "url": "https://github.com/zendframework/zend-code.git", - "reference": "09405eb04b7199733219cbf1f0803883a7bab842" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/zendframework/zend-code/zipball/09405eb04b7199733219cbf1f0803883a7bab842", - "reference": "09405eb04b7199733219cbf1f0803883a7bab842", - "shasum": "" - }, - "require": { - "php": "^5.5 || ^7.0", - "zendframework/zend-eventmanager": "^2.6 || ^3.0" - }, - "require-dev": { - "doctrine/annotations": "~1.0", - "ext-phar": "*", - "phpunit/phpunit": "^4.8.21", - "squizlabs/php_codesniffer": "^2.5", - "zendframework/zend-stdlib": "~2.7" - }, - "suggest": { - "doctrine/annotations": "Doctrine\\Common\\Annotations >=1.0 for annotation features", - "zendframework/zend-stdlib": "Zend\\Stdlib component" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.0-dev", - "dev-develop": "3.1-dev" - } - }, - "autoload": { - "psr-4": { - "Zend\\Code\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "description": "provides facilities to generate arbitrary code using an object oriented interface", - "homepage": "https://github.com/zendframework/zend-code", - "keywords": [ - "code", - "zf2" - ], - "time": "2016-01-26 17:57:25" - }, - { - "name": "zendframework/zend-di", - "version": "2.6.0", - "source": { - "type": "git", - "url": "https://github.com/zendframework/zend-di.git", - "reference": "c271c25c3e0ce194cbfbf05c9e56444d9f98456e" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/zendframework/zend-di/zipball/c271c25c3e0ce194cbfbf05c9e56444d9f98456e", - "reference": "c271c25c3e0ce194cbfbf05c9e56444d9f98456e", - "shasum": "" - }, - "require": { - "container-interop/container-interop": "^1.1", - "php": "^5.5 || ^7.0", - "zendframework/zend-code": "^2.6 || ^3.0", - "zendframework/zend-stdlib": "^2.7 || ^3.0" - }, - "require-dev": { - "fabpot/php-cs-fixer": "1.7.*", - "phpunit/phpunit": "~4.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.6-dev", - "dev-develop": "2.7-dev" - } - }, - "autoload": { - "psr-4": { - "Zend\\Di\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "homepage": "https://github.com/zendframework/zend-di", - "keywords": [ - "di", - "zf2" - ], - "time": "2016-02-23 20:38:54" - }, { "name": "zendframework/zend-diactoros", "version": "1.3.3", @@ -762,57 +662,6 @@ ], "time": "2016-02-02 14:13:42" }, - { - "name": "zendframework/zend-servicemanager-di", - "version": "1.0.1", - "source": { - "type": "git", - "url": "https://github.com/zendframework/zend-servicemanager-di.git", - "reference": "d894ab9e517ea711772480acb0ecb88deee14672" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/zendframework/zend-servicemanager-di/zipball/d894ab9e517ea711772480acb0ecb88deee14672", - "reference": "d894ab9e517ea711772480acb0ecb88deee14672", - "shasum": "" - }, - "require": { - "container-interop/container-interop": "^1.1", - "php": "^5.5 || ^7.0", - "zendframework/zend-di": "^2.6", - "zendframework/zend-servicemanager": "^2.7.5 || ^3.0.3" - }, - "require-dev": { - "phpunit/phpunit": "^4.5", - "squizlabs/php_codesniffer": "^2.3.1" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0-dev", - "dev-develop": "1.1-dev" - }, - "zf": { - "component": "Zend\\ServiceManager\\Di", - "config-provider": "Zend\\ServiceManager\\Di\\ConfigProvider" - } - }, - "autoload": { - "psr-4": { - "Zend\\ServiceManager\\Di\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "homepage": "https://github.com/zendframework/zend-servicemanager-di", - "keywords": [ - "di", - "zf2" - ], - "time": "2016-06-09 21:23:32" - }, { "name": "zendframework/zend-stdlib", "version": "3.0.0", @@ -1029,7 +878,7 @@ "time": "2015-06-14 21:17:01" }, { - "name": "fabpot/php-cs-fixer", + "name": "friendsofphp/php-cs-fixer", "version": "v1.7.1", "source": { "type": "git", @@ -2519,6 +2368,59 @@ ], "time": "2016-02-12 16:26:56" }, + { + "name": "zendframework/zend-code", + "version": "3.0.1", + "source": { + "type": "git", + "url": "https://github.com/zendframework/zend-code.git", + "reference": "09405eb04b7199733219cbf1f0803883a7bab842" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/zendframework/zend-code/zipball/09405eb04b7199733219cbf1f0803883a7bab842", + "reference": "09405eb04b7199733219cbf1f0803883a7bab842", + "shasum": "" + }, + "require": { + "php": "^5.5 || ^7.0", + "zendframework/zend-eventmanager": "^2.6 || ^3.0" + }, + "require-dev": { + "doctrine/annotations": "~1.0", + "ext-phar": "*", + "phpunit/phpunit": "^4.8.21", + "squizlabs/php_codesniffer": "^2.5", + "zendframework/zend-stdlib": "~2.7" + }, + "suggest": { + "doctrine/annotations": "Doctrine\\Common\\Annotations >=1.0 for annotation features", + "zendframework/zend-stdlib": "Zend\\Stdlib component" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev", + "dev-develop": "3.1-dev" + } + }, + "autoload": { + "psr-4": { + "Zend\\Code\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "description": "provides facilities to generate arbitrary code using an object oriented interface", + "homepage": "https://github.com/zendframework/zend-code", + "keywords": [ + "code", + "zf2" + ], + "time": "2016-01-26 17:57:25" + }, { "name": "zendframework/zend-console", "version": "2.6.0", @@ -2571,6 +2473,53 @@ ], "time": "2016-02-09 17:15:12" }, + { + "name": "zendframework/zend-di", + "version": "2.6.0", + "source": { + "type": "git", + "url": "https://github.com/zendframework/zend-di.git", + "reference": "c271c25c3e0ce194cbfbf05c9e56444d9f98456e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/zendframework/zend-di/zipball/c271c25c3e0ce194cbfbf05c9e56444d9f98456e", + "reference": "c271c25c3e0ce194cbfbf05c9e56444d9f98456e", + "shasum": "" + }, + "require": { + "container-interop/container-interop": "^1.1", + "php": "^5.5 || ^7.0", + "zendframework/zend-code": "^2.6 || ^3.0", + "zendframework/zend-stdlib": "^2.7 || ^3.0" + }, + "require-dev": { + "fabpot/php-cs-fixer": "1.7.*", + "phpunit/phpunit": "~4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.6-dev", + "dev-develop": "2.7-dev" + } + }, + "autoload": { + "psr-4": { + "Zend\\Di\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "homepage": "https://github.com/zendframework/zend-di", + "keywords": [ + "di", + "zf2" + ], + "time": "2016-02-23 20:38:54" + }, { "name": "zendframework/zend-i18n", "version": "2.6.0", diff --git a/src/Service/DiAbstractServiceFactoryFactory.php b/src/Service/DiAbstractServiceFactoryFactory.php index 273762bca..a131e7d09 100644 --- a/src/Service/DiAbstractServiceFactoryFactory.php +++ b/src/Service/DiAbstractServiceFactoryFactory.php @@ -9,17 +9,60 @@ namespace Zend\Mvc\Service; -use Zend\ServiceManager\Di\DiAbstractServiceFactoryFactory as OriginalFactory; +use Interop\Container\ContainerInterface; +use Zend\Mvc\Exception; +use Zend\ServiceManager\Di\DiAbstractServiceFactory; +use Zend\ServiceManager\FactoryInterface; +use Zend\ServiceManager\ServiceLocatorInterface; +use Zend\ServiceManager\ServiceManager; /** - * Since 2.7.9, this class now extends the version defined in zend-servicemanager-di, - * ensuring backwards compatibility with zend-servicemanger v2 and forwards - * compatibility with zend-servicemanager v3. - * * @deprecated Since 2.7.9. The factory is now defined in zend-servicemanager-di, * and removed in 3.0.0. Use Zend\ServiceManager\Di\DiAbstractServiceFactoryFactory - * from zend-servicemanager-di instead if you rely on this feature. + * from zend-servicemanager-di if you are using zend-servicemanager v3, and/or when + * ready to migrate to zend-mvc 3.0. */ -class DiAbstractServiceFactoryFactory extends OriginalFactory +class DiAbstractServiceFactoryFactory implements FactoryInterface { + /** + * Class responsible for instantiating a DiAbstractServiceFactory + * + * @param ContainerInterface $container + * @param string $name + * @param null|array $options + * @return DiAbstractServiceFactory + * @throws Exception\RuntimeException if zend-servicemanager v3 is in use. + */ + public function __invoke(ContainerInterface $container, $name, array $options = null) + { + if (! class_exists(DiAbstractServiceFactory::class)) { + throw new Exception\RuntimeException(sprintf( + "%s is not compatible with zend-servicemanager v3, which you are currently using. \n" + . "Please run 'composer require zendframework/zend-servicemanager-di', and then update\n" + . "your configuration to use Zend\ServiceManager\Di\DiAbstractServiceFactoryFactory instead.", + __CLASS__ + )); + } + + $factory = new DiAbstractServiceFactory($container->get('Di'), DiAbstractServiceFactory::USE_SL_BEFORE_DI); + + if ($container instanceof ServiceManager) { + $container->addAbstractFactory($factory, false); + } + + return $factory; + } + + /** + * Create and return DiAbstractServiceFactory instance + * + * For use with zend-servicemanager v2; proxies to __invoke(). + * + * @param ServiceLocatorInterface $container + * @return DiAbstractServiceFactory + */ + public function createService(ServiceLocatorInterface $container) + { + return $this($container, DiAbstractServiceFactory::class); + } } diff --git a/src/Service/DiFactory.php b/src/Service/DiFactory.php index 212ec26e1..9bf478e8f 100644 --- a/src/Service/DiFactory.php +++ b/src/Service/DiFactory.php @@ -9,17 +9,57 @@ namespace Zend\Mvc\Service; -use Zend\ServiceManager\Di\DiFactory as OriginalFactory; +use Interop\Container\ContainerInterface; +use Zend\Di\Config; +use Zend\Di\Di; +use Zend\ServiceManager\FactoryInterface; +use Zend\ServiceManager\ServiceLocatorInterface; /** - * Since 2.7.9, this class now extends the version defined in zend-servicemanager-di, - * ensuring backwards compatibility with zend-servicemanger v2 and forwards - * compatibility with zend-servicemanager v3. - * * @deprecated Since 2.7.9. The factory is now defined in zend-servicemanager-di, * and removed in 3.0.0. Use Zend\ServiceManager\Di\DiFactory from - * zend-servicemanager-di instead if you rely on this feature. + * from zend-servicemanager-di if you are using zend-servicemanager v3, and/or when + * ready to migrate to zend-mvc 3.0. */ -class DiFactory extends OriginalFactory +class DiFactory implements FactoryInterface { + /** + * Create and return abstract factory seeded by dependency injector + * + * Creates and returns an abstract factory seeded by the dependency + * injector. If the "di" key of the configuration service is set, that + * sub-array is passed to a DiConfig object and used to configure + * the DI instance. The DI instance is then used to seed the + * DiAbstractServiceFactory, which is then registered with the service + * manager. + * + * @param ContainerInterface $container + * @param string $name + * @param null|array $options + * @return Di + */ + public function __invoke(ContainerInterface $container, $name, array $options = null) + { + $di = new Di(); + $config = $container->has('config') ? $container->get('config') : []; + + if (isset($config['di'])) { + (new Config($config['di']))->configure($di); + } + + return $di; + } + + /** + * Create and return Di instance + * + * For use with zend-servicemanager v2; proxies to __invoke(). + * + * @param ServiceLocatorInterface $container + * @return Di + */ + public function createService(ServiceLocatorInterface $container) + { + return $this($container, Di::class); + } } diff --git a/src/Service/DiServiceInitializerFactory.php b/src/Service/DiServiceInitializerFactory.php index d7aa6f17d..6dc1cb387 100644 --- a/src/Service/DiServiceInitializerFactory.php +++ b/src/Service/DiServiceInitializerFactory.php @@ -9,17 +9,53 @@ namespace Zend\Mvc\Service; -use Zend\ServiceManager\Di\DiServiceInitializerFactory as OriginalFactory; +use Interop\Container\ContainerInterface; +use Zend\Mvc\Exception; +use Zend\ServiceManager\Di\DiServiceInitializer; +use Zend\ServiceManager\FactoryInterface; +use Zend\ServiceManager\ServiceLocatorInterface; +use Zend\ServiceManager\ServiceManager; /** - * Since 2.7.9, this class now extends the version defined in zend-servicemanager-di, - * ensuring backwards compatibility with zend-servicemanger v2 and forwards - * compatibility with zend-servicemanager v3. - * * @deprecated Since 2.7.9. The factory is now defined in zend-servicemanager-di, * and removed in 3.0.0. Use Zend\ServiceManager\Di\DiServiceInitializerFactory - * from zend-servicemanager-di instead if you rely on this feature. + * from zend-servicemanager-di if you are using zend-servicemanager v3, and/or when + * ready to migrate to zend-mvc 3.0. */ -class DiServiceInitializerFactory extends OriginalFactory +class DiServiceInitializerFactory implements FactoryInterface { + /** + * Class responsible for instantiating a DiServiceInitializer + * + * @param ContainerInterface $container + * @param string $name + * @param null|array $options + * @return DiServiceInitializer + */ + public function __invoke(ContainerInterface $container, $requestedName, array $options = null) + { + if (! class_exists(DiServiceInitializer::class)) { + throw new Exception\RuntimeException(sprintf( + "%s is not compatible with zend-servicemanager v3, which you are currently using. \n" + . "Please run 'composer require zendframework/zend-servicemanager-di', and then update\n" + . "your configuration to use Zend\ServiceManager\Di\DiServiceInitializerFactory instead.", + __CLASS__ + )); + } + + return new DiServiceInitializer($container->get('Di'), $container); + } + + /** + * Create and return DiServiceInitializer instance + * + * For use with zend-servicemanager v2; proxies to __invoke(). + * + * @param ServiceLocatorInterface $container + * @return DiServiceInitializer + */ + public function createService(ServiceLocatorInterface $container) + { + return $this($container, DiServiceInitializer::class); + } } diff --git a/src/Service/DiStrictAbstractServiceFactory.php b/src/Service/DiStrictAbstractServiceFactory.php index 6f842c119..1c7c019d4 100644 --- a/src/Service/DiStrictAbstractServiceFactory.php +++ b/src/Service/DiStrictAbstractServiceFactory.php @@ -9,17 +9,183 @@ namespace Zend\Mvc\Service; -use Zend\ServiceManager\Di\DiStrictAbstractServiceFactory as OriginalFactory; +use Interop\Container\ContainerInterface; +use Zend\Di\Di; +use Zend\Di\Exception\ClassNotFoundException; +use Zend\ServiceManager\AbstractFactoryInterface; +use Zend\ServiceManager\AbstractPluginManager; +use Zend\ServiceManager\Exception; +use Zend\ServiceManager\ServiceLocatorInterface; /** - * Since 2.7.9, this class now extends the version defined in zend-servicemanager-di, - * ensuring backwards compatibility with zend-servicemanger v2 and forwards - * compatibility with zend-servicemanager v3. + * Create and return instances from a DI container and/or the parent container. + * + * This abstract factory can be mapped to arbitrary class names, and used to + * pull them from the composed Di instance, using the following behaviors: + * + * - If USE_SL_BEFORE_DI is passed as the second argument to the constructor, + * the factory will attempt to fetch the service from the passed container + * first, and fall back to the composed DI container only on failure. + * - If USE_SL_AFTER_DI is passed as the second argument to the constructor, + * the factory will attempt to fetch the service from the composed DI + * container first, and fall back to the passed container only on failure. + * - If USE_SL_NONE is passed as the second argument to the constructor (or no + * argument is passed), then the factory will only fetch from the composed + * DI container. + * + * Unlike DiAbstractServiceFactory and DiServiceFactory, this abstract factory + * requires that classes requested are in a provided whitelist; if the requested + * service is not, an exception is raised. This is useful to provide a scoped + * container, e.g., to limit to known controller classes, etc. * * @deprecated Since 2.7.9. The factory is now defined in zend-servicemanager-di, * and removed in 3.0.0. Use Zend\ServiceManager\Di\DiStrictAbstractServiceFactory - * from zend-servicemanager-di instead if you rely on this feature. + * from zend-servicemanager-di if you are using zend-servicemanager v3, and/or when + * ready to migrate to zend-mvc 3.0. */ -class DiStrictAbstractServiceFactory extends OriginalFactory +class DiStrictAbstractServiceFactory extends Di implements AbstractFactoryInterface { + /**@#+ + * constants + */ + const USE_SL_BEFORE_DI = 'before'; + const USE_SL_AFTER_DI = 'after'; + const USE_SL_NONE = 'none'; + /**@#-*/ + + /** + * @var Di + */ + protected $di = null; + + /** + * @var string + */ + protected $useContainer = self::USE_SL_AFTER_DI; + + /** + * @var ContainerInterface + */ + protected $container = null; + + /** + * @var array an array of whitelisted service names (keys are the service names) + */ + protected $allowedServiceNames = []; + + /** + * @param Di $di + * @param string $useContainer + */ + public function __construct(Di $di, $useContainer = self::USE_SL_NONE) + { + $this->useContainer = $useContainer; + + // Since we are using this in a proxy-fashion, localize state + $this->di = $di; + $this->definitions = $this->di->definitions; + $this->instanceManager = $this->di->instanceManager; + } + + /** + * @param array $allowedServiceNames + */ + public function setAllowedServiceNames(array $allowedServiceNames) + { + $this->allowedServiceNames = array_flip(array_values($allowedServiceNames)); + } + + /** + * @return array + */ + public function getAllowedServiceNames() + { + return array_keys($this->allowedServiceNames); + } + + /** + * {@inheritDoc} + * + * Allows creation of services only when in a whitelist + */ + public function __invoke(ContainerInterface $container, $name, array $options = null) + { + if (! isset($this->allowedServiceNames[$name])) { + throw new Exception\InvalidServiceException(sprintf( + 'Service "%s" is not whitelisted', + $name + )); + } + + $this->container = ($container instanceof AbstractPluginManager) + ? $container->getServiceLocator() + : $container; + + return parent::get($name); + } + + /** + * {@inheritDoc} + * + * For use with zend-servicemanager v2; proxies to __invoke(). + */ + public function createServiceWithName(ServiceLocatorInterface $container, $serviceName, $requestedName) + { + return $this($container, $requestedName); + } + + /** + * Overrides Zend\Di to allow the given container's services to be reused by Di itself + * + * {@inheritDoc} + * + * @throws Exception\InvalidServiceNameException + */ + public function get($name, array $params = []) + { + if (null === $this->container) { + throw new Exception\DomainException( + 'No ServiceLocator defined, use `createServiceWithName` instead of `get`' + ); + } + + if (self::USE_SL_BEFORE_DI === $this->useContainer && $this->container->has($name)) { + return $this->container->get($name); + } + + try { + return parent::get($name, $params); + } catch (ClassNotFoundException $e) { + if (self::USE_SL_AFTER_DI === $this->useContainer && $this->container->has($name)) { + return $this->container->get($name); + } + + throw new Exception\ServiceNotFoundException( + sprintf('Service %s was not found in this DI instance', $name), + null, + $e + ); + } + } + + /** + * {@inheritDoc} + * + * Allows creation of services only when in a whitelist. + */ + public function canCreate(ContainerInterface $container, $requestedName) + { + // won't check if the service exists, we are trusting the user's whitelist + return isset($this->allowedServiceNames[$requestedName]); + } + + /** + * {@inheritDoc} + * + * For use with zend-servicemanager v2; proxies to canCreate(). + */ + public function canCreateServiceWithName(ServiceLocatorInterface $container, $name, $requestedName) + { + return $this->canCreate($container, $requestedName); + } } diff --git a/src/Service/DiStrictAbstractServiceFactoryFactory.php b/src/Service/DiStrictAbstractServiceFactoryFactory.php index 33ffd3cd4..7d97e1e32 100644 --- a/src/Service/DiStrictAbstractServiceFactoryFactory.php +++ b/src/Service/DiStrictAbstractServiceFactoryFactory.php @@ -16,7 +16,8 @@ /** * @deprecated Since 2.7.9. The factory is now defined in zend-servicemanager-di, * and removed in 3.0.0. Use Zend\ServiceManager\Di\DiStrictAbstractServiceFactoryFactory - * from zend-servicemanager-di instead if you rely on this feature. + * from zend-servicemanager-di if you are using zend-servicemanager v3, and/or when + * ready to migrate to zend-mvc 3.0. */ class DiStrictAbstractServiceFactoryFactory implements FactoryInterface { diff --git a/test/Service/DiAbstractServiceFactoryFactoryTest.php b/test/Service/DiAbstractServiceFactoryFactoryTest.php new file mode 100644 index 000000000..9533bb782 --- /dev/null +++ b/test/Service/DiAbstractServiceFactoryFactoryTest.php @@ -0,0 +1,29 @@ +markTestSkipped('Test is only relevant for zend-servicemanager v3'); + } + + $factory = new DiAbstractServiceFactoryFactory(); + $this->setExpectedException(Exception\RuntimeException::class, 'zend-servicemanager-di'); + $factory($container, DiAbstractServiceFactoryFactory::class); + } +} diff --git a/test/Service/DiServiceInitializerFactoryTest.php b/test/Service/DiServiceInitializerFactoryTest.php new file mode 100644 index 000000000..2357ca12f --- /dev/null +++ b/test/Service/DiServiceInitializerFactoryTest.php @@ -0,0 +1,29 @@ +markTestSkipped('Test is only relevant for zend-servicemanager v3'); + } + + $factory = new DiServiceInitializerFactory(); + $this->setExpectedException(Exception\RuntimeException::class, 'zend-servicemanager-di'); + $factory($container, DiServiceInitializerFactory::class); + } +}