This repository has been archived by the owner on Jan 30, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 49
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/service-listener-delegator'
Close #41
- Loading branch information
Showing
8 changed files
with
121 additions
and
38 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
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
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,49 @@ | ||
<?php | ||
/** | ||
* @link http://github.com/zendframework/zend-i18n for the canonical source repository | ||
* @copyright Copyright (c) 2005-2016 Zend Technologies USA Inc. (http://www.zend.com) | ||
* @license http://framework.zend.com/license/new-bsd New BSD License | ||
*/ | ||
|
||
namespace ZendTest\I18n; | ||
|
||
use Interop\Container\ContainerInterface; | ||
use PHPUnit_Framework_TestCase as TestCase; | ||
use Zend\I18n\Module; | ||
|
||
class ModuleTest extends TestCase | ||
{ | ||
public function setUp() | ||
{ | ||
$this->module = new Module(); | ||
} | ||
|
||
public function testConfigReturnsExpectedKeys() | ||
{ | ||
$config = $this->module->getConfig(); | ||
$this->assertInternalType('array', $config); | ||
$this->assertArrayHasKey('filters', $config); | ||
$this->assertArrayHasKey('service_manager', $config); | ||
$this->assertArrayHasKey('validators', $config); | ||
$this->assertArrayHasKey('view_helpers', $config); | ||
} | ||
|
||
public function testInitRegistersPluginManagerSpecificationWithServiceListener() | ||
{ | ||
$serviceListener = $this->prophesize(TestAsset\ServiceListenerInterface::class); | ||
$serviceListener->addServiceManager( | ||
'TranslatorPluginManager', | ||
'translator_plugins', | ||
'Zend\ModuleManager\Feature\TranslatorPluginProviderInterface', | ||
'getTranslatorPluginConfig' | ||
)->shouldBeCalled(); | ||
|
||
$container = $this->prophesize(ContainerInterface::class); | ||
$container->get('ServiceListener')->willReturn($serviceListener->reveal()); | ||
|
||
$event = $this->prophesize(TestAsset\ModuleEventInterface::class); | ||
$event->getParam('ServiceManager')->willReturn($container->reveal()); | ||
|
||
$this->assertNull($this->module->init($event->reveal())); | ||
} | ||
} |
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,18 @@ | ||
<?php | ||
/** | ||
* @link http://github.com/zendframework/zend-i18n for the canonical source repository | ||
* @copyright Copyright (c) 2005-2016 Zend Technologies USA Inc. (http://www.zend.com) | ||
* @license http://framework.zend.com/license/new-bsd New BSD License | ||
*/ | ||
|
||
namespace ZendTest\I18n\TestAsset; | ||
|
||
/** | ||
* Mock interface to use when testing Module::init | ||
* | ||
* Mimics Zend\ModuleManager\ModuleEvent methods called. | ||
*/ | ||
interface ModuleEventInterface | ||
{ | ||
public function getParam($name, $default = null); | ||
} |
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,29 @@ | ||
<?php | ||
/** | ||
* @link http://github.com/zendframework/zend-i18n for the canonical source repository | ||
* @copyright Copyright (c) 2005-2016 Zend Technologies USA Inc. (http://www.zend.com) | ||
* @license http://framework.zend.com/license/new-bsd New BSD License | ||
*/ | ||
|
||
namespace ZendTest\I18n\TestAsset; | ||
|
||
/** | ||
* Stub interfact to mock when testing Module::init. | ||
* | ||
* Mimics method that will be called on ServiceListener. | ||
*/ | ||
interface ServiceListenerInterface | ||
{ | ||
/** | ||
* @param string $pluginManagerService | ||
* @param string $configKey | ||
* @param string $interface | ||
* @param string $method | ||
*/ | ||
public function addServiceManager( | ||
$pluginManagerService, | ||
$configKey, | ||
$interface, | ||
$method | ||
); | ||
} |
This file was deleted.
Oops, something went wrong.