This repository has been archived by the owner on Feb 6, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 89
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' of git://github.com/zendframework/zf2 into dev…
…elop
- Loading branch information
102 parents
303ab92
+
3f9b994
+
ea3acc3
+
fe35f10
+
45cc91b
+
aa77760
+
4959b82
+
35e2edb
+
7717bd8
+
127fcbd
+
fc52973
+
528f461
+
8e251cd
+
d95b25a
+
0f89697
+
c941b0e
+
3dc45ae
+
180e140
+
67c3033
+
533cd3e
+
29e7718
+
936c9be
+
2d11657
+
fa66751
+
2b778cc
+
ba628cd
+
ff761e1
+
5b64ee3
+
9456811
+
1c2d797
+
46b0d8f
+
82264b3
+
39c88ce
+
cee064b
+
c303bed
+
ea247e3
+
1f87514
+
8896fc2
+
313a38d
+
42848d4
+
8f5c457
+
e035a2a
+
544e341
+
467f8b2
+
30bb6f0
+
f8cc896
+
2ee0afd
+
656f0b0
+
7092cb4
+
5e1b259
+
abb3ff8
+
39a873f
+
b6e6c92
+
83055d8
+
1dd5d72
+
9bc304a
+
479b8c7
+
41fab24
+
80aee85
+
3962f1e
+
6c6b004
+
acb7af7
+
39aca71
+
9d55623
+
c2210f2
+
50b7a31
+
327d366
+
00cfdb8
+
77c12db
+
4a66170
+
4bd5c7f
+
9549d20
+
d3a95e2
+
5e04377
+
d9da2cf
+
1049b39
+
001d281
+
ca437e5
+
a5cb2da
+
e2db3b8
+
27f50b4
+
8008d6f
+
4a6bead
+
e2df9ad
+
9045ea9
+
0d18a05
+
48cc7df
+
dc08391
+
ceec2bd
+
c5fc623
+
6335bda
+
2a78ec6
+
56c198e
+
3fab1eb
+
4594eeb
+
7db8ed5
+
fdab45c
+
a4698e4
+
34e7aec
+
2fcaf1c
+
0eb7480
+
d73e943
commit cda61b2
Showing
6 changed files
with
236 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<?php | ||
/** | ||
* Zend Framework (http://framework.zend.com/) | ||
* | ||
* @link https://github.com/zendframework/zf2 for the canonical source repository | ||
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) | ||
* @license http://framework.zend.com/license/new-bsd New BSD License | ||
* @package Zend_ServiceManager | ||
*/ | ||
|
||
namespace Zend\ServiceManager; | ||
|
||
use Zend\ServiceManager\ServiceLocatorInterface; | ||
|
||
/** | ||
* @category Zend | ||
* @package Zend_ServiceManager | ||
*/ | ||
trait ServiceLocatorAwareTrait | ||
{ | ||
/** | ||
* @var ServiceLocator | ||
*/ | ||
protected $serviceLocator = null; | ||
|
||
/** | ||
* Set service locator | ||
* | ||
* @param ServiceLocatorInterface $serviceLocator | ||
* @return mixed | ||
*/ | ||
public function setServiceLocator(ServiceLocatorInterface $serviceLocator) | ||
{ | ||
$this->serviceLocator = $serviceLocator; | ||
|
||
return $this; | ||
} | ||
|
||
/** | ||
* Get service locator | ||
* | ||
* @return ServiceLocator | ||
*/ | ||
public function getServiceLocator() | ||
{ | ||
return $this->serviceLocator; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<?php | ||
/** | ||
* Zend Framework (http://framework.zend.com/) | ||
* | ||
* @link https://github.com/zendframework/zf2 for the canonical source repository | ||
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) | ||
* @license http://framework.zend.com/license/new-bsd New BSD License | ||
* @package Zend_ServiceManager | ||
*/ | ||
|
||
namespace ZendTest\ServiceManager; | ||
|
||
use \PHPUnit_Framework_TestCase as TestCase; | ||
use \Zend\ServiceManager\ServiceManager; | ||
|
||
/** | ||
* @requires PHP 5.4 | ||
*/ | ||
class ServiceLocatorAwareTraitTest extends TestCase | ||
{ | ||
public function testSetServiceLocator() | ||
{ | ||
$object = $this->getObjectForTrait('\Zend\ServiceManager\ServiceLocatorAwareTrait'); | ||
|
||
$this->assertAttributeEquals(null, 'serviceLocator', $object); | ||
|
||
$serviceLocator = new ServiceManager; | ||
|
||
$object->setServiceLocator($serviceLocator); | ||
|
||
$this->assertAttributeEquals($serviceLocator, 'serviceLocator', $object); | ||
} | ||
|
||
public function testGetServiceLocator() | ||
{ | ||
$object = $this->getObjectForTrait('\Zend\ServiceManager\ServiceLocatorAwareTrait'); | ||
|
||
$this->assertNull($object->getServiceLocator()); | ||
|
||
$serviceLocator = new ServiceManager; | ||
|
||
$object->setServiceLocator($serviceLocator); | ||
|
||
$this->assertEquals($serviceLocator, $object->getServiceLocator()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
<?php | ||
/** | ||
* Zend Framework (http://framework.zend.com/) | ||
* | ||
* @link https://github.com/zendframework/zf2 for the canonical source repository | ||
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) | ||
* @license http://framework.zend.com/license/new-bsd New BSD License | ||
* @package Zend_ServiceManager | ||
*/ | ||
|
||
namespace ZendTest\ServiceManager\TestAsset; | ||
|
||
use Zend\ServiceManager\AbstractFactoryInterface; | ||
use Zend\ServiceManager\ServiceLocatorInterface; | ||
|
||
/** | ||
* Abstract factory that keeps track of the number of times it is instantiated | ||
*/ | ||
class FooCounterAbstractFactory implements AbstractFactoryInterface | ||
{ | ||
/** | ||
* @var int | ||
*/ | ||
public static $instantiationCount = 0; | ||
|
||
/** | ||
* Increments instantiation count | ||
*/ | ||
public function __construct() | ||
{ | ||
self::$instantiationCount += 1; | ||
} | ||
|
||
/** | ||
* {@inheritDoc} | ||
*/ | ||
public function canCreateServiceWithName(ServiceLocatorInterface $serviceLocator, $name, $requestedName) | ||
{ | ||
if ($name == 'foo') { | ||
return true; | ||
} | ||
} | ||
|
||
/** | ||
* {@inheritDoc} | ||
*/ | ||
public function createServiceWithName(ServiceLocatorInterface $serviceLocator, $name, $requestedName) | ||
{ | ||
return new Foo; | ||
} | ||
} |