Skip to content

Commit

Permalink
Test for providing context to issue:
Browse files Browse the repository at this point in the history
  • Loading branch information
WouterGit committed Dec 19, 2018
1 parent c03f498 commit 6c3a583
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions test/Factory/RpcControllerFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
use PHPUnit\Framework\TestCase;
use Prophecy\Prophecy\ProphecyInterface;
use ReflectionProperty;
use Zend\EventManager\EventManagerInterface;
use Zend\Mvc\Controller\ControllerManager;
use Zend\Mvc\Controller\PluginManager;
use Zend\ServiceManager\Exception\ServiceNotCreatedException;
use Zend\ServiceManager\ServiceLocatorInterface;
use ZF\Rpc\Factory\RpcControllerFactory;
Expand Down Expand Up @@ -287,4 +289,38 @@ public function testServiceCreationReturnsRpcControllerWrappingCallableForValidC
$this->assertInstanceOf(RpcController::class, $controller);
$this->assertAttributeSame($callable, 'wrappedCallable', $controller);
}

/**
* @group 7
*
* See for more information the following issue:
* https://github.com/zfcampus/zf-rpc/issues/18
*/
public function testFailsWhenUsingRealControllerManagerWithAbstractFactory()
{
$config = [
'controllers' => [
'abstract_factories' => [
RpcControllerFactory::class
]
],
'zf-rpc' => [
TestAsset\Foo::class => [
'callable' => TestAsset\Foo::class . '::bar',
],
],
];
$this->services->has('config')->willReturn(true);
$this->services->get('config')->willReturn($config);

$controllerManager = new ControllerManager($this->services->reveal(), $config['controllers']);
$this->services->has('ControllerManager')->willReturn(true);
$this->services->has(TestAsset\Foo::class)->willReturn(false);
$this->services->get('ControllerManager')->willReturn($controllerManager);
$this->services->get('EventManager')->willReturn($this->prophesize(EventManagerInterface::class)->reveal());
$this->services->get('ControllerPluginManager')->willReturn($this->prophesize(PluginManager::class)->reveal());
$controller = $controllerManager->get(TestAsset\Foo::class);

$this->assertInstanceOf(RpcController::class, $controller);
}
}

0 comments on commit 6c3a583

Please sign in to comment.