diff --git a/.gitattributes b/.gitattributes index 7325c690..7a37896d 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,8 +1,8 @@ -/test export-ignore -/vendor export-ignore -.coveralls.yml export-ignore -.gitattributes export-ignore -.gitignore export-ignore -.travis.yml export-ignore -.php_cs export-ignore -phpunit.xml.dist export-ignore +/.coveralls.yml export-ignore +/.gitattributes export-ignore +/.gitignore export-ignore +/.php_cs export-ignore +/.travis.yml export-ignore +/benchmarks/ export-ignore +/phpunit.xml.dist export-ignore +/test/ export-ignore diff --git a/.gitignore b/.gitignore index a7fc91d6..d5e33e78 100644 --- a/.gitignore +++ b/.gitignore @@ -1,15 +1,5 @@ -.buildpath -.DS_Store -.idea -.project -.settings/ -.*.sw* -.*.un~ -nbproject -tmp/ - -clover.xml -composer.lock -coveralls-upload.json -phpunit.xml -vendor +/clover.xml +/composer.lock +/coveralls-upload.json +/phpunit.xml +/vendor/ diff --git a/.travis.yml b/.travis.yml index 152da12c..ab2349d6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,3 @@ -sudo: false - language: php branches: @@ -26,7 +24,6 @@ matrix: - php: hhvm notifications: - irc: "irc.freenode.org#zftalk.dev" email: false before_install: diff --git a/CHANGELOG.md b/CHANGELOG.md index 8539a4c6..17389933 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,7 +18,7 @@ All notable changes to this project will be documented in this file, in reverse ### Fixed -- [#127](https://github.com/zendframework/zend-servicemanager/pull/127) fixes +- [zendframework/zend-servicemanager#127](https://github.com/zendframework/zend-servicemanager/pull/127) fixes how the `AbstractPluingManager` handles `$options` arrays passed when retrieving a plugin when that plugin resolves to the `InvokableFactory`, ensuring subsequent calls with different options are created correctly. @@ -39,7 +39,7 @@ All notable changes to this project will be documented in this file, in reverse ### Fixed -- [#116](https://github.com/zendframework/zend-servicemanager/pull/116) updates +- [zendframework/zend-servicemanager#116](https://github.com/zendframework/zend-servicemanager/pull/116) updates `ServiceLocatorInterface` to extend container-interop's `ContainerInterface`, as the definitions are compatible. This change will mean that implementing `ServiceLocatorInterface` will provide a `ContainerInterface` implementation. @@ -48,11 +48,11 @@ All notable changes to this project will be documented in this file, in reverse ### Added -- [#81](https://github.com/zendframework/zend-servicemanager/pull/81) adds a +- [zendframework/zend-servicemanager#81](https://github.com/zendframework/zend-servicemanager/pull/81) adds a test covering forwards-compatibility features for plugin manager implementations. -- [#96](https://github.com/zendframework/zend-servicemanager/pull/96) adds - `Zend\ServiceManager\Test\CommonPluginManagerTrait`, which allows you to test +- [zendframework/zend-servicemanager#96](https://github.com/zendframework/zend-servicemanager/pull/96) adds + `Laminas\ServiceManager\Test\CommonPluginManagerTrait`, which allows you to test that your plugin manager is forwards compatible with v3. ### Deprecated @@ -65,7 +65,7 @@ All notable changes to this project will be documented in this file, in reverse ### Fixed -- [#91](https://github.com/zendframework/zend-servicemanager/pull/91) updates +- [zendframework/zend-servicemanager#91](https://github.com/zendframework/zend-servicemanager/pull/91) updates the `InvokableFactory` to add the `setCreationOptions()` method, allowing the `InvokableFactory` to accept `$options` when triggered. @@ -85,7 +85,7 @@ All notable changes to this project will be documented in this file, in reverse ### Fixed -- [#71](https://github.com/zendframework/zend-servicemanager/pull/71) fixes an edge case +- [zendframework/zend-servicemanager#71](https://github.com/zendframework/zend-servicemanager/pull/71) fixes an edge case with alias usage, whereby an alias of an alias was not being resolved to the final service name. @@ -105,7 +105,7 @@ All notable changes to this project will be documented in this file, in reverse ### Fixed -- [#69](https://github.com/zendframework/zend-servicemanager/pull/69) fixes the +- [zendframework/zend-servicemanager#69](https://github.com/zendframework/zend-servicemanager/pull/69) fixes the way aliases are resolved to ensure that the original alias target, without canonicalization is passed to factories and abstract factories, ensuring that features such as the `InvokableFactory` implementation can work. @@ -114,7 +114,7 @@ All notable changes to this project will be documented in this file, in reverse ### Added -- [#63](https://github.com/zendframework/zend-servicemanager/pull/63) adds a +- [zendframework/zend-servicemanager#63](https://github.com/zendframework/zend-servicemanager/pull/63) adds a constructor to `InvokableFactory`. In v2, this allows plugin managers to pass construction options to the factory to use during instantiation of the requested service class, emulating the behavior of `build()` in v3. @@ -135,8 +135,8 @@ All notable changes to this project will be documented in this file, in reverse ### Added -- [#61](https://github.com/zendframework/zend-servicemanager/pull/61) adds - `Zend\ServiceManager\Exception\InvalidServiceException` for forwards +- [zendframework/zend-servicemanager#61](https://github.com/zendframework/zend-servicemanager/pull/61) adds + `Laminas\ServiceManager\Exception\InvalidServiceException` for forwards compatibility with v3. ### Deprecated @@ -149,17 +149,17 @@ All notable changes to this project will be documented in this file, in reverse ### Fixed -- [#61](https://github.com/zendframework/zend-servicemanager/pull/61) updates +- [zendframework/zend-servicemanager#61](https://github.com/zendframework/zend-servicemanager/pull/61) updates the `InvokableFactory` to throw `InvalidServiceException` instead of `InvalidServiceNameException`, for forwards compatibility with v3. -- [#61](https://github.com/zendframework/zend-servicemanager/pull/61) fixes +- [zendframework/zend-servicemanager#61](https://github.com/zendframework/zend-servicemanager/pull/61) fixes the behavior of `InvokableFactory` when invoked after resolving an alias. ## 2.7.0 - 2016-01-11 ### Added -- [#60](https://github.com/zendframework/zend-servicemanager/pull/60) adds +- [zendframework/zend-servicemanager#60](https://github.com/zendframework/zend-servicemanager/pull/60) adds forward compatibility features for `AbstractPluingManager` and introduces `InvokableFactory` to help forward migration to version 3. @@ -173,11 +173,11 @@ All notable changes to this project will be documented in this file, in reverse ### Fixed -- [#46](https://github.com/zendframework/zend-servicemanager/pull/46) updates +- [zendframework/zend-servicemanager#46](https://github.com/zendframework/zend-servicemanager/pull/46) updates the exception hierarchy to inherit from the container-interop exceptions. This ensures that all exceptions thrown by the component follow the recommendations of that project. -- [#52](https://github.com/zendframework/zend-servicemanager/pull/52) fixes +- [zendframework/zend-servicemanager#52](https://github.com/zendframework/zend-servicemanager/pull/52) fixes the exception message thrown by `ServiceManager::setFactory()` to remove references to abstract factories. @@ -185,7 +185,7 @@ All notable changes to this project will be documented in this file, in reverse ### Added -- [#4](https://github.com/zendframework/zend-servicemanager/pull/4) updates the +- [zendframework/zend-servicemanager#4](https://github.com/zendframework/zend-servicemanager/pull/4) updates the `ServiceManager` to [implement the container-interop interface](https://github.com/container-interop/container-interop), allowing interoperability with applications that consume that interface. @@ -199,7 +199,7 @@ All notable changes to this project will be documented in this file, in reverse ### Fixed -- [#3](https://github.com/zendframework/zend-servicemanager/pull/3) properly updates the +- [zendframework/zend-servicemanager#3](https://github.com/zendframework/zend-servicemanager/pull/3) properly updates the codebase to PHP 5.5, by taking advantage of the default closure binding (`$this` in a closure is the invoking object when created within a method). It also removes several `@requires PHP 5.4.0` annotations. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md deleted file mode 100644 index ebc6d64c..00000000 --- a/CONTRIBUTING.md +++ /dev/null @@ -1,229 +0,0 @@ -# CONTRIBUTING - -## RESOURCES - -If you wish to contribute to Zend Framework, please be sure to -read/subscribe to the following resources: - - - [Coding Standards](https://github.com/zendframework/zf2/wiki/Coding-Standards) - - [Contributor's Guide](http://framework.zend.com/participate/contributor-guide) - - ZF Contributor's mailing list: - Archives: http://zend-framework-community.634137.n4.nabble.com/ZF-Contributor-f680267.html - Subscribe: zf-contributors-subscribe@lists.zend.com - - ZF Contributor's IRC channel: - #zftalk.dev on Freenode.net - -If you are working on new features or refactoring [create a proposal](https://github.com/zendframework/zend-servicemanager/issues/new). - -## Reporting Potential Security Issues - -If you have encountered a potential security vulnerability, please **DO NOT** report it on the public -issue tracker: send it to us at [zf-security@zend.com](mailto:zf-security@zend.com) instead. -We will work with you to verify the vulnerability and patch it as soon as possible. - -When reporting issues, please provide the following information: - -- Component(s) affected -- A description indicating how to reproduce the issue -- A summary of the security vulnerability and impact - -We request that you contact us via the email address above and give the project -contributors a chance to resolve the vulnerability and issue a new release prior -to any public exposure; this helps protect users and provides them with a chance -to upgrade and/or update in order to protect their applications. - -For sensitive email communications, please use [our PGP key](http://framework.zend.com/zf-security-pgp-key.asc). - -## RUNNING TESTS - -> ### Note: testing versions prior to 2.4 -> -> This component originates with Zend Framework 2. During the lifetime of ZF2, -> testing infrastructure migrated from PHPUnit 3 to PHPUnit 4. In most cases, no -> changes were necessary. However, due to the migration, tests may not run on -> versions < 2.4. As such, you may need to change the PHPUnit dependency if -> attempting a fix on such a version. - -To run tests: - -- Clone the repository: - - ```console - $ git clone git@github.com:zendframework/zend-servicemanager.git - $ cd - ``` - -- Install dependencies via composer: - - ```console - $ curl -sS https://getcomposer.org/installer | php -- - $ ./composer.phar install - ``` - - If you don't have `curl` installed, you can also download `composer.phar` from https://getcomposer.org/ - -- Run the tests via `phpunit` and the provided PHPUnit config, like in this example: - - ```console - $ ./vendor/bin/phpunit - ``` - -You can turn on conditional tests with the phpunit.xml file. -To do so: - - - Copy `phpunit.xml.dist` file to `phpunit.xml` - - Edit `phpunit.xml` to enable any specific functionality you - want to test, as well as to provide test values to utilize. - -## Running Coding Standards Checks - -This component uses [php-cs-fixer](http://cs.sensiolabs.org/) for coding -standards checks, and provides configuration for our selected checks. -`php-cs-fixer` is installed by default via Composer. - -To run checks only: - -```console -$ ./vendor/bin/php-cs-fixer fix . -v --diff --dry-run --config-file=.php_cs -``` - -To have `php-cs-fixer` attempt to fix problems for you, omit the `--dry-run` -flag: - -```console -$ ./vendor/bin/php-cs-fixer fix . -v --diff --config-file=.php_cs -``` - -If you allow php-cs-fixer to fix CS issues, please re-run the tests to ensure -they pass, and make sure you add and commit the changes after verification. - -## Recommended Workflow for Contributions - -Your first step is to establish a public repository from which we can -pull your work into the master repository. We recommend using -[GitHub](https://github.com), as that is where the component is already hosted. - -1. Setup a [GitHub account](http://github.com/), if you haven't yet -2. Fork the repository (http://github.com/zendframework/zend-servicemanager) -3. Clone the canonical repository locally and enter it. - - ```console - $ git clone git://github.com:zendframework/zend-servicemanager.git - $ cd zend-servicemanager - ``` - -4. Add a remote to your fork; substitute your GitHub username in the command - below. - - ```console - $ git remote add {username} git@github.com:{username}/zend-servicemanager.git - $ git fetch {username} - ``` - -### Keeping Up-to-Date - -Periodically, you should update your fork or personal repository to -match the canonical ZF repository. Assuming you have setup your local repository -per the instructions above, you can do the following: - - -```console -$ git checkout master -$ git fetch origin -$ git rebase origin/master -# OPTIONALLY, to keep your remote up-to-date - -$ git push {username} master:master -``` - -If you're tracking other branches -- for example, the "develop" branch, where -new feature development occurs -- you'll want to do the same operations for that -branch; simply substitute "develop" for "master". - -### Working on a patch - -We recommend you do each new feature or bugfix in a new branch. This simplifies -the task of code review as well as the task of merging your changes into the -canonical repository. - -A typical workflow will then consist of the following: - -1. Create a new local branch based off either your master or develop branch. -2. Switch to your new local branch. (This step can be combined with the - previous step with the use of `git checkout -b`.) -3. Do some work, commit, repeat as necessary. -4. Push the local branch to your remote repository. -5. Send a pull request. - -The mechanics of this process are actually quite trivial. Below, we will -create a branch for fixing an issue in the tracker. - -```console -$ git checkout -b hotfix/9295 -Switched to a new branch 'hotfix/9295' -``` - -... do some work ... - - -```console -$ git commit -``` - -... write your log message ... - - -```console -$ git push {username} hotfix/9295:hotfix/9295 -Counting objects: 38, done. -Delta compression using up to 2 threads. -Compression objects: 100% (18/18), done. -Writing objects: 100% (20/20), 8.19KiB, done. -Total 20 (delta 12), reused 0 (delta 0) -To ssh://git@github.com/{username}/zend-servicemanager.git - b5583aa..4f51698 HEAD -> master -``` - -To send a pull request, you have two options. - -If using GitHub, you can do the pull request from there. Navigate to -your repository, select the branch you just created, and then select the -"Pull Request" button in the upper right. Select the user/organization -"zendframework" as the recipient. - -If using your own repository - or even if using GitHub - you can use `git -format-patch` to create a patchset for us to apply; in fact, this is -**recommended** for security-related patches. If you use `format-patch`, please -send the patches as attachments to: - -- zf-devteam@zend.com for patches without security implications -- zf-security@zend.com for security patches - -#### What branch to issue the pull request against? - -Which branch should you issue a pull request against? - -- For fixes against the stable release, issue the pull request against the - "master" branch. -- For new features, or fixes that introduce new elements to the public API (such - as new public methods or properties), issue the pull request against the - "develop" branch. - -### Branch Cleanup - -As you might imagine, if you are a frequent contributor, you'll start to -get a ton of branches both locally and on your remote. - -Once you know that your changes have been accepted to the master -repository, we suggest doing some cleanup of these branches. - -- Local branch cleanup - - ```console - $ git branch -d - ``` - -- Remote branch removal - - ```console - $ git push {username} : - ``` diff --git a/COPYRIGHT.md b/COPYRIGHT.md new file mode 100644 index 00000000..c4fc4fee --- /dev/null +++ b/COPYRIGHT.md @@ -0,0 +1,2 @@ +Copyright (c) 2019, Laminas Foundation. +All rights reserved. (https://getlaminas.org/) diff --git a/LICENSE.md b/LICENSE.md index dbb1b49c..09f53edc 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,20 +1,19 @@ -Copyright (c) 2005-2015, Zend Technologies USA, Inc. - +Copyright (c) 2019, Laminas Foundation All rights reserved. -Redistribution and use in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: -- Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. +- Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. -- Neither the name of Zend Technologies USA, Inc. nor the names of its - contributors may be used to endorse or promote products derived from this - software without specific prior written permission. +- Neither the name of Laminas Foundation nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED diff --git a/README.md b/README.md index d5d6535f..496b8dc0 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,12 @@ -# zend-servicemanager +# laminas-servicemanager -[![Build Status](https://secure.travis-ci.org/zendframework/zend-servicemanager.svg?branch=master)](https://secure.travis-ci.org/zendframework/zend-servicemanager) -[![Coverage Status](https://coveralls.io/repos/zendframework/zend-servicemanager/badge.svg?branch=master)](https://coveralls.io/r/zendframework/zend-servicemanager?branch=master) +[![Build Status](https://travis-ci.org/laminas/laminas-servicemanager.svg?branch=master)](https://travis-ci.org/laminas/laminas-servicemanager) +[![Coverage Status](https://coveralls.io/repos/laminas/laminas-servicemanager/badge.svg?branch=master)](https://coveralls.io/r/laminas/laminas-servicemanager?branch=master) -The Service Locator design pattern is implemented by the `Zend\ServiceManager` +The Service Locator design pattern is implemented by the `Laminas\ServiceManager` component. The Service Locator is a service/object locator, tasked with retrieving other objects. -- File issues at https://github.com/zendframework/zend-servicemanager/issues -- Documentation is at http://framework.zend.com/manual/current/en/index.html#zend-servicemanager +- File issues at https://github.com/laminas/laminas-servicemanager/issues +- Documentation is at https://docs.laminas.dev/laminas-servicemanager diff --git a/benchmarks/BenchAsset/AbstractFactoryFoo.php b/benchmarks/BenchAsset/AbstractFactoryFoo.php index bda63495..bf5aa012 100644 --- a/benchmarks/BenchAsset/AbstractFactoryFoo.php +++ b/benchmarks/BenchAsset/AbstractFactoryFoo.php @@ -1,8 +1,8 @@ - + ./test/ @@ -26,9 +26,9 @@ - + diff --git a/src/AbstractFactoryInterface.php b/src/AbstractFactoryInterface.php index 96bffea8..a41feaa8 100644 --- a/src/AbstractFactoryInterface.php +++ b/src/AbstractFactoryInterface.php @@ -1,13 +1,12 @@ = 5.3.23 + * @deprecated since laminas 2.3 requires PHP >= 5.3.23 * * @param string $className * @param string $type * @return bool * - * @deprecated this method is being deprecated as of zendframework 2.2, and may be removed in future major versions + * @deprecated this method is being deprecated as of laminas 2.2, and may be removed in future major versions */ protected static function isSubclassOf($className, $type) { diff --git a/src/ServiceManagerAwareInterface.php b/src/ServiceManagerAwareInterface.php index 2519bbaf..b64640ff 100644 --- a/src/ServiceManagerAwareInterface.php +++ b/src/ServiceManagerAwareInterface.php @@ -1,13 +1,12 @@ serviceManager = new ServiceManager(); $this->pluginManager = new FooPluginManager(new Config([ 'factories' => [ - 'Foo' => 'ZendTest\ServiceManager\TestAsset\FooFactory', + 'Foo' => 'LaminasTest\ServiceManager\TestAsset\FooFactory', ], 'shared' => [ 'Foo' => false, @@ -53,7 +52,7 @@ public function testSetMultipleCreationOptions() { $pluginManager = new FooPluginManager(new Config([ 'factories' => [ - 'Foo' => 'ZendTest\ServiceManager\TestAsset\FooFactory' + 'Foo' => 'LaminasTest\ServiceManager\TestAsset\FooFactory' ], 'shared' => [ 'Foo' => false @@ -70,13 +69,13 @@ public function testSetMultipleCreationOptions() $pluginManager->get('Foo', ['key1' => 'value1']); $value = $reflProperty->getValue($pluginManager); - $this->assertInstanceOf('ZendTest\ServiceManager\TestAsset\FooFactory', $value['foo']); + $this->assertInstanceOf('LaminasTest\ServiceManager\TestAsset\FooFactory', $value['foo']); $this->assertEquals(['key1' => 'value1'], $value['foo']->getCreationOptions()); $pluginManager->get('Foo', ['key2' => 'value2']); $value = $reflProperty->getValue($pluginManager); - $this->assertInstanceOf('ZendTest\ServiceManager\TestAsset\FooFactory', $value['foo']); + $this->assertInstanceOf('LaminasTest\ServiceManager\TestAsset\FooFactory', $value['foo']); $this->assertEquals(['key2' => 'value2'], $value['foo']->getCreationOptions()); } @@ -85,7 +84,7 @@ public function testSetMultipleCreationOptions() */ public function testGetFaultyRegisteredInvokableThrowsException() { - $this->setExpectedException('Zend\ServiceManager\Exception\ServiceNotFoundException'); + $this->setExpectedException('Laminas\ServiceManager\Exception\ServiceNotFoundException'); $pluginManager = new FooPluginManager(); $pluginManager->setInvokableClass('helloWorld', 'IDoNotExist'); @@ -95,7 +94,7 @@ public function testGetFaultyRegisteredInvokableThrowsException() public function testAbstractFactoryWithMutableCreationOptions() { $creationOptions = ['key1' => 'value1']; - $mock = 'ZendTest\ServiceManager\TestAsset\AbstractFactoryWithMutableCreationOptions'; + $mock = 'LaminasTest\ServiceManager\TestAsset\AbstractFactoryWithMutableCreationOptions'; $abstractFactory = $this->getMock($mock, ['setCreationOptions']); $abstractFactory->expects($this->once()) ->method('setCreationOptions') @@ -108,7 +107,7 @@ public function testAbstractFactoryWithMutableCreationOptions() public function testMutableMethodNeverCalledWithoutCreationOptions() { - $mock = 'ZendTest\ServiceManager\TestAsset\CallableWithMutableCreationOptions'; + $mock = 'LaminasTest\ServiceManager\TestAsset\CallableWithMutableCreationOptions'; $callable = $this->getMock($mock, ['setCreationOptions']); $callable->expects($this->never()) ->method('setCreationOptions'); @@ -123,7 +122,7 @@ public function testMutableMethodNeverCalledWithoutCreationOptions() public function testCallableObjectWithMutableCreationOptions() { $creationOptions = ['key1' => 'value1']; - $mock = 'ZendTest\ServiceManager\TestAsset\CallableWithMutableCreationOptions'; + $mock = 'LaminasTest\ServiceManager\TestAsset\CallableWithMutableCreationOptions'; $callable = $this->getMock($mock, ['setCreationOptions']); $callable->expects($this->once()) ->method('setCreationOptions') @@ -143,7 +142,7 @@ public function testCallableObjectWithMutableCreationOptions() public function testInvokableFactoryOptionsAffectMultipleInstantiations() { /** @var $pluginManager AbstractPluginManager */ - $pluginManager = $this->getMockForAbstractClass('Zend\ServiceManager\AbstractPluginManager'); + $pluginManager = $this->getMockForAbstractClass('Laminas\ServiceManager\AbstractPluginManager'); $pluginManager->setFactory(Baz::class, InvokableFactory::class); $pluginManager->setShared(Baz::class, false); $creationOptions = ['key1' => 'value1']; @@ -155,8 +154,8 @@ public function testInvokableFactoryOptionsAffectMultipleInstantiations() public function testValidatePluginIsCalledWithDelegatorFactoryIfItsAService() { - $pluginManager = $this->getMockForAbstractClass('Zend\ServiceManager\AbstractPluginManager'); - $delegatorFactory = $this->getMock('Zend\\ServiceManager\\DelegatorFactoryInterface'); + $pluginManager = $this->getMockForAbstractClass('Laminas\ServiceManager\AbstractPluginManager'); + $delegatorFactory = $this->getMock('Laminas\\ServiceManager\\DelegatorFactoryInterface'); $pluginManager->setService('delegator-factory', $delegatorFactory); $pluginManager->addDelegator('foo-service', 'delegator-factory'); @@ -170,9 +169,9 @@ public function testValidatePluginIsCalledWithDelegatorFactoryIfItsAService() public function testSingleDelegatorUsage() { - $delegatorFactory = $this->getMock('Zend\\ServiceManager\\DelegatorFactoryInterface'); - /* @var $pluginManager \Zend\ServiceManager\AbstractPluginManager|\PHPUnit_Framework_MockObject_MockObject */ - $pluginManager = $this->getMockForAbstractClass('Zend\ServiceManager\AbstractPluginManager'); + $delegatorFactory = $this->getMock('Laminas\\ServiceManager\\DelegatorFactoryInterface'); + /* @var $pluginManager \Laminas\ServiceManager\AbstractPluginManager|\PHPUnit_Framework_MockObject_MockObject */ + $pluginManager = $this->getMockForAbstractClass('Laminas\ServiceManager\AbstractPluginManager'); $realService = $this->getMock('stdClass', [], [], 'RealService'); $delegator = $this->getMock('stdClass', [], [], 'Delegator'); @@ -207,8 +206,8 @@ public function testSingleDelegatorUsage() public function testMultipleDelegatorsUsage() { - /* @var $pluginManager \Zend\ServiceManager\AbstractPluginManager|\PHPUnit_Framework_MockObject_MockObject */ - $pluginManager = $this->getMockForAbstractClass('Zend\ServiceManager\AbstractPluginManager'); + /* @var $pluginManager \Laminas\ServiceManager\AbstractPluginManager|\PHPUnit_Framework_MockObject_MockObject */ + $pluginManager = $this->getMockForAbstractClass('Laminas\ServiceManager\AbstractPluginManager'); $fooDelegator = new MockSelfReturningDelegatorFactory(); $barDelegator = new MockSelfReturningDelegatorFactory(); @@ -236,15 +235,15 @@ public function testCanCheckInvalidServiceManagerIsUsed() $sm = new ServiceManager(); $sm->setService('bar', new \stdClass()); - /** @var \Zend\ServiceManager\AbstractPluginManager $pluginManager */ + /** @var \Laminas\ServiceManager\AbstractPluginManager $pluginManager */ $pluginManager = new FooPluginManager(); $pluginManager->setServiceLocator($sm); - $this->setExpectedException('Zend\ServiceManager\Exception\ServiceLocatorUsageException'); + $this->setExpectedException('Laminas\ServiceManager\Exception\ServiceLocatorUsageException'); $pluginManager->get('bar'); - $this->fail('A Zend\ServiceManager\Exception\ServiceNotCreatedException is expected'); + $this->fail('A Laminas\ServiceManager\Exception\ServiceNotCreatedException is expected'); } /** @@ -256,8 +255,8 @@ public function testWillRethrowOnNonValidatedPlugin() $sm->setInvokableClass('stdClass', 'stdClass'); - /** @var \Zend\ServiceManager\AbstractPluginManager|\PHPUnit_Framework_MockObject_MockObject $pluginManager */ - $pluginManager = $this->getMockForAbstractClass('Zend\ServiceManager\AbstractPluginManager'); + /** @var \Laminas\ServiceManager\AbstractPluginManager|\PHPUnit_Framework_MockObject_MockObject $pluginManager */ + $pluginManager = $this->getMockForAbstractClass('Laminas\ServiceManager\AbstractPluginManager'); $pluginManager ->expects($this->once()) @@ -267,7 +266,7 @@ public function testWillRethrowOnNonValidatedPlugin() $pluginManager->setServiceLocator($sm); - $this->setExpectedException('Zend\ServiceManager\Exception\ServiceLocatorUsageException'); + $this->setExpectedException('Laminas\ServiceManager\Exception\ServiceLocatorUsageException'); $pluginManager->get('stdClass'); } @@ -277,8 +276,8 @@ public function testWillRethrowOnNonValidatedPlugin() */ public function testWillResetAutoInvokableServiceIfNotValid() { - /** @var \Zend\ServiceManager\AbstractPluginManager|\PHPUnit_Framework_MockObject_MockObject $pluginManager */ - $pluginManager = $this->getMockForAbstractClass('Zend\ServiceManager\AbstractPluginManager'); + /** @var \Laminas\ServiceManager\AbstractPluginManager|\PHPUnit_Framework_MockObject_MockObject $pluginManager */ + $pluginManager = $this->getMockForAbstractClass('Laminas\ServiceManager\AbstractPluginManager'); $pluginManager ->expects($this->any()) diff --git a/test/Di/DiAbstractServiceFactoryTest.php b/test/Di/DiAbstractServiceFactoryTest.php index 10b8d044..a253cd79 100644 --- a/test/Di/DiAbstractServiceFactoryTest.php +++ b/test/Di/DiAbstractServiceFactoryTest.php @@ -1,19 +1,18 @@ addSharedInstance($this->fooInstance = new \stdClass(), 'foo'); - $this->mockDi = $this->getMock('Zend\Di\Di', [], [null, $instanceManager]); - $this->mockServiceLocator = $this->getMock('Zend\ServiceManager\ServiceLocatorInterface'); + $this->mockDi = $this->getMock('Laminas\Di\Di', [], [null, $instanceManager]); + $this->mockServiceLocator = $this->getMock('Laminas\ServiceManager\ServiceLocatorInterface'); $this->diAbstractServiceFactory = new DiAbstractServiceFactory( $this->mockDi ); @@ -44,21 +43,21 @@ public function setup() /** - * @covers Zend\ServiceManager\Di\DiAbstractServiceFactory::__construct + * @covers Laminas\ServiceManager\Di\DiAbstractServiceFactory::__construct */ public function testConstructor() { $instance = new DiAbstractServiceFactory( - $this->getMock('Zend\Di\Di') + $this->getMock('Laminas\Di\Di') ); - $this->assertInstanceOf('Zend\ServiceManager\Di\DiAbstractServiceFactory', $instance); + $this->assertInstanceOf('Laminas\ServiceManager\Di\DiAbstractServiceFactory', $instance); } /** * @group 6021 * - * @covers Zend\ServiceManager\Di\DiAbstractServiceFactory::createServiceWithName - * @covers Zend\ServiceManager\Di\DiAbstractServiceFactory::get + * @covers Laminas\ServiceManager\Di\DiAbstractServiceFactory::createServiceWithName + * @covers Laminas\ServiceManager\Di\DiAbstractServiceFactory::get */ public function testCreateServiceWithNameAndWithoutRequestName() { @@ -67,8 +66,8 @@ public function testCreateServiceWithNameAndWithoutRequestName() } /** - * @covers Zend\ServiceManager\Di\DiAbstractServiceFactory::createServiceWithName - * @covers Zend\ServiceManager\Di\DiAbstractServiceFactory::get + * @covers Laminas\ServiceManager\Di\DiAbstractServiceFactory::createServiceWithName + * @covers Laminas\ServiceManager\Di\DiAbstractServiceFactory::get */ public function testCreateServiceWithName() { @@ -77,11 +76,11 @@ public function testCreateServiceWithName() } /** - * @covers Zend\ServiceManager\Di\DiAbstractServiceFactory::canCreateServiceWithName + * @covers Laminas\ServiceManager\Di\DiAbstractServiceFactory::canCreateServiceWithName */ public function testCanCreateServiceWithName() { - $instance = new DiAbstractServiceFactory($this->getMock('Zend\Di\Di')); + $instance = new DiAbstractServiceFactory($this->getMock('Laminas\Di\Di')); $im = $instance->instanceManager(); $locator = new ServiceManager(); @@ -109,7 +108,7 @@ public function testCanCreateServiceWithName() // will check definitions $def = $instance->definitions(); $this->assertFalse($instance->canCreateServiceWithName($locator, __NAMESPACE__ . '\Other\Non\Existing', __NAMESPACE__ . '\Other\Non\Existing')); - $classDefinition = $this->getMock('Zend\Di\Definition\DefinitionInterface'); + $classDefinition = $this->getMock('Laminas\Di\Definition\DefinitionInterface'); $classDefinition ->expects($this->any()) ->method('hasClass') diff --git a/test/Di/DiServiceFactoryTest.php b/test/Di/DiServiceFactoryTest.php index 23d528eb..4a2d44d6 100644 --- a/test/Di/DiServiceFactoryTest.php +++ b/test/Di/DiServiceFactoryTest.php @@ -1,18 +1,17 @@ addSharedInstanceWithParameters( $this->fooInstance = new \stdClass(), 'foo', ['bar' => 'baz'] ); - $this->mockDi = $this->getMock('Zend\Di\Di', [], [null, $instanceManager]); - $this->mockServiceLocator = $this->getMock('Zend\ServiceManager\ServiceLocatorInterface'); + $this->mockDi = $this->getMock('Laminas\Di\Di', [], [null, $instanceManager]); + $this->mockServiceLocator = $this->getMock('Laminas\ServiceManager\ServiceLocatorInterface'); $this->diServiceFactory = new DiServiceFactory( $this->mockDi, 'foo', @@ -48,21 +47,21 @@ public function setup() } /** - * @covers Zend\ServiceManager\Di\DiServiceFactory::__construct + * @covers Laminas\ServiceManager\Di\DiServiceFactory::__construct */ public function testConstructor() { $instance = new DiServiceFactory( - $this->getMock('Zend\Di\Di'), + $this->getMock('Laminas\Di\Di'), 'string', ['foo' => 'bar'] ); - $this->assertInstanceOf('Zend\ServiceManager\Di\DiServiceFactory', $instance); + $this->assertInstanceOf('Laminas\ServiceManager\Di\DiServiceFactory', $instance); } /** - * @covers Zend\ServiceManager\Di\DiServiceFactory::createService - * @covers Zend\ServiceManager\Di\DiServiceFactory::get + * @covers Laminas\ServiceManager\Di\DiServiceFactory::createService + * @covers Laminas\ServiceManager\Di\DiServiceFactory::get */ public function testCreateService() { diff --git a/test/Di/DiServiceInitializerTest.php b/test/Di/DiServiceInitializerTest.php index 08d79da0..8469f037 100644 --- a/test/Di/DiServiceInitializerTest.php +++ b/test/Di/DiServiceInitializerTest.php @@ -1,19 +1,18 @@ mockDi = $this->getMock('Zend\Di\Di', ['injectDependencies']); - $this->mockServiceLocator = $this->getMock('Zend\ServiceManager\ServiceLocatorInterface'); + $this->mockDi = $this->getMock('Laminas\Di\Di', ['injectDependencies']); + $this->mockServiceLocator = $this->getMock('Laminas\ServiceManager\ServiceLocatorInterface'); $this->mockDiInstanceManagerProxy = new DiInstanceManagerProxy( - $this->mockDiInstanceManager = $this->getMock('Zend\Di\InstanceManager'), + $this->mockDiInstanceManager = $this->getMock('Laminas\Di\InstanceManager'), $this->mockServiceLocator ); $this->diServiceInitializer = new DiServiceInitializer( @@ -47,7 +46,7 @@ public function setup() } /** - * @covers Zend\ServiceManager\Di\DiServiceInitializer::initialize + * @covers Laminas\ServiceManager\Di\DiServiceInitializer::initialize */ public function testInitialize() { @@ -60,12 +59,12 @@ public function testInitialize() } /** - * @covers Zend\ServiceManager\Di\DiServiceInitializer::initialize + * @covers Laminas\ServiceManager\Di\DiServiceInitializer::initialize * @todo this needs to be moved into its own class */ public function testProxyInstanceManagersStayInSync() { - $instanceManager = new \Zend\Di\InstanceManager(); + $instanceManager = new \Laminas\Di\InstanceManager(); $proxy = new DiInstanceManagerProxy($instanceManager, $this->mockServiceLocator); $instanceManager->addAlias('foo', 'bar'); diff --git a/test/Exception/ServiceLocatorUsageExceptionTest.php b/test/Exception/ServiceLocatorUsageExceptionTest.php index 6f7c693d..70d1a4a8 100644 --- a/test/Exception/ServiceLocatorUsageExceptionTest.php +++ b/test/Exception/ServiceLocatorUsageExceptionTest.php @@ -1,31 +1,30 @@ getMockForAbstractClass('Zend\ServiceManager\AbstractPluginManager'); - /* @var $serviceLocator \Zend\ServiceManager\ServiceLocatorInterface */ - $serviceLocator = $this->getMockForAbstractClass('Zend\ServiceManager\ServiceLocatorInterface'); + /* @var $pluginManager \Laminas\ServiceManager\AbstractPluginManager */ + $pluginManager = $this->getMockForAbstractClass('Laminas\ServiceManager\AbstractPluginManager'); + /* @var $serviceLocator \Laminas\ServiceManager\ServiceLocatorInterface */ + $serviceLocator = $this->getMockForAbstractClass('Laminas\ServiceManager\ServiceLocatorInterface'); $previousException = new Exception(); $exception = ServiceLocatorUsageException::fromInvalidPluginManagerRequestedServiceName( @@ -35,9 +34,9 @@ public function testFromInvalidPluginManagerRequestedServiceName() $previousException ); - $this->assertInstanceOf('Zend\ServiceManager\Exception\ServiceLocatorUsageException', $exception); + $this->assertInstanceOf('Laminas\ServiceManager\Exception\ServiceLocatorUsageException', $exception); $this->assertInstanceOf( - 'Zend\ServiceManager\Exception\ServiceNotFoundException', + 'Laminas\ServiceManager\Exception\ServiceNotFoundException', $exception, 'Must be a ServiceNotFoundException for BC compatibility with older try-catch logic' ); diff --git a/test/Factory/InvokableFactoryTest.php b/test/Factory/InvokableFactoryTest.php index 62b53f77..a95c0cfb 100644 --- a/test/Factory/InvokableFactoryTest.php +++ b/test/Factory/InvokableFactoryTest.php @@ -1,23 +1,22 @@ markTestSkipped('Requires PHP >=5.4.0'); } - $this->stub = $this->getObjectForTrait('Zend\ServiceManager\MutableCreationOptionsTrait'); + $this->stub = $this->getObjectForTrait('Laminas\ServiceManager\MutableCreationOptionsTrait'); } public function tearDown() diff --git a/test/Proxy/LazyServiceFactoryFactoryTest.php b/test/Proxy/LazyServiceFactoryFactoryTest.php index 0ff04444..75477550 100644 --- a/test/Proxy/LazyServiceFactoryFactoryTest.php +++ b/test/Proxy/LazyServiceFactoryFactoryTest.php @@ -1,21 +1,20 @@ getMock('Zend\\ServiceManager\\ServiceLocatorInterface'); + $locator = $this->getMock('Laminas\\ServiceManager\\ServiceLocatorInterface'); $factory = new LazyServiceFactoryFactory(); $locator->expects($this->any())->method('get')->with('Config')->will($this->returnValue($config)); - $this->setExpectedException('Zend\\ServiceManager\\Exception\\InvalidArgumentException'); + $this->setExpectedException('Laminas\\ServiceManager\\Exception\\InvalidArgumentException'); $factory->createService($locator); } @@ -46,7 +45,7 @@ public function testInvalidConfiguration($config) public function testAutoGenerateProxyFiles() { $serviceManager = new ServiceManager(); - $namespace = 'ZendTestProxy' . uniqid(); + $namespace = 'LaminasTestProxy' . uniqid(); $serviceManager->setService( 'Config', @@ -58,7 +57,7 @@ public function testAutoGenerateProxyFiles() ], ] ); - $serviceManager->setFactory('foo-delegator', 'Zend\ServiceManager\Proxy\LazyServiceFactoryFactory'); + $serviceManager->setFactory('foo-delegator', 'Laminas\ServiceManager\Proxy\LazyServiceFactoryFactory'); $serviceManager->setInvokableClass('foo', __CLASS__); $serviceManager->addDelegator('foo', 'foo-delegator'); @@ -69,7 +68,7 @@ public function testAutoGenerateProxyFiles() $this->assertInstanceOf('ProxyManager\\Proxy\\LazyLoadingInterface', $proxy); $this->assertInstanceOf(__CLASS__, $proxy); $this->assertStringMatchesFormat( - $namespace . '\__PM__\ZendTest\ServiceManager\Proxy\LazyServiceFactoryFactoryTest%s', + $namespace . '\__PM__\LaminasTest\ServiceManager\Proxy\LazyServiceFactoryFactoryTest%s', $proxyClassName ); $this->assertFileExists(sys_get_temp_dir() . '/' . str_replace('\\', '', $proxyClassName) . '.php'); @@ -81,7 +80,7 @@ public function testAutoGenerateProxyFiles() public function testAutoGenerateAndEvaluateProxies() { $serviceManager = new ServiceManager(); - $namespace = 'ZendTestProxy' . uniqid(); + $namespace = 'LaminasTestProxy' . uniqid(); $serviceManager->setService( 'Config', @@ -92,7 +91,7 @@ public function testAutoGenerateAndEvaluateProxies() ], ] ); - $serviceManager->setFactory('foo-delegator', 'Zend\ServiceManager\Proxy\LazyServiceFactoryFactory'); + $serviceManager->setFactory('foo-delegator', 'Laminas\ServiceManager\Proxy\LazyServiceFactoryFactory'); $serviceManager->setInvokableClass('foo', __CLASS__); $serviceManager->addDelegator('foo', 'foo-delegator'); @@ -103,7 +102,7 @@ public function testAutoGenerateAndEvaluateProxies() $this->assertInstanceOf('ProxyManager\\Proxy\\LazyLoadingInterface', $proxy); $this->assertInstanceOf(__CLASS__, $proxy); $this->assertStringMatchesFormat( - $namespace . '\__PM__\ZendTest\ServiceManager\Proxy\LazyServiceFactoryFactoryTest%s', + $namespace . '\__PM__\LaminasTest\ServiceManager\Proxy\LazyServiceFactoryFactoryTest%s', $proxyClassName ); $this->assertFileNotExists(sys_get_temp_dir() . '/' . str_replace('\\', '', $proxyClassName) . '.php'); @@ -116,7 +115,7 @@ public function testRegistersAutoloader() { $autoloaders = spl_autoload_functions(); $serviceManager = new ServiceManager(); - $namespace = 'ZendTestProxy' . uniqid(); + $namespace = 'LaminasTestProxy' . uniqid(); $serviceManager->setService( 'Config', @@ -127,7 +126,7 @@ public function testRegistersAutoloader() ], ] ); - $serviceManager->setFactory('foo-delegator', 'Zend\ServiceManager\Proxy\LazyServiceFactoryFactory'); + $serviceManager->setFactory('foo-delegator', 'Laminas\ServiceManager\Proxy\LazyServiceFactoryFactory'); $serviceManager->create('foo-delegator'); $currentAutoloaders = spl_autoload_functions(); diff --git a/test/Proxy/LazyServiceFactoryTest.php b/test/Proxy/LazyServiceFactoryTest.php index 683915ee..3b2b26e4 100644 --- a/test/Proxy/LazyServiceFactoryTest.php +++ b/test/Proxy/LazyServiceFactoryTest.php @@ -1,20 +1,19 @@ markTestSkipped('Please install `ocramius/proxy-manager` to run these tests'); } - $this->locator = $this->getMock('Zend\\ServiceManager\\ServiceLocatorInterface'); + $this->locator = $this->getMock('Laminas\\ServiceManager\\ServiceLocatorInterface'); $this->proxyFactory = $this ->getMockBuilder('ProxyManager\\Factory\\LazyLoadingValueHolderFactory') ->disableOriginalConstructor() @@ -80,7 +79,7 @@ public function testCannotCreateDelegatorWithNoMappedServiceClass() { $factory = new LazyServiceFactory($this->proxyFactory, []); - $this->setExpectedException('Zend\\ServiceManager\\Exception\\InvalidServiceNameException'); + $this->setExpectedException('Laminas\\ServiceManager\\Exception\\InvalidServiceNameException'); $factory->createDelegatorWithName($this->locator, 'foo', 'baz', function () {}); } diff --git a/test/ServiceLocatorAwareTraitTest.php b/test/ServiceLocatorAwareTraitTest.php index 8bdae845..cfb98e9b 100644 --- a/test/ServiceLocatorAwareTraitTest.php +++ b/test/ServiceLocatorAwareTraitTest.php @@ -1,25 +1,24 @@ getObjectForTrait('\Zend\ServiceManager\ServiceLocatorAwareTrait'); + $object = $this->getObjectForTrait('\Laminas\ServiceManager\ServiceLocatorAwareTrait'); $this->assertAttributeEquals(null, 'serviceLocator', $object); @@ -32,7 +31,7 @@ public function testSetServiceLocator() public function testGetServiceLocator() { - $object = $this->getObjectForTrait('\Zend\ServiceManager\ServiceLocatorAwareTrait'); + $object = $this->getObjectForTrait('\Laminas\ServiceManager\ServiceLocatorAwareTrait'); $this->assertNull($object->getServiceLocator()); diff --git a/test/ServiceManagerTest.php b/test/ServiceManagerTest.php index 31b9f445..0464922e 100644 --- a/test/ServiceManagerTest.php +++ b/test/ServiceManagerTest.php @@ -1,28 +1,27 @@ serviceManager->setFactory('foo', 'bar'); - $this->setExpectedException('Zend\ServiceManager\Exception\InvalidServiceNameException'); + $this->setExpectedException('Laminas\ServiceManager\Exception\InvalidServiceNameException'); $this->serviceManager->setFactory('foo', 'bar'); } /** - * @covers Zend\ServiceManager\ServiceManager::addAbstractFactory + * @covers Laminas\ServiceManager\ServiceManager::addAbstractFactory */ public function testAddAbstractFactory() { - $this->serviceManager->addAbstractFactory('ZendTest\ServiceManager\TestAsset\FooAbstractFactory'); + $this->serviceManager->addAbstractFactory('LaminasTest\ServiceManager\TestAsset\FooAbstractFactory'); $ret = $this->serviceManager->addAbstractFactory(new TestAsset\FooAbstractFactory()); $this->assertSame($this->serviceManager, $ret); } /** - * @covers Zend\ServiceManager\ServiceManager::addAbstractFactory + * @covers Laminas\ServiceManager\ServiceManager::addAbstractFactory */ public function testAddAbstractFactoryThrowsExceptionOnInvalidFactory() { - $this->setExpectedException('Zend\ServiceManager\Exception\InvalidArgumentException'); + $this->setExpectedException('Laminas\ServiceManager\Exception\InvalidArgumentException'); $this->serviceManager->addAbstractFactory(10); } @@ -136,7 +135,7 @@ public function testServiceManagerIsPassedToInitializer() } /** - * @covers Zend\ServiceManager\ServiceManager::addInitializer + * @covers Laminas\ServiceManager\ServiceManager::addInitializer */ public function testAddInitializer() { @@ -145,16 +144,16 @@ public function testAddInitializer() } /** - * @covers Zend\ServiceManager\ServiceManager::addInitializer + * @covers Laminas\ServiceManager\ServiceManager::addInitializer */ public function testAddInitializerThrowsExceptionOnInvalidInitializer() { - $this->setExpectedException('Zend\ServiceManager\Exception\InvalidArgumentException'); + $this->setExpectedException('Laminas\ServiceManager\Exception\InvalidArgumentException'); $this->serviceManager->addInitializer(5); } /** - * @covers Zend\ServiceManager\ServiceManager::setService + * @covers Laminas\ServiceManager\ServiceManager::setService */ public function testSetService() { @@ -163,7 +162,7 @@ public function testSetService() } /** - * @covers Zend\ServiceManager\ServiceManager::setShared + * @covers Laminas\ServiceManager\ServiceManager::setShared */ public function testSetShared() { @@ -173,26 +172,26 @@ public function testSetShared() } /** - * @covers Zend\ServiceManager\ServiceManager::setShared + * @covers Laminas\ServiceManager\ServiceManager::setShared */ public function testSetSharedAbstractFactory() { - $this->serviceManager->addAbstractFactory('ZendTest\ServiceManager\TestAsset\FooAbstractFactory'); + $this->serviceManager->addAbstractFactory('LaminasTest\ServiceManager\TestAsset\FooAbstractFactory'); $ret = $this->serviceManager->setShared('foo', false); $this->assertSame($this->serviceManager, $ret); } /** - * @covers Zend\ServiceManager\ServiceManager::setShared + * @covers Laminas\ServiceManager\ServiceManager::setShared */ public function testSetSharedThrowsExceptionOnUnregisteredService() { - $this->setExpectedException('Zend\ServiceManager\Exception\ServiceNotFoundException'); + $this->setExpectedException('Laminas\ServiceManager\Exception\ServiceNotFoundException'); $this->serviceManager->setShared('foo', true); } /** - * @covers Zend\ServiceManager\ServiceManager::get + * @covers Laminas\ServiceManager\ServiceManager::get */ public function testGet() { @@ -201,7 +200,7 @@ public function testGet() } /** - * @covers Zend\ServiceManager\ServiceManager::get + * @covers Laminas\ServiceManager\ServiceManager::get */ public function testGetDoesNotThrowExceptionOnEmptyArray() { @@ -210,33 +209,33 @@ public function testGetDoesNotThrowExceptionOnEmptyArray() } /** - * @covers Zend\ServiceManager\ServiceManager::get + * @covers Laminas\ServiceManager\ServiceManager::get */ public function testGetThrowsExceptionOnUnknownService() { - $this->setExpectedException('Zend\ServiceManager\Exception\ServiceNotFoundException'); + $this->setExpectedException('Laminas\ServiceManager\Exception\ServiceNotFoundException'); $this->assertEquals('bar', $this->serviceManager->get('foo')); } /** - * @covers Zend\ServiceManager\ServiceManager::get + * @covers Laminas\ServiceManager\ServiceManager::get */ public function testGetUsesIndivualSharedSettingWhenSetAndDeviatesFromShareByDefaultSetting() { $this->serviceManager->setAllowOverride(true); $this->serviceManager->setShareByDefault(false); - $this->serviceManager->setInvokableClass('foo', 'ZendTest\ServiceManager\TestAsset\Foo'); + $this->serviceManager->setInvokableClass('foo', 'LaminasTest\ServiceManager\TestAsset\Foo'); $this->serviceManager->setShared('foo', true); $this->assertSame($this->serviceManager->get('foo'), $this->serviceManager->get('foo')); $this->serviceManager->setShareByDefault(true); - $this->serviceManager->setInvokableClass('foo', 'ZendTest\ServiceManager\TestAsset\Foo'); + $this->serviceManager->setInvokableClass('foo', 'LaminasTest\ServiceManager\TestAsset\Foo'); $this->serviceManager->setShared('foo', false); $this->assertNotSame($this->serviceManager->get('foo'), $this->serviceManager->get('foo')); } /** - * @covers Zend\ServiceManager\ServiceManager::get + * @covers Laminas\ServiceManager\ServiceManager::get */ public function testGetWithAlias() { @@ -246,7 +245,7 @@ public function testGetWithAlias() } /** - * @covers Zend\ServiceManager\ServiceManager::get + * @covers Laminas\ServiceManager\ServiceManager::get */ public function testGetWithAliasofAliasWithCanonicalizedName() { @@ -257,7 +256,7 @@ public function testGetWithAliasofAliasWithCanonicalizedName() } /** - * @covers Zend\ServiceManager\ServiceManager::get + * @covers Laminas\ServiceManager\ServiceManager::get */ public function testGetAbstractFactoryWithAlias() { @@ -279,7 +278,7 @@ public function testGetAbstractFactoryWithAlias() } /** - * @covers Zend\ServiceManager\ServiceManager::get + * @covers Laminas\ServiceManager\ServiceManager::get */ public function testGetWithScopedContainer() { @@ -322,72 +321,72 @@ public function testAllowsRetrievingFromPeeringContainerFirst() } /** - * @covers Zend\ServiceManager\ServiceManager::create + * @covers Laminas\ServiceManager\ServiceManager::create */ public function testCreateWithInvokableClass() { - $this->serviceManager->setInvokableClass('foo', 'ZendTest\ServiceManager\TestAsset\Foo'); - $this->assertInstanceOf('ZendTest\ServiceManager\TestAsset\Foo', $this->serviceManager->get('foo')); + $this->serviceManager->setInvokableClass('foo', 'LaminasTest\ServiceManager\TestAsset\Foo'); + $this->assertInstanceOf('LaminasTest\ServiceManager\TestAsset\Foo', $this->serviceManager->get('foo')); } /** - * @covers Zend\ServiceManager\ServiceManager::create + * @covers Laminas\ServiceManager\ServiceManager::create */ public function testCreateWithFactoryInstance() { - $this->serviceManager->setFactory('foo', 'ZendTest\ServiceManager\TestAsset\FooFactory'); - $this->assertInstanceOf('ZendTest\ServiceManager\TestAsset\Foo', $this->serviceManager->get('foo')); + $this->serviceManager->setFactory('foo', 'LaminasTest\ServiceManager\TestAsset\FooFactory'); + $this->assertInstanceOf('LaminasTest\ServiceManager\TestAsset\Foo', $this->serviceManager->get('foo')); } /** - * @covers Zend\ServiceManager\ServiceManager::create + * @covers Laminas\ServiceManager\ServiceManager::create */ public function testCreateWithCallableFactory() { $this->serviceManager->setFactory('foo', function () { return new TestAsset\Foo; }); - $this->assertInstanceOf('ZendTest\ServiceManager\TestAsset\Foo', $this->serviceManager->get('foo')); + $this->assertInstanceOf('LaminasTest\ServiceManager\TestAsset\Foo', $this->serviceManager->get('foo')); } /** - * @covers Zend\ServiceManager\ServiceManager::create + * @covers Laminas\ServiceManager\ServiceManager::create */ public function testCreateWithAbstractFactory() { - $this->serviceManager->addAbstractFactory('ZendTest\ServiceManager\TestAsset\FooAbstractFactory'); - $this->assertInstanceOf('ZendTest\ServiceManager\TestAsset\Foo', $this->serviceManager->get('foo')); + $this->serviceManager->addAbstractFactory('LaminasTest\ServiceManager\TestAsset\FooAbstractFactory'); + $this->assertInstanceOf('LaminasTest\ServiceManager\TestAsset\Foo', $this->serviceManager->get('foo')); } /** - * @covers Zend\ServiceManager\ServiceManager::create + * @covers Laminas\ServiceManager\ServiceManager::create */ public function testCreateWithMultipleAbstractFactories() { - $this->serviceManager->addAbstractFactory('ZendTest\ServiceManager\TestAsset\BarAbstractFactory'); - $this->serviceManager->addAbstractFactory('ZendTest\ServiceManager\TestAsset\FooAbstractFactory'); + $this->serviceManager->addAbstractFactory('LaminasTest\ServiceManager\TestAsset\BarAbstractFactory'); + $this->serviceManager->addAbstractFactory('LaminasTest\ServiceManager\TestAsset\FooAbstractFactory'); - $this->assertInstanceOf('ZendTest\ServiceManager\TestAsset\Bar', $this->serviceManager->get('bar')); + $this->assertInstanceOf('LaminasTest\ServiceManager\TestAsset\Bar', $this->serviceManager->get('bar')); } /** - * @covers Zend\ServiceManager\ServiceManager::create + * @covers Laminas\ServiceManager\ServiceManager::create */ public function testCreateTheSameServiceWithMultipleAbstractFactories() { - $this->serviceManager->addAbstractFactory('ZendTest\ServiceManager\TestAsset\FooFakeAbstractFactory'); - $this->serviceManager->addAbstractFactory('ZendTest\ServiceManager\TestAsset\FooAbstractFactory'); + $this->serviceManager->addAbstractFactory('LaminasTest\ServiceManager\TestAsset\FooFakeAbstractFactory'); + $this->serviceManager->addAbstractFactory('LaminasTest\ServiceManager\TestAsset\FooAbstractFactory'); - $this->assertInstanceOf('ZendTest\ServiceManager\TestAsset\Foo', $this->serviceManager->get('foo')); + $this->assertInstanceOf('LaminasTest\ServiceManager\TestAsset\Foo', $this->serviceManager->get('foo')); } /** - * @covers Zend\ServiceManager\ServiceManager::create + * @covers Laminas\ServiceManager\ServiceManager::create */ public function testCreateTheSameServiceWithMultipleAbstractFactoriesReversePriority() { - $this->serviceManager->addAbstractFactory('ZendTest\ServiceManager\TestAsset\FooAbstractFactory'); - $this->serviceManager->addAbstractFactory('ZendTest\ServiceManager\TestAsset\FooFakeAbstractFactory'); + $this->serviceManager->addAbstractFactory('LaminasTest\ServiceManager\TestAsset\FooAbstractFactory'); + $this->serviceManager->addAbstractFactory('LaminasTest\ServiceManager\TestAsset\FooFakeAbstractFactory'); - $this->assertInstanceOf('ZendTest\ServiceManager\TestAsset\FooFake', $this->serviceManager->get('foo')); + $this->assertInstanceOf('LaminasTest\ServiceManager\TestAsset\FooFake', $this->serviceManager->get('foo')); } public function testCreateWithInitializerObject() @@ -413,7 +412,7 @@ public function testHasAcceptsArrays() } /** - * @covers Zend\ServiceManager\ServiceManager::has + * @covers Laminas\ServiceManager\ServiceManager::has */ public function testHas() { @@ -423,7 +422,7 @@ public function testHas() } /** - * @covers Zend\ServiceManager\ServiceManager::setAlias + * @covers Laminas\ServiceManager\ServiceManager::setAlias */ public function testSetAlias() { @@ -433,37 +432,37 @@ public function testSetAlias() } /** - * @covers Zend\ServiceManager\ServiceManager::setAlias + * @covers Laminas\ServiceManager\ServiceManager::setAlias */ public function testSetAliasThrowsExceptionOnInvalidAliasName() { - $this->setExpectedException('Zend\ServiceManager\Exception\InvalidServiceNameException'); + $this->setExpectedException('Laminas\ServiceManager\Exception\InvalidServiceNameException'); $this->serviceManager->setAlias(5, 10); } /** - * @covers Zend\ServiceManager\ServiceManager::setAlias + * @covers Laminas\ServiceManager\ServiceManager::setAlias */ public function testSetAliasThrowsExceptionOnEmptyAliasName() { - $this->setExpectedException('Zend\ServiceManager\Exception\InvalidServiceNameException'); + $this->setExpectedException('Laminas\ServiceManager\Exception\InvalidServiceNameException'); $this->serviceManager->setAlias('', 'foo'); } /** - * @covers Zend\ServiceManager\ServiceManager::setAlias + * @covers Laminas\ServiceManager\ServiceManager::setAlias */ public function testSetAliasThrowsExceptionOnDuplicateAlias() { $this->serviceManager->setService('foo', 'bar'); $this->serviceManager->setAlias('baz', 'foo'); - $this->setExpectedException('Zend\ServiceManager\Exception\InvalidServiceNameException'); + $this->setExpectedException('Laminas\ServiceManager\Exception\InvalidServiceNameException'); $this->serviceManager->setAlias('baz', 'foo'); } /** - * @covers Zend\ServiceManager\ServiceManager::setAlias + * @covers Laminas\ServiceManager\ServiceManager::setAlias */ public function testSetAliasDoesNotThrowExceptionOnServiceNotFound() { @@ -471,28 +470,28 @@ public function testSetAliasDoesNotThrowExceptionOnServiceNotFound() } /** - * @covers Zend\ServiceManager\ServiceManager::get + * @covers Laminas\ServiceManager\ServiceManager::get */ public function testGetServiceThrowsExceptionOnAliasWithNoSetService() { - $this->setExpectedException('Zend\ServiceManager\Exception\ServiceNotFoundException'); + $this->setExpectedException('Laminas\ServiceManager\Exception\ServiceNotFoundException'); $this->serviceManager->setAlias('foo', 'bar'); $this->serviceManager->get('foo'); } /** - * @cover Zend\ServiceManager\ServiceManager::get + * @cover Laminas\ServiceManager\ServiceManager::get */ public function testGetServiceThrowsExceptionOnMultipleAliasesWithNoSetService() { - $this->setExpectedException('Zend\ServiceManager\Exception\ServiceNotFoundException'); + $this->setExpectedException('Laminas\ServiceManager\Exception\ServiceNotFoundException'); $this->serviceManager->setAlias('foo', 'bar'); $this->serviceManager->setAlias('baz', 'foo'); $this->serviceManager->get('foo'); } /** - * @covers Zend\ServiceManager\ServiceManager::hasAlias + * @covers Laminas\ServiceManager\ServiceManager::hasAlias */ public function testHasAlias() { @@ -504,7 +503,7 @@ public function testHasAlias() } /** - * @covers Zend\ServiceManager\ServiceManager::createScopedServiceManager + * @covers Laminas\ServiceManager\ServiceManager::createScopedServiceManager */ public function testCreateScopedServiceManager() { @@ -524,66 +523,66 @@ public function testConfigureWithInvokableClass() { $config = new Config([ 'invokables' => [ - 'foo' => 'ZendTest\ServiceManager\TestAsset\Foo', + 'foo' => 'LaminasTest\ServiceManager\TestAsset\Foo', ], ]); $serviceManager = new ServiceManager($config); $foo = $serviceManager->get('foo'); - $this->assertInstanceOf('ZendTest\ServiceManager\TestAsset\Foo', $foo); + $this->assertInstanceOf('LaminasTest\ServiceManager\TestAsset\Foo', $foo); } public function testPeeringService() { $di = new Di(); - $di->instanceManager()->setParameters('ZendTest\ServiceManager\TestAsset\Bar', ['foo' => ['a']]); + $di->instanceManager()->setParameters('LaminasTest\ServiceManager\TestAsset\Bar', ['foo' => ['a']]); $this->serviceManager->addAbstractFactory(new DiAbstractServiceFactory($di)); $sm = $this->serviceManager->createScopedServiceManager(ServiceManager::SCOPE_PARENT); $sm->setFactory('di', new DiFactory()); - $bar = $sm->get('ZendTest\ServiceManager\TestAsset\Bar', true); - $this->assertInstanceOf('ZendTest\ServiceManager\TestAsset\Bar', $bar); + $bar = $sm->get('LaminasTest\ServiceManager\TestAsset\Bar', true); + $this->assertInstanceOf('LaminasTest\ServiceManager\TestAsset\Bar', $bar); } public function testDiAbstractServiceFactory() { - $di = $this->getMock('Zend\Di\Di'); + $di = $this->getMock('Laminas\Di\Di'); $factory = new DiAbstractServiceFactory($di); - $factory->instanceManager()->setConfig('ZendTest\ServiceManager\TestAsset\Bar', ['parameters' => ['foo' => ['a']]]); + $factory->instanceManager()->setConfig('LaminasTest\ServiceManager\TestAsset\Bar', ['parameters' => ['foo' => ['a']]]); $this->serviceManager->addAbstractFactory($factory); - $this->assertTrue($this->serviceManager->has('ZendTest\ServiceManager\TestAsset\Bar', true)); + $this->assertTrue($this->serviceManager->has('LaminasTest\ServiceManager\TestAsset\Bar', true)); - $bar = $this->serviceManager->get('ZendTest\ServiceManager\TestAsset\Bar', true); - $this->assertInstanceOf('ZendTest\ServiceManager\TestAsset\Bar', $bar); + $bar = $this->serviceManager->get('LaminasTest\ServiceManager\TestAsset\Bar', true); + $this->assertInstanceOf('LaminasTest\ServiceManager\TestAsset\Bar', $bar); } public function testExceptionThrowingFactory() { - $this->serviceManager->setFactory('foo', 'ZendTest\ServiceManager\TestAsset\ExceptionThrowingFactory'); + $this->serviceManager->setFactory('foo', 'LaminasTest\ServiceManager\TestAsset\ExceptionThrowingFactory'); try { $this->serviceManager->get('foo'); $this->fail("No exception thrown"); } catch (Exception\ServiceNotCreatedException $e) { - $this->assertInstanceOf('ZendTest\ServiceManager\TestAsset\FooException', $e->getPrevious()); + $this->assertInstanceOf('LaminasTest\ServiceManager\TestAsset\FooException', $e->getPrevious()); } } /** - * @expectedException Zend\ServiceManager\Exception\ServiceNotFoundException + * @expectedException Laminas\ServiceManager\Exception\ServiceNotFoundException */ public function testCannotUseUnknownServiceNameForAbstractFactory() { $config = new Config([ 'abstract_factories' => [ - 'ZendTest\ServiceManager\TestAsset\FooAbstractFactory', + 'LaminasTest\ServiceManager\TestAsset\FooAbstractFactory', ], ]); $serviceManager = new ServiceManager($config); - $serviceManager->setFactory('foo', 'ZendTest\ServiceManager\TestAsset\FooFactory'); + $serviceManager->setFactory('foo', 'LaminasTest\ServiceManager\TestAsset\FooFactory'); $foo = $serviceManager->get('unknownObject'); } /** - * @expectedException Zend\ServiceManager\Exception\ServiceNotCreatedException + * @expectedException Laminas\ServiceManager\Exception\ServiceNotCreatedException */ public function testDoNotFallbackToAbstractFactory() { @@ -591,19 +590,19 @@ public function testDoNotFallbackToAbstractFactory() return new TestAsset\Bar(); }; $serviceManager = new ServiceManager(); - $serviceManager->setFactory('ZendTest\ServiceManager\TestAsset\Bar', $factory); + $serviceManager->setFactory('LaminasTest\ServiceManager\TestAsset\Bar', $factory); $di = new Di(); - $di->instanceManager()->setParameters('ZendTest\ServiceManager\TestAsset\Bar', ['foo' => ['a']]); + $di->instanceManager()->setParameters('LaminasTest\ServiceManager\TestAsset\Bar', ['foo' => ['a']]); $serviceManager->addAbstractFactory(new DiAbstractServiceFactory($di)); - $bar = $serviceManager->get('ZendTest\ServiceManager\TestAsset\Bar'); + $bar = $serviceManager->get('LaminasTest\ServiceManager\TestAsset\Bar'); } /** - * @expectedException Zend\ServiceManager\Exception\InvalidServiceNameException + * @expectedException Laminas\ServiceManager\Exception\InvalidServiceNameException */ public function testAssignAliasWithExistingServiceName() { - $this->serviceManager->setFactory('foo', 'ZendTest\ServiceManager\TestAsset\FooFactory'); + $this->serviceManager->setFactory('foo', 'LaminasTest\ServiceManager\TestAsset\FooFactory'); $this->serviceManager->setFactory('bar', function ($sm) { return new Bar(['a']); }); @@ -613,8 +612,8 @@ public function testAssignAliasWithExistingServiceName() } /** - * @covers Zend\ServiceManager\ServiceManager::createFromAbstractFactory - * @covers Zend\ServiceManager\ServiceManager::has + * @covers Laminas\ServiceManager\ServiceManager::createFromAbstractFactory + * @covers Laminas\ServiceManager\ServiceManager::has */ public function testWillNotCreateCircularReferences() { @@ -646,7 +645,7 @@ public function testCallingANonExistingServiceFromAnAbstractServiceDoesNotMakeTh public function testMultipleAbstractFactoriesWithOneLookingForANonExistingServiceDuringCanCreate() { $abstractFactory = new TestAsset\TrollAbstractFactory; - $anotherAbstractFactory = $this->getMock('Zend\ServiceManager\AbstractFactoryInterface'); + $anotherAbstractFactory = $this->getMock('Laminas\ServiceManager\AbstractFactoryInterface'); $anotherAbstractFactory ->expects($this->exactly(2)) ->method('canCreateServiceWithName') @@ -698,7 +697,7 @@ public function testWaitingAbstractFactoryNestedContextCounterWhenThrowException $this->assertEquals(-1, $contextCounter->getValue($this->serviceManager)); try { $this->serviceManager->get('SomethingThatCanBeCreated'); - $this->fail('serviceManager shoud throw Zend\ServiceManager\Exception\ServiceNotFoundException'); + $this->fail('serviceManager shoud throw Laminas\ServiceManager\Exception\ServiceNotFoundException'); } catch (\Exception $e) { if (stripos(get_class($e), 'PHPUnit') !== false) { throw $e; @@ -710,7 +709,7 @@ public function testWaitingAbstractFactoryNestedContextCounterWhenThrowException $abstractFactory->throwExceptionWhenCreate = true; try { $this->serviceManager->get('SomethingThatCanBeCreated'); - $this->fail('serviceManager shoud throw Zend\ServiceManager\Exception\ServiceNotCreatedException'); + $this->fail('serviceManager shoud throw Laminas\ServiceManager\Exception\ServiceNotCreatedException'); } catch (\Exception $e) { if (stripos(get_class($e), 'PHPUnit') !== false) { throw $e; @@ -721,13 +720,13 @@ public function testWaitingAbstractFactoryNestedContextCounterWhenThrowException public function testShouldAllowAddingInitializersAsClassNames() { - $result = $this->serviceManager->addInitializer('ZendTest\ServiceManager\TestAsset\FooInitializer'); + $result = $this->serviceManager->addInitializer('LaminasTest\ServiceManager\TestAsset\FooInitializer'); $this->assertSame($this->serviceManager, $result); } public function testShouldRaiseExceptionIfInitializerClassIsNotAnInitializerInterfaceImplementation() { - $this->setExpectedException('Zend\ServiceManager\Exception\InvalidArgumentException'); + $this->setExpectedException('Laminas\ServiceManager\Exception\InvalidArgumentException'); $result = $this->serviceManager->addInitializer(get_class($this)); } @@ -735,12 +734,12 @@ public function testGetGlobIteratorServiceWorksProperly() { $config = new Config([ 'invokables' => [ - 'foo' => 'ZendTest\ServiceManager\TestAsset\GlobIteratorService', + 'foo' => 'LaminasTest\ServiceManager\TestAsset\GlobIteratorService', ], ]); $serviceManager = new ServiceManager($config); $foo = $serviceManager->get('foo'); - $this->assertInstanceOf('ZendTest\ServiceManager\TestAsset\GlobIteratorService', $foo); + $this->assertInstanceOf('LaminasTest\ServiceManager\TestAsset\GlobIteratorService', $foo); } public function duplicateService() @@ -787,7 +786,7 @@ public function testWithAllowOverrideOnRegisteringAServiceDuplicatingAnExistingA } /** - * @covers Zend\ServiceManager\ServiceManager::canonicalizeName + * @covers Laminas\ServiceManager\ServiceManager::canonicalizeName */ public function testCanonicalizeName() { @@ -800,7 +799,7 @@ public function testCanonicalizeName() } /** - * @covers Zend\ServiceManager\ServiceManager::canCreateFromAbstractFactory + * @covers Laminas\ServiceManager\ServiceManager::canCreateFromAbstractFactory */ public function testWanCreateFromAbstractFactoryWillNotInstantiateAbstractFactoryOnce() { @@ -814,18 +813,18 @@ public function testWanCreateFromAbstractFactoryWillNotInstantiateAbstractFactor } /** - * @covers Zend\ServiceManager\ServiceManager::canCreateFromAbstractFactory - * @covers Zend\ServiceManager\ServiceManager::create + * @covers Laminas\ServiceManager\ServiceManager::canCreateFromAbstractFactory + * @covers Laminas\ServiceManager\ServiceManager::create */ public function testAbstractFactoryNotUsedIfNotAbleToCreate() { $service = new \stdClass; - $af1 = $this->getMock('Zend\ServiceManager\AbstractFactoryInterface'); + $af1 = $this->getMock('Laminas\ServiceManager\AbstractFactoryInterface'); $af1->expects($this->any())->method('canCreateServiceWithName')->will($this->returnValue(true)); $af1->expects($this->any())->method('createServiceWithName')->will($this->returnValue($service)); - $af2 = $this->getMock('Zend\ServiceManager\AbstractFactoryInterface'); + $af2 = $this->getMock('Laminas\ServiceManager\AbstractFactoryInterface'); $af2->expects($this->any())->method('canCreateServiceWithName')->will($this->returnValue(false)); $af2->expects($this->never())->method('createServiceWithName'); @@ -836,9 +835,9 @@ public function testAbstractFactoryNotUsedIfNotAbleToCreate() } /** - * @covers Zend\ServiceManager\ServiceManager::setAlias - * @covers Zend\ServiceManager\ServiceManager::get - * @covers Zend\ServiceManager\ServiceManager::retrieveFromPeeringManager + * @covers Laminas\ServiceManager\ServiceManager::setAlias + * @covers Laminas\ServiceManager\ServiceManager::get + * @covers Laminas\ServiceManager\ServiceManager::retrieveFromPeeringManager */ public function testCanGetAliasedServicesFromPeeringServiceManagers() { @@ -854,24 +853,24 @@ public function testCanGetAliasedServicesFromPeeringServiceManagers() } /** - * @covers Zend\ServiceManager\ServiceManager::get + * @covers Laminas\ServiceManager\ServiceManager::get */ public function testDuplicateNewInstanceMultipleAbstractFactories() { $this->serviceManager->setAllowOverride(true); $this->serviceManager->setShareByDefault(false); - $this->serviceManager->addAbstractFactory('ZendTest\ServiceManager\TestAsset\BarAbstractFactory'); - $this->serviceManager->addAbstractFactory('ZendTest\ServiceManager\TestAsset\FooAbstractFactory'); - $this->assertInstanceOf('ZendTest\ServiceManager\TestAsset\Bar', $this->serviceManager->get('bar')); - $this->assertInstanceOf('ZendTest\ServiceManager\TestAsset\Bar', $this->serviceManager->get('bar')); + $this->serviceManager->addAbstractFactory('LaminasTest\ServiceManager\TestAsset\BarAbstractFactory'); + $this->serviceManager->addAbstractFactory('LaminasTest\ServiceManager\TestAsset\FooAbstractFactory'); + $this->assertInstanceOf('LaminasTest\ServiceManager\TestAsset\Bar', $this->serviceManager->get('bar')); + $this->assertInstanceOf('LaminasTest\ServiceManager\TestAsset\Bar', $this->serviceManager->get('bar')); } /** - * @covers Zend\ServiceManager\ServiceManager::setService - * @covers Zend\ServiceManager\ServiceManager::get - * @covers Zend\ServiceManager\ServiceManager::retrieveFromPeeringManagerFirst - * @covers Zend\ServiceManager\ServiceManager::setRetrieveFromPeeringManagerFirst - * @covers Zend\ServiceManager\ServiceManager::addPeeringServiceManager + * @covers Laminas\ServiceManager\ServiceManager::setService + * @covers Laminas\ServiceManager\ServiceManager::get + * @covers Laminas\ServiceManager\ServiceManager::retrieveFromPeeringManagerFirst + * @covers Laminas\ServiceManager\ServiceManager::setRetrieveFromPeeringManagerFirst + * @covers Laminas\ServiceManager\ServiceManager::addPeeringServiceManager */ public function testRetrieveServiceFromPeeringServiceManagerIfretrieveFromPeeringManagerFirstSetToTrueAndServiceNamesAreSame() { @@ -899,14 +898,14 @@ public function testRetrieveServiceFromPeeringServiceManagerIfretrieveFromPeerin } /** - * @covers Zend\ServiceManager\ServiceManager::create - * @covers Zend\ServiceManager\ServiceManager::createDelegatorFromFactory - * @covers Zend\ServiceManager\ServiceManager::createDelegatorCallback - * @covers Zend\ServiceManager\ServiceManager::addDelegator + * @covers Laminas\ServiceManager\ServiceManager::create + * @covers Laminas\ServiceManager\ServiceManager::createDelegatorFromFactory + * @covers Laminas\ServiceManager\ServiceManager::createDelegatorCallback + * @covers Laminas\ServiceManager\ServiceManager::addDelegator */ public function testUsesDelegatorWhenAvailable() { - $delegator = $this->getMock('Zend\\ServiceManager\\DelegatorFactoryInterface'); + $delegator = $this->getMock('Laminas\\ServiceManager\\DelegatorFactoryInterface'); $this->serviceManager->setService('foo-delegator', $delegator); $this->serviceManager->addDelegator('foo-service', 'foo-delegator'); @@ -935,10 +934,10 @@ public function testUsesDelegatorWhenAvailable() } /** - * @covers Zend\ServiceManager\ServiceManager::create - * @covers Zend\ServiceManager\ServiceManager::createDelegatorFromFactory - * @covers Zend\ServiceManager\ServiceManager::createDelegatorCallback - * @covers Zend\ServiceManager\ServiceManager::addDelegator + * @covers Laminas\ServiceManager\ServiceManager::create + * @covers Laminas\ServiceManager\ServiceManager::createDelegatorFromFactory + * @covers Laminas\ServiceManager\ServiceManager::createDelegatorCallback + * @covers Laminas\ServiceManager\ServiceManager::addDelegator */ public function testUsesMultipleDelegates() { @@ -959,7 +958,7 @@ public function testUsesMultipleDelegates() } /** - * @covers Zend\ServiceManager\ServiceManager::resolveAlias + * @covers Laminas\ServiceManager\ServiceManager::resolveAlias */ public function testSetCircularAliasReferenceThrowsException() { @@ -971,16 +970,16 @@ public function testSetCircularAliasReferenceThrowsException() $this->serviceManager->setAlias('baz-alias', 'bar-alias'); // This will now cause a cyclic reference and should throw an exception - $this->setExpectedException('Zend\ServiceManager\Exception\CircularReferenceException'); + $this->setExpectedException('Laminas\ServiceManager\Exception\CircularReferenceException'); $this->serviceManager->setAlias('foo-alias', 'bar-alias'); } /** - * @covers Zend\ServiceManager\ServiceManager::checkForCircularAliasReference + * @covers Laminas\ServiceManager\ServiceManager::checkForCircularAliasReference */ public function testResolveCircularAliasReferenceThrowsException() { - $this->setExpectedException('Zend\ServiceManager\Exception\CircularReferenceException'); + $this->setExpectedException('Laminas\ServiceManager\Exception\CircularReferenceException'); // simulate an inconsistent state of $servicemanager->aliases as it could be // caused by derived classes @@ -1000,11 +999,11 @@ public function testResolveCircularAliasReferenceThrowsException() } /** - * @covers Zend\ServiceManager\ServiceManager::createDelegatorFromFactory + * @covers Laminas\ServiceManager\ServiceManager::createDelegatorFromFactory */ public function testDelegatorFactoryWhenNotRegisteredAsService() { - $delegator = $this->getMock('Zend\\ServiceManager\\DelegatorFactoryInterface'); + $delegator = $this->getMock('Laminas\\ServiceManager\\DelegatorFactoryInterface'); $this->serviceManager->addDelegator('foo-service', $delegator); $this->serviceManager->setInvokableClass('foo-service', 'stdClass'); @@ -1032,10 +1031,10 @@ public function testDelegatorFactoryWhenNotRegisteredAsService() } /** - * @covers Zend\ServiceManager\ServiceManager::create - * @covers Zend\ServiceManager\ServiceManager::createDelegatorFromFactory - * @covers Zend\ServiceManager\ServiceManager::createDelegatorCallback - * @covers Zend\ServiceManager\ServiceManager::addDelegator + * @covers Laminas\ServiceManager\ServiceManager::create + * @covers Laminas\ServiceManager\ServiceManager::createDelegatorFromFactory + * @covers Laminas\ServiceManager\ServiceManager::createDelegatorCallback + * @covers Laminas\ServiceManager\ServiceManager::addDelegator */ public function testMultipleDelegatorFactoriesWhenNotRegisteredAsServices() { @@ -1107,7 +1106,7 @@ public function testDelegatorFromCallback() */ public function testAbstractFactoriesCanReturnAnyTypeButNull($service) { - $abstractFactory = $this->getMock('Zend\ServiceManager\AbstractFactoryInterface'); + $abstractFactory = $this->getMock('Laminas\ServiceManager\AbstractFactoryInterface'); $abstractFactory ->expects($this->any()) ->method('canCreateServiceWithName') @@ -1127,7 +1126,7 @@ public function testAbstractFactoriesCanReturnAnyTypeButNull($service) $this->serviceManager->get('something'); $this->fail('ServiceManager::get() successfully returned null'); } catch (\Exception $e) { - $this->assertInstanceOf('Zend\ServiceManager\Exception\ServiceNotCreatedException', $e); + $this->assertInstanceOf('Laminas\ServiceManager\Exception\ServiceNotCreatedException', $e); } } else { $this->assertSame($service, $this->serviceManager->get('something')); @@ -1150,7 +1149,7 @@ public function testFactoriesCanReturnAnyTypeButNull($service) $this->serviceManager->get('something'); $this->fail('ServiceManager::get() successfully returned null'); } catch (\Exception $e) { - $this->assertInstanceOf('Zend\ServiceManager\Exception\ServiceNotCreatedException', $e); + $this->assertInstanceOf('Laminas\ServiceManager\Exception\ServiceNotCreatedException', $e); } } else { $this->assertSame($service, $this->serviceManager->get('something')); @@ -1170,7 +1169,7 @@ public function testServicesCanBeOfAnyTypeButNull($service) $this->serviceManager->get('something'); $this->fail('ServiceManager::get() successfully returned null'); } catch (\Exception $e) { - $this->assertInstanceOf('Zend\ServiceManager\Exception\ServiceNotFoundException', $e); + $this->assertInstanceOf('Laminas\ServiceManager\Exception\ServiceNotFoundException', $e); } } else { $this->assertSame($service, $this->serviceManager->get('something')); @@ -1193,11 +1192,11 @@ public function getServiceOfVariousTypes() } /** - * @group ZF2-4377 + * @group Laminas-4377 */ public function testServiceManagerRespectsSharedFlagWhenRetrievingFromPeeredServiceManager() { - $this->serviceManager->setInvokableClass('foo', 'ZendTest\ServiceManager\TestAsset\Foo'); + $this->serviceManager->setInvokableClass('foo', 'LaminasTest\ServiceManager\TestAsset\Foo'); $this->serviceManager->setShared('foo', false); $childManager = new ServiceManager(new Config()); @@ -1208,17 +1207,17 @@ public function testServiceManagerRespectsSharedFlagWhenRetrievingFromPeeredServ } /** - * @group ZF2-4377 + * @group Laminas-4377 */ public function testIsSharedThrowsExceptionWhenPassedNameWhichDoesNotExistAnywhere() { - $this->setExpectedException('Zend\ServiceManager\Exception\ServiceNotFoundException'); + $this->setExpectedException('Laminas\ServiceManager\Exception\ServiceNotFoundException'); $this->serviceManager->isShared('foobarbazbat'); } public function testPeeringServiceManagersInBothDirectionsDontRunIntoInfiniteLoop() { - $this->setExpectedException('Zend\ServiceManager\Exception\ServiceNotFoundException'); + $this->setExpectedException('Laminas\ServiceManager\Exception\ServiceNotFoundException'); $peeredServiceManager = $this->serviceManager->createScopedServiceManager(ServiceManager::SCOPE_CHILD); $peeredServiceManager->addPeeringServiceManager($this->serviceManager); $this->serviceManager->get('foobarbazbat'); diff --git a/test/TestAsset/AbstractFactoryWithMutableCreationOptions.php b/test/TestAsset/AbstractFactoryWithMutableCreationOptions.php index ac6b555c..6f8a2729 100644 --- a/test/TestAsset/AbstractFactoryWithMutableCreationOptions.php +++ b/test/TestAsset/AbstractFactoryWithMutableCreationOptions.php @@ -1,18 +1,17 @@ InvokableObject::class, + + // Legacy Zend Framework aliases + \ZendTest\ServiceManager\TestAsset\InvokableObject::class => InvokableObject::class, + + // v2 normalized FQCNs + 'zendtestservicemanagertestassetinvokableobject' => InvokableObject::class, ]; protected $factories = [ InvokableObject::class => InvokableFactory::class, // Legacy (v2) due to alias resolution - 'zendtestservicemanagertestassetinvokableobject' => InvokableFactory::class, + 'laminastestservicemanagertestassetinvokableobject' => InvokableFactory::class, ]; protected $instanceOf = InvokableObject::class; diff --git a/test/TestAsset/WaitingAbstractFactory.php b/test/TestAsset/WaitingAbstractFactory.php index 9c215841..3d6a98e7 100644 --- a/test/TestAsset/WaitingAbstractFactory.php +++ b/test/TestAsset/WaitingAbstractFactory.php @@ -1,17 +1,16 @@