forked from zendframework/zendframework
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'hotfix/3085' of git://github.com/weierophinney/zf2 into…
… weierophinney-hotfix/3085
- Loading branch information
Showing
2 changed files
with
52 additions
and
0 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,51 @@ | ||
<?php | ||
/** | ||
* Zend Framework (http://framework.zend.com/) | ||
* | ||
* @link http://github.com/zendframework/zf2 for the canonical source repository | ||
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) | ||
* @license http://framework.zend.com/license/new-bsd New BSD License | ||
* @package Zend_Mvc | ||
*/ | ||
|
||
namespace ZendTest\Mvc\Controller; | ||
|
||
use PHPUnit_Framework_TestCase as TestCase; | ||
use Zend\EventManager\SharedEventManager; | ||
use Zend\Mvc\Controller\ControllerManager; | ||
use Zend\Mvc\Controller\PluginManager; | ||
use Zend\ServiceManager\ServiceManager; | ||
|
||
class IntegrationTest extends TestCase | ||
{ | ||
public function setUp() | ||
{ | ||
$this->plugins = new PluginManager(); | ||
$this->sharedEvents = new SharedEventManager(); | ||
$this->services = new ServiceManager(); | ||
$this->services->setService('ControllerPluginManager', $this->plugins); | ||
$this->services->setService('SharedEventManager', $this->sharedEvents); | ||
$this->services->setService('Zend\ServiceManager\ServiceLocatorInterface', $this->services); | ||
|
||
$this->controllers = new ControllerManager(); | ||
$this->controllers->setServiceLocator($this->services); | ||
} | ||
|
||
public function testPluginReceivesCurrentController() | ||
{ | ||
$this->controllers->setInvokableClass('first', 'ZendTest\Mvc\Controller\TestAsset\SampleController'); | ||
$this->controllers->setInvokableClass('second', 'ZendTest\Mvc\Controller\TestAsset\SampleController'); | ||
|
||
$first = $this->controllers->get('first'); | ||
$second = $this->controllers->get('second'); | ||
$this->assertNotSame($first, $second); | ||
|
||
$plugin1 = $first->plugin('url'); | ||
$this->assertSame($first, $plugin1->getController()); | ||
|
||
$plugin2 = $second->plugin('url'); | ||
$this->assertSame($second, $plugin2->getController()); | ||
|
||
$this->assertSame($plugin1, $plugin2); | ||
} | ||
} |