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 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added plugin manager compatibility test
Per https://github.com/zendframework/maintainers/wiki/ZF3-ServiceManager-component-refactors,-phase-2 Adds FilterPluginManagerCompatibilityTest, which tests that the plugin manager works against both v2 and v3 of zend-servicemanager. This implementation needed to exclude: - all plugins from zend-i18n, as that package is no longer required. - the DataUnitFormatter, as it has required options. Additionally, I updated the `File\Rename`, `File\RenameUpload`, and `Callback` filters to make all arguments optional so that they can be listed as invokable filters. Finally, a number of plugins were listed in the FilterPluginManager that were not actually filters, which the compatibility test caught. These included: - All classes under `Zend\Filter\Encrypt` - All classes under `Zend\Filter\Compress` In each case, the classes were used as adapters consumed by other filters, and were not filters themselves.
- Loading branch information
1 parent
10a9d1e
commit 00cec47
Showing
5 changed files
with
63 additions
and
48 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,60 @@ | ||
<?php | ||
/** | ||
* Zend Framework (http://framework.zend.com/) | ||
* | ||
* @link http://github.com/zendframework/zf2 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\Filter; | ||
|
||
use PHPUnit_Framework_TestCase as TestCase; | ||
use ReflectionProperty; | ||
use Zend\Filter\Exception\RuntimeException; | ||
use Zend\Filter\FilterInterface; | ||
use Zend\Filter\FilterPluginManager; | ||
use Zend\ServiceManager\ServiceManager; | ||
use Zend\ServiceManager\Test\CommonPluginManagerTrait; | ||
|
||
class FilterPluginManagerCompatibilityTest extends TestCase | ||
{ | ||
use CommonPluginManagerTrait; | ||
|
||
protected function getPluginManager() | ||
{ | ||
return new FilterPluginManager(new ServiceManager()); | ||
} | ||
|
||
protected function getV2InvalidPluginException() | ||
{ | ||
return RuntimeException::class; | ||
} | ||
|
||
protected function getInstanceOf() | ||
{ | ||
return FilterInterface::class; | ||
} | ||
|
||
public function aliasProvider() | ||
{ | ||
$pluginManager = $this->getPluginManager(); | ||
$r = new ReflectionProperty($pluginManager, 'aliases'); | ||
$r->setAccessible(true); | ||
$aliases = $r->getValue($pluginManager); | ||
|
||
foreach ($aliases as $alias => $target) { | ||
// Skipping as zend-i18n is not required by this package | ||
if (strpos($target, '\\I18n\\')) { | ||
continue; | ||
} | ||
|
||
// Skipping as it has required options | ||
if (strpos($target, 'DataUnitFormatter')) { | ||
continue; | ||
} | ||
|
||
yield $alias => [$alias, $target]; | ||
} | ||
} | ||
} |