diff --git a/.gitattributes b/.gitattributes index 85dc9a8c..1abdf0f4 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,6 +1,8 @@ -/test export-ignore -/vendor export-ignore -.gitattributes export-ignore -.gitignore export-ignore -.travis.yml export-ignore -.php_cs export-ignore +/.coveralls.yml export-ignore +/.gitattributes export-ignore +/.gitignore export-ignore +/.php_cs export-ignore +/.travis.yml export-ignore +/phpunit.xml.dist export-ignore +/phpunit.xml.travis export-ignore +/test/ export-ignore diff --git a/.gitignore b/.gitignore index 4cac0a21..d5e33e78 100644 --- a/.gitignore +++ b/.gitignore @@ -1,14 +1,5 @@ -.buildpath -.DS_Store -.idea -.project -.settings/ -.*.sw* -.*.un~ -nbproject -tmp/ - -clover.xml -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 fe909ecb..a2f410ec 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,3 @@ -sudo: false - language: php matrix: @@ -17,7 +15,6 @@ matrix: - php: hhvm notifications: - irc: "irc.freenode.org#zftalk.dev" email: false before_install: diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md deleted file mode 100644 index 608075d4..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-service-manager/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-service-manager.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-service-manager) -3. Clone the canonical repository locally and enter it. - - ```console - $ git clone git://github.com:zendframework/zend-service-manager.git - $ cd zend-service-manager - ``` - -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-service-manager.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-service-manager.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.txt b/LICENSE.md similarity index 54% rename from LICENSE.txt rename to LICENSE.md index 6eab5aa1..09f53edc 100644 --- a/LICENSE.txt +++ b/LICENSE.md @@ -1,19 +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. +- 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 7c8a5f17..e4b9047d 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,9 @@ -# zend-servicemanager +# laminas-servicemanager -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/composer.json b/composer.json index 7348b0d8..c16e548c 100644 --- a/composer.json +++ b/composer.json @@ -1,21 +1,22 @@ { - "name": "zendframework/zend-servicemanager", + "name": "laminas/laminas-servicemanager", "description": " ", "license": "BSD-3-Clause", "keywords": [ - "zf2", + "laminas", "servicemanager" ], - "autoload": { - "psr-4": { - "Zend\\ServiceManager\\": "src/" - } - }, - "require": { - "php": ">=5.3.3" + "homepage": "https://laminas.dev", + "support": { + "docs": "https://docs.laminas.dev/laminas-servicemanager/", + "issues": "https://github.com/laminas/laminas-servicemanager/issues", + "source": "https://github.com/laminas/laminas-servicemanager", + "rss": "https://github.com/laminas/laminas-servicemanager/releases.atom", + "chat": "https://laminas.dev/chat", + "forum": "https://discourse.laminas.dev" }, - "suggest": { - "zendframework/zend-di": "Zend\\Di component" + "config": { + "sort-packages": true }, "extra": { "branch-alias": { @@ -23,15 +24,29 @@ "dev-develop": "2.3-dev" } }, - "homepage": "https://github.com/zendframework/zend-service-manager", + "require": { + "php": ">=5.3.3", + "laminas/laminas-zendframework-bridge": "^1.0" + }, + "require-dev": { + "fabpot/php-cs-fixer": "1.7.*", + "phpunit/phpunit": "~4.0", + "satooshi/php-coveralls": "dev-master" + }, + "suggest": { + "laminas/laminas-di": "Laminas\\Di component" + }, + "autoload": { + "psr-4": { + "Laminas\\ServiceManager\\": "src/" + } + }, "autoload-dev": { "psr-4": { - "ZendTest\\ServiceManager\\": "test/" + "LaminasTest\\ServiceManager\\": "test/" } }, - "require-dev": { - "fabpot/php-cs-fixer": "1.7.*", - "satooshi/php-coveralls": "dev-master", - "phpunit/PHPUnit": "~4.0" + "replace": { + "zendframework/zend-servicemanager": "self.version" } -} \ No newline at end of file +} diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 31e7b179..81c29e2c 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -4,7 +4,7 @@ bootstrap="./test/bootstrap.php" colors="true"> - + ./test/ @@ -26,9 +26,9 @@ - + diff --git a/phpunit.xml.travis b/phpunit.xml.travis index 31e7b179..81c29e2c 100644 --- a/phpunit.xml.travis +++ b/phpunit.xml.travis @@ -4,7 +4,7 @@ bootstrap="./test/bootstrap.php" colors="true"> - + ./test/ @@ -26,9 +26,9 @@ - + diff --git a/src/AbstractFactoryInterface.php b/src/AbstractFactoryInterface.php index 64ab7598..a41feaa8 100644 --- a/src/AbstractFactoryInterface.php +++ b/src/AbstractFactoryInterface.php @@ -1,13 +1,12 @@ serviceManager = new ServiceManager; $this->pluginManager = new FooPluginManager(new Config(array( 'factories' => array( - 'Foo' => 'ZendTest\ServiceManager\TestAsset\FooFactory', + 'Foo' => 'LaminasTest\ServiceManager\TestAsset\FooFactory', ), 'shared' => array( 'Foo' => false, @@ -44,7 +41,7 @@ public function testSetMultipleCreationOptions() { $pluginManager = new FooPluginManager(new Config(array( 'factories' => array( - 'Foo' => 'ZendTest\ServiceManager\TestAsset\FooFactory' + 'Foo' => 'LaminasTest\ServiceManager\TestAsset\FooFactory' ), 'shared' => array( 'Foo' => false @@ -61,20 +58,20 @@ public function testSetMultipleCreationOptions() $pluginManager->get('Foo', array('key1' => 'value1')); $value = $reflProperty->getValue($pluginManager); - $this->assertInstanceOf('ZendTest\ServiceManager\TestAsset\FooFactory', $value['foo']); + $this->assertInstanceOf('LaminasTest\ServiceManager\TestAsset\FooFactory', $value['foo']); $this->assertEquals(array('key1' => 'value1'), $value['foo']->getCreationOptions()); $pluginManager->get('Foo', array('key2' => 'value2')); $value = $reflProperty->getValue($pluginManager); - $this->assertInstanceOf('ZendTest\ServiceManager\TestAsset\FooFactory', $value['foo']); + $this->assertInstanceOf('LaminasTest\ServiceManager\TestAsset\FooFactory', $value['foo']); $this->assertEquals(array('key2' => 'value2'), $value['foo']->getCreationOptions()); } public function testAbstractFactoryWithMutableCreationOptions() { $creationOptions = array('key1' => 'value1'); - $mock = 'ZendTest\ServiceManager\TestAsset\AbstractFactoryWithMutableCreationOptions'; + $mock = 'LaminasTest\ServiceManager\TestAsset\AbstractFactoryWithMutableCreationOptions'; $abstractFactory = $this->getMock($mock, array('setCreationOptions')); $abstractFactory->expects($this->once()) ->method('setCreationOptions') @@ -87,7 +84,7 @@ public function testAbstractFactoryWithMutableCreationOptions() public function testMutableMethodNeverCalledWithoutCreationOptions() { - $mock = 'ZendTest\ServiceManager\TestAsset\CallableWithMutableCreationOptions'; + $mock = 'LaminasTest\ServiceManager\TestAsset\CallableWithMutableCreationOptions'; $callable = $this->getMock($mock, array('setCreationOptions')); $callable->expects($this->never()) ->method('setCreationOptions'); @@ -102,7 +99,7 @@ public function testMutableMethodNeverCalledWithoutCreationOptions() public function testCallableObjectWithMutableCreationOptions() { $creationOptions = array('key1' => 'value1'); - $mock = 'ZendTest\ServiceManager\TestAsset\CallableWithMutableCreationOptions'; + $mock = 'LaminasTest\ServiceManager\TestAsset\CallableWithMutableCreationOptions'; $callable = $this->getMock($mock, array('setCreationOptions')); $callable->expects($this->once()) ->method('setCreationOptions') diff --git a/test/Di/DiAbstractServiceFactoryTest.php b/test/Di/DiAbstractServiceFactoryTest.php index c73ba4f8..0ea9fdcb 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', array(), array(null, $instanceManager)); - $this->mockServiceLocator = $this->getMock('Zend\ServiceManager\ServiceLocatorInterface'); + $this->mockDi = $this->getMock('Laminas\Di\Di', array(), array(null, $instanceManager)); + $this->mockServiceLocator = $this->getMock('Laminas\ServiceManager\ServiceLocatorInterface'); $this->diAbstractServiceFactory = new DiAbstractServiceFactory( $this->mockDi ); @@ -45,19 +44,19 @@ 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); } /** - * @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() { @@ -66,11 +65,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(); @@ -98,7 +97,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 35597fb8..814f72e2 100644 --- a/test/Di/DiServiceFactoryTest.php +++ b/test/Di/DiServiceFactoryTest.php @@ -1,20 +1,19 @@ addSharedInstanceWithParameters( $this->fooInstance = new \stdClass(), 'foo', array('bar' => 'baz') ); - $this->mockDi = $this->getMock('Zend\Di\Di', array(), array(null, $instanceManager)); - $this->mockServiceLocator = $this->getMock('Zend\ServiceManager\ServiceLocatorInterface'); + $this->mockDi = $this->getMock('Laminas\Di\Di', array(), array(null, $instanceManager)); + $this->mockServiceLocator = $this->getMock('Laminas\ServiceManager\ServiceLocatorInterface'); $this->diServiceFactory = new DiServiceFactory( $this->mockDi, 'foo', @@ -51,21 +50,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', array('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 a72675e1..c84c998b 100644 --- a/test/Di/DiServiceInitializerTest.php +++ b/test/Di/DiServiceInitializerTest.php @@ -1,19 +1,18 @@ mockDi = $this->getMock('Zend\Di\Di', array('injectDependencies')); - $this->mockServiceLocator = $this->getMock('Zend\ServiceManager\ServiceLocatorInterface'); + $this->mockDi = $this->getMock('Laminas\Di\Di', array('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( @@ -48,7 +47,7 @@ public function setup() } /** - * @covers Zend\ServiceManager\Di\DiServiceInitializer::initialize + * @covers Laminas\ServiceManager\Di\DiServiceInitializer::initialize */ public function testInitialize() { @@ -61,12 +60,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/Proxy/LazyServiceFactoryFactoryTest.php b/test/Proxy/LazyServiceFactoryFactoryTest.php index 8942f33e..b9884c89 100644 --- a/test/Proxy/LazyServiceFactoryFactoryTest.php +++ b/test/Proxy/LazyServiceFactoryFactoryTest.php @@ -1,22 +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); } @@ -47,7 +45,7 @@ public function testInvalidConfiguration($config) public function testAutoGenerateProxyFiles() { $serviceManager = new ServiceManager(); - $namespace = 'ZendTestProxy' . uniqid(); + $namespace = 'LaminasTestProxy' . uniqid(); $serviceManager->setService( 'Config', @@ -59,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,11 +67,11 @@ public function testAutoGenerateProxyFiles() $this->assertInstanceOf('ProxyManager\\Proxy\\LazyLoadingInterface', $proxy); $this->assertInstanceOf(__CLASS__, $proxy); $this->assertSame( - $namespace . '\__PM__\ZendTest\ServiceManager\Proxy\LazyServiceFactoryFactoryTest', + $namespace . '\__PM__\LaminasTest\ServiceManager\Proxy\LazyServiceFactoryFactoryTest', get_class($proxy) ); $this->assertFileExists( - sys_get_temp_dir() . '/' . $namespace . '__PM__ZendTestServiceManagerProxyLazyServiceFactoryFactoryTest.php' + sys_get_temp_dir() . '/' . $namespace . '__PM__LaminasTestServiceManagerProxyLazyServiceFactoryFactoryTest.php' ); $this->assertFalse($proxy->isProxyInitialized()); $this->assertEquals($this->invalidConfigProvider(), $proxy->invalidConfigProvider()); @@ -83,7 +81,7 @@ public function testAutoGenerateProxyFiles() public function testAutoGenerateAndEvaluateProxies() { $serviceManager = new ServiceManager(); - $namespace = 'ZendTestProxy' . uniqid(); + $namespace = 'LaminasTestProxy' . uniqid(); $serviceManager->setService( 'Config', @@ -94,7 +92,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'); @@ -104,11 +102,11 @@ public function testAutoGenerateAndEvaluateProxies() $this->assertInstanceOf('ProxyManager\\Proxy\\LazyLoadingInterface', $proxy); $this->assertInstanceOf(__CLASS__, $proxy); $this->assertSame( - $namespace . '\__PM__\ZendTest\ServiceManager\Proxy\LazyServiceFactoryFactoryTest', + $namespace . '\__PM__\LaminasTest\ServiceManager\Proxy\LazyServiceFactoryFactoryTest', get_class($proxy) ); $this->assertFileNotExists( - sys_get_temp_dir() . '/' . $namespace . '__PM__ZendTestServiceManagerProxyLazyServiceFactoryFactoryTest.php' + sys_get_temp_dir() . '/' . $namespace . '__PM__LaminasTestServiceManagerProxyLazyServiceFactoryFactoryTest.php' ); $this->assertFalse($proxy->isProxyInitialized()); $this->assertEquals($this->invalidConfigProvider(), $proxy->invalidConfigProvider()); @@ -119,7 +117,7 @@ public function testRegistersAutoloader() { $autoloaders = spl_autoload_functions(); $serviceManager = new ServiceManager(); - $namespace = 'ZendTestProxy' . uniqid(); + $namespace = 'LaminasTestProxy' . uniqid(); $serviceManager->setService( 'Config', @@ -131,7 +129,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 0a328989..7554318e 100644 --- a/test/Proxy/LazyServiceFactoryTest.php +++ b/test/Proxy/LazyServiceFactoryTest.php @@ -1,21 +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() @@ -78,7 +76,7 @@ public function testCannotCreateDelegatorWithNoMappedServiceClass() { $factory = new LazyServiceFactory($this->proxyFactory, array()); - $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 e7a4172b..72bbd8c8 100644 --- a/test/ServiceLocatorAwareTraitTest.php +++ b/test/ServiceLocatorAwareTraitTest.php @@ -1,26 +1,25 @@ getObjectForTrait('\Zend\ServiceManager\ServiceLocatorAwareTrait'); + $object = $this->getObjectForTrait('\Laminas\ServiceManager\ServiceLocatorAwareTrait'); $this->assertAttributeEquals(null, 'serviceLocator', $object); @@ -33,7 +32,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 e4357a71..30be7eaf 100644 --- a/test/ServiceManagerTest.php +++ b/test/ServiceManagerTest.php @@ -1,27 +1,25 @@ 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); } @@ -130,7 +128,7 @@ public function testServiceManagerIsPassedToInitializer() } /** - * @covers Zend\ServiceManager\ServiceManager::addInitializer + * @covers Laminas\ServiceManager\ServiceManager::addInitializer */ public function testAddInitializer() { @@ -139,16 +137,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() { @@ -157,7 +155,7 @@ public function testSetService() } /** - * @covers Zend\ServiceManager\ServiceManager::setShared + * @covers Laminas\ServiceManager\ServiceManager::setShared */ public function testSetShared() { @@ -167,26 +165,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() { @@ -195,7 +193,7 @@ public function testGet() } /** - * @covers Zend\ServiceManager\ServiceManager::get + * @covers Laminas\ServiceManager\ServiceManager::get */ public function testGetDoesNotThrowExceptionOnEmptyArray() { @@ -204,33 +202,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() { @@ -240,7 +238,7 @@ public function testGetWithAlias() } /** - * @covers Zend\ServiceManager\ServiceManager::get + * @covers Laminas\ServiceManager\ServiceManager::get */ public function testGetWithScopedContainer() { @@ -283,50 +281,50 @@ 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')); } public function testCreateWithInitializerObject() @@ -340,7 +338,7 @@ public function testCreateWithInitializerObject() } /** - * @covers Zend\ServiceManager\ServiceManager::has + * @covers Laminas\ServiceManager\ServiceManager::has */ public function testHas() { @@ -350,7 +348,7 @@ public function testHas() } /** - * @covers Zend\ServiceManager\ServiceManager::setAlias + * @covers Laminas\ServiceManager\ServiceManager::setAlias */ public function testSetAlias() { @@ -360,37 +358,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() { @@ -398,28 +396,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() { @@ -431,7 +429,7 @@ public function testHasAlias() } /** - * @covers Zend\ServiceManager\ServiceManager::createScopedServiceManager + * @covers Laminas\ServiceManager\ServiceManager::createScopedServiceManager */ public function testCreateScopedServiceManager() { @@ -451,66 +449,66 @@ public function testConfigureWithInvokableClass() { $config = new Config(array( 'invokables' => array( - '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', array('foo' => array('a'))); + $di->instanceManager()->setParameters('LaminasTest\ServiceManager\TestAsset\Bar', array('foo' => array('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', array('parameters' => array('foo' => array('a')))); + $factory->instanceManager()->setConfig('LaminasTest\ServiceManager\TestAsset\Bar', array('parameters' => array('foo' => array('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(array( 'abstract_factories' => array( - '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() { @@ -518,19 +516,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', array('foo' => array('a'))); + $di->instanceManager()->setParameters('LaminasTest\ServiceManager\TestAsset\Bar', array('foo' => array('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(array('a')); }); @@ -540,8 +538,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() { @@ -572,13 +570,13 @@ public function testCallingANonExistingServiceFromAnAbstractServiceDoesNotMakeTh 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)); } @@ -586,12 +584,12 @@ public function testGetGlobIteratorServiceWorksProperly() { $config = new Config(array( 'invokables' => array( - '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() @@ -640,7 +638,7 @@ public function testWithAllowOverrideOnRegisteringAServiceDuplicatingAnExistingA } /** - * @covers Zend\ServiceManager\ServiceManager::canonicalizeName + * @covers Laminas\ServiceManager\ServiceManager::canonicalizeName */ public function testCanonicalizeName() { @@ -653,7 +651,7 @@ public function testCanonicalizeName() } /** - * @covers Zend\ServiceManager\ServiceManager::canCreateFromAbstractFactory + * @covers Laminas\ServiceManager\ServiceManager::canCreateFromAbstractFactory */ public function testWanCreateFromAbstractFactoryWillNotInstantiateAbstractFactoryOnce() { @@ -667,18 +665,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'); @@ -689,9 +687,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() { @@ -707,24 +705,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() { @@ -752,13 +750,13 @@ public function testRetrieveServiceFromPeeringServiceManagerIfretrieveFromPeerin } /** - * @covers Zend\ServiceManager\ServiceManager::create - * @covers Zend\ServiceManager\ServiceManager::createDelegatorCallback - * @covers Zend\ServiceManager\ServiceManager::addDelegator + * @covers Laminas\ServiceManager\ServiceManager::create + * @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'); @@ -789,9 +787,9 @@ public function testUsesDelegatorWhenAvailable() } /** - * @covers Zend\ServiceManager\ServiceManager::create - * @covers Zend\ServiceManager\ServiceManager::createDelegatorCallback - * @covers Zend\ServiceManager\ServiceManager::addDelegator + * @covers Laminas\ServiceManager\ServiceManager::create + * @covers Laminas\ServiceManager\ServiceManager::createDelegatorCallback + * @covers Laminas\ServiceManager\ServiceManager::addDelegator */ public function testUsesMultipleDelegates() { diff --git a/test/TestAsset/AbstractFactoryWithMutableCreationOptions.php b/test/TestAsset/AbstractFactoryWithMutableCreationOptions.php index 8e9dcab7..6f8a2729 100644 --- a/test/TestAsset/AbstractFactoryWithMutableCreationOptions.php +++ b/test/TestAsset/AbstractFactoryWithMutableCreationOptions.php @@ -1,18 +1,17 @@