From 8d96a69962bed010f0c9e321f66f4edf18cdb0d9 Mon Sep 17 00:00:00 2001 From: Matt Kynaston Date: Wed, 27 Jan 2016 18:34:19 +0000 Subject: [PATCH 1/7] Changes to make v2-v3 compatible --- composer.json | 2 +- src/FilterPluginManager.php | 243 ++++++++++++------ .../Service/SeparatorToSeparatorFactory.php | 42 ++- test/FilterPluginManagerTest.php | 16 +- 4 files changed, 226 insertions(+), 77 deletions(-) diff --git a/composer.json b/composer.json index 76fa14f4..786f3423 100644 --- a/composer.json +++ b/composer.json @@ -21,7 +21,7 @@ "zendframework/zend-crypt": "dev-develop as 2.7", "zendframework/zend-i18n": "~2.5", "zendframework/zend-loader": "~2.5", - "zendframework/zend-servicemanager": "dev-develop as 2.7", + "zendframework/zend-servicemanager": "^2.7.4 || ^3.0", "zendframework/zend-uri": "~2.5", "fabpot/php-cs-fixer": "1.7.*", "phpunit/PHPUnit": "~4.0" diff --git a/src/FilterPluginManager.php b/src/FilterPluginManager.php index f7a089b0..194f80bb 100644 --- a/src/FilterPluginManager.php +++ b/src/FilterPluginManager.php @@ -9,6 +9,7 @@ namespace Zend\Filter; +use Zend\Filter\Exception\RuntimeException; use Zend\I18n\Filter\Alnum; use Zend\I18n\Filter\Alpha; use Zend\I18n\Filter\NumberParse; @@ -29,8 +30,10 @@ class FilterPluginManager extends AbstractPluginManager protected $aliases = [ // For the future - 'Int' => ToInt::class, - 'Null' => ToNull::class, + 'int' => ToInt::class, + 'Int' => ToInt::class, + 'null' => ToNull::class, + 'Null' => ToNull::class, // I18n filters 'alnum' => Alnum::class, @@ -135,13 +138,9 @@ class FilterPluginManager extends AbstractPluginManager 'HtmlEntities' => HtmlEntities::class, 'inflector' => Inflector::class, 'Inflector' => Inflector::class, - 'int' => ToInt::class, - 'Int' => ToInt::class, 'monthselect' => MonthSelect::class, 'monthSelect' => MonthSelect::class, 'MonthSelect' => MonthSelect::class, - 'null' => ToNull::class, - 'Null' => ToNull::class, 'pregreplace' => PregReplace::class, 'pregReplace' => PregReplace::class, 'PregReplace' => PregReplace::class, @@ -198,6 +197,9 @@ class FilterPluginManager extends AbstractPluginManager 'wordseparatortodash' => Word\SeparatorToDash::class, 'wordSeparatorToDash' => Word\SeparatorToDash::class, 'WordSeparatorToDash' => Word\SeparatorToDash::class, + 'wordseparatortoseparator' => Word\SeparatorToSeparator::class, + 'wordSeparatorToSeparator' => Word\SeparatorToSeparator::class, + 'WordSeparatorToSeparator' => Word\SeparatorToSeparator::class, 'wordunderscoretocamelcase' => Word\UnderscoreToCamelCase::class, 'wordUnderscoreToCamelCase' => Word\UnderscoreToCamelCase::class, 'WordUnderscoreToCamelCase' => Word\UnderscoreToCamelCase::class, @@ -218,84 +220,162 @@ class FilterPluginManager extends AbstractPluginManager * @var array */ protected $factories = [ - 'wordseparatortoseparator' => Word\Service\SeparatorToSeparatorFactory::class, - // For the future - ToInt::class => InvokableFactory::class, - ToNull::class => InvokableFactory::class, + ToInt::class => InvokableFactory::class, + ToNull::class => InvokableFactory::class, // I18n filters - Alnum::class => InvokableFactory::class, - Alpha::class => InvokableFactory::class, - NumberFormat::class => InvokableFactory::class, - NumberParse::class => InvokableFactory::class, + Alnum::class => InvokableFactory::class, + Alpha::class => InvokableFactory::class, + NumberFormat::class => InvokableFactory::class, + NumberParse::class => InvokableFactory::class, // Standard filters - BaseName::class => InvokableFactory::class, - Blacklist::class => InvokableFactory::class, - Boolean::class => InvokableFactory::class, - Callback::class => InvokableFactory::class, - Compress::class => InvokableFactory::class, - Compress\Bz2::class => InvokableFactory::class, - Compress\Gz::class => InvokableFactory::class, - Compress\Lzf::class => InvokableFactory::class, - Compress\Rar::class => InvokableFactory::class, - Compress\Snappy::class => InvokableFactory::class, - Compress\Tar::class => InvokableFactory::class, - Compress\Zip::class => InvokableFactory::class, - DataUnitFormatter::class => InvokableFactory::class, - DateSelect::class => InvokableFactory::class, - DateTimeFormatter::class => InvokableFactory::class, - DateTimeSelect::class => InvokableFactory::class, - Decompress::class => InvokableFactory::class, - Decrypt::class => InvokableFactory::class, - Digits::class => InvokableFactory::class, - Dir::class => InvokableFactory::class, - Encrypt::class => InvokableFactory::class, - Encrypt\BlockCipher::class => InvokableFactory::class, - Encrypt\Openssl::class => InvokableFactory::class, - File\Decrypt::class => InvokableFactory::class, - File\Encrypt::class => InvokableFactory::class, - File\LowerCase::class => InvokableFactory::class, - File\Rename::class => InvokableFactory::class, - File\RenameUpload::class => InvokableFactory::class, - File\UpperCase::class => InvokableFactory::class, - HtmlEntities::class => InvokableFactory::class, - Inflector::class => InvokableFactory::class, - ToInt::class => InvokableFactory::class, - MonthSelect::class => InvokableFactory::class, - ToNull::class => InvokableFactory::class, - PregReplace::class => InvokableFactory::class, - RealPath::class => InvokableFactory::class, - StringToLower::class => InvokableFactory::class, - StringToUpper::class => InvokableFactory::class, - StringTrim::class => InvokableFactory::class, - StripNewlines::class => InvokableFactory::class, - StripTags::class => InvokableFactory::class, - ToInt::class => InvokableFactory::class, - ToNull::class => InvokableFactory::class, - UriNormalize::class => InvokableFactory::class, - Whitelist::class => InvokableFactory::class, - Word\CamelCaseToDash::class => InvokableFactory::class, - Word\CamelCaseToSeparator::class => InvokableFactory::class, - Word\CamelCaseToUnderscore::class => InvokableFactory::class, - Word\DashToCamelCase::class => InvokableFactory::class, - Word\DashToSeparator::class => InvokableFactory::class, - Word\DashToUnderscore::class => InvokableFactory::class, - Word\SeparatorToCamelCase::class => InvokableFactory::class, - Word\SeparatorToDash::class => InvokableFactory::class, - Word\UnderscoreToCamelCase::class => InvokableFactory::class, - Word\UnderscoreToStudlyCase::class => InvokableFactory::class, - Word\UnderscoreToDash::class => InvokableFactory::class, - Word\UnderscoreToSeparator::class => InvokableFactory::class, + BaseName::class => InvokableFactory::class, + Blacklist::class => InvokableFactory::class, + Boolean::class => InvokableFactory::class, + Callback::class => InvokableFactory::class, + Compress::class => InvokableFactory::class, + Compress\Bz2::class => InvokableFactory::class, + Compress\Gz::class => InvokableFactory::class, + Compress\Lzf::class => InvokableFactory::class, + Compress\Rar::class => InvokableFactory::class, + Compress\Snappy::class => InvokableFactory::class, + Compress\Tar::class => InvokableFactory::class, + Compress\Zip::class => InvokableFactory::class, + DataUnitFormatter::class => InvokableFactory::class, + DateSelect::class => InvokableFactory::class, + DateTimeFormatter::class => InvokableFactory::class, + DateTimeSelect::class => InvokableFactory::class, + Decompress::class => InvokableFactory::class, + Decrypt::class => InvokableFactory::class, + Digits::class => InvokableFactory::class, + Dir::class => InvokableFactory::class, + Encrypt::class => InvokableFactory::class, + Encrypt\BlockCipher::class => InvokableFactory::class, + Encrypt\Openssl::class => InvokableFactory::class, + File\Decrypt::class => InvokableFactory::class, + File\Encrypt::class => InvokableFactory::class, + File\LowerCase::class => InvokableFactory::class, + File\Rename::class => InvokableFactory::class, + File\RenameUpload::class => InvokableFactory::class, + File\UpperCase::class => InvokableFactory::class, + HtmlEntities::class => InvokableFactory::class, + Inflector::class => InvokableFactory::class, + ToInt::class => InvokableFactory::class, + MonthSelect::class => InvokableFactory::class, + ToNull::class => InvokableFactory::class, + PregReplace::class => InvokableFactory::class, + RealPath::class => InvokableFactory::class, + StringToLower::class => InvokableFactory::class, + StringToUpper::class => InvokableFactory::class, + StringTrim::class => InvokableFactory::class, + StripNewlines::class => InvokableFactory::class, + StripTags::class => InvokableFactory::class, + ToInt::class => InvokableFactory::class, + ToNull::class => InvokableFactory::class, + UriNormalize::class => InvokableFactory::class, + Whitelist::class => InvokableFactory::class, + Word\CamelCaseToDash::class => InvokableFactory::class, + Word\CamelCaseToSeparator::class => InvokableFactory::class, + Word\CamelCaseToUnderscore::class => InvokableFactory::class, + Word\DashToCamelCase::class => InvokableFactory::class, + Word\DashToSeparator::class => InvokableFactory::class, + Word\DashToUnderscore::class => InvokableFactory::class, + Word\SeparatorToCamelCase::class => InvokableFactory::class, + Word\SeparatorToDash::class => InvokableFactory::class, + Word\SeparatorToSeparator::class => Word\Service\SeparatorToSeparatorFactory::class, + Word\UnderscoreToCamelCase::class => InvokableFactory::class, + Word\UnderscoreToStudlyCase::class => InvokableFactory::class, + Word\UnderscoreToDash::class => InvokableFactory::class, + Word\UnderscoreToSeparator::class => InvokableFactory::class, + + // v2 canonical FQCNs + + 'zendfiltertoint' => InvokableFactory::class, + 'zendfiltertonull' => InvokableFactory::class, + 'zendinfilteralnum' => InvokableFactory::class, + 'zendinfilteralpha' => InvokableFactory::class, + 'zendinviewhelpernumberformat' => InvokableFactory::class, + 'zendinfilternumberparse' => InvokableFactory::class, + 'zendfilterbasename' => InvokableFactory::class, + 'zendfilterblacklist' => InvokableFactory::class, + 'zendfilterboolean' => InvokableFactory::class, + 'zendfiltercallback' => InvokableFactory::class, + 'zendfiltercompress' => InvokableFactory::class, + 'zendfiltercompressbz' => InvokableFactory::class, + 'zendfiltercompressgz' => InvokableFactory::class, + 'zendfiltercompresslzf' => InvokableFactory::class, + 'zendfiltercompressrar' => InvokableFactory::class, + 'zendfiltercompresssnappy' => InvokableFactory::class, + 'zendfiltercompresstar' => InvokableFactory::class, + 'zendfiltercompresszip' => InvokableFactory::class, + 'zendfilterdataunitformatter' => InvokableFactory::class, + 'zendfilterdateselect' => InvokableFactory::class, + 'zendfilterdatetimeformatter' => InvokableFactory::class, + 'zendfilterdatetimeselect' => InvokableFactory::class, + 'zendfilterdecompress' => InvokableFactory::class, + 'zendfilterdecrypt' => InvokableFactory::class, + 'zendfilterdigits' => InvokableFactory::class, + 'zendfilterdir' => InvokableFactory::class, + 'zendfilterencrypt' => InvokableFactory::class, + 'zendfilterencryptblockcipher' => InvokableFactory::class, + 'zendfilterencryptopenssl' => InvokableFactory::class, + 'zendfilterfiledecrypt' => InvokableFactory::class, + 'zendfilterfileencrypt' => InvokableFactory::class, + 'zendfilterfilelowercase' => InvokableFactory::class, + 'zendfilterfilerename' => InvokableFactory::class, + 'zendfilterfilerenameupload' => InvokableFactory::class, + 'zendfilterfileuppercase' => InvokableFactory::class, + 'zendfilterhtmlentities' => InvokableFactory::class, + 'zendfilterinflector' => InvokableFactory::class, + 'zendfiltermonthselect' => InvokableFactory::class, + 'zendfilterpregreplace' => InvokableFactory::class, + 'zendfilterrealpath' => InvokableFactory::class, + 'zendfilterstringtolower' => InvokableFactory::class, + 'zendfilterstringtoupper' => InvokableFactory::class, + 'zendfilterstringtrim' => InvokableFactory::class, + 'zendfilterstripnewlines' => InvokableFactory::class, + 'zendfilterstriptags' => InvokableFactory::class, + 'zendfilterurinormalize' => InvokableFactory::class, + 'zendfilterwhitelist' => InvokableFactory::class, + 'zendfilterwordcamelcasetodash' => InvokableFactory::class, + 'zendfilterwordcamelcasetoseparator' => InvokableFactory::class, + 'zendfilterwordcamelcasetounderscore' => InvokableFactory::class, + 'zendfilterworddashtocamelcase' => InvokableFactory::class, + 'zendfilterworddashtoseparator' => InvokableFactory::class, + 'zendfilterworddashtounderscore' => InvokableFactory::class, + 'zendfilterwordseparatortocamelcase' => InvokableFactory::class, + 'zendfilterwordseparatortodash' => InvokableFactory::class, + 'zendfilterwordseparatortoseparator' => Word\Service\SeparatorToSeparatorFactory::class, + 'zendfilterwordunderscoretocamelcase' => InvokableFactory::class, + 'zendfilterwordunderscoretostudlycase' => InvokableFactory::class, + 'zendfilterwordunderscoretodash' => InvokableFactory::class, + 'zendfilterwordunderscoretoseparator' => InvokableFactory::class, ]; + protected $instanceOf = FilterInterface::class; + + /** + * Whether or not to share by default; default to false (v2) + * + * @var bool + */ + protected $shareByDefault = false; + + /** + * Whether or not to share by default; default to false (v3) + * + * @var bool + */ + protected $sharedByDefault = false; + /** * {@inheritdoc} */ public function validate($plugin) { - if ($plugin instanceof FilterInterface) { + if ($plugin instanceof $this->instanceOf) { // we're okay return; } @@ -311,4 +391,23 @@ public function validate($plugin) __NAMESPACE__ )); } + + /** + * Validate the plugin (v2) + * + * Checks that the filter loaded is either a valid callback or an instance + * of FilterInterface. + * + * @param mixed $plugin + * @return void + * @throws Exception\RuntimeException if invalid + */ + public function validatePlugin($plugin) + { + try { + $this->validate($plugin); + } catch (InvalidServiceException $e) { + throw new RuntimeException($e->getMessage(), $e->getCode(), $e); + } + } } diff --git a/src/Word/Service/SeparatorToSeparatorFactory.php b/src/Word/Service/SeparatorToSeparatorFactory.php index 0c4d4d84..ab36ea93 100644 --- a/src/Word/Service/SeparatorToSeparatorFactory.php +++ b/src/Word/Service/SeparatorToSeparatorFactory.php @@ -4,10 +4,40 @@ use Interop\Container\ContainerInterface; use Zend\Filter\Word\SeparatorToSeparator; -use Zend\ServiceManager\Factory\FactoryInterface; +use Zend\ServiceManager\Exception\InvalidServiceException; +use Zend\ServiceManager\FactoryInterface; +use Zend\ServiceManager\ServiceLocatorInterface; class SeparatorToSeparatorFactory implements FactoryInterface { + /** + * Options to pass to the constructor (when used in v2), if any. + * + * @param null|array + */ + private $creationOptions = []; + + public function __construct($creationOptions = null) + { + if (null === $creationOptions) { + return; + } + + if ($creationOptions instanceof Traversable) { + $creationOptions = iterator_to_array($creationOptions); + } + + if (! is_array($creationOptions)) { + throw new InvalidServiceException(sprintf( + '%s cannot use non-array, non-traversable creation options; received %s', + __CLASS__, + (is_object($creationOptions) ? get_class($creationOptions) : gettype($creationOptions)) + )); + } + + $this->creationOptions = $creationOptions; + } + /** * {@inheritDoc} */ @@ -18,4 +48,14 @@ public function __invoke(ContainerInterface $container, $requestedName, array $o isset($options['replacement_separator']) ? $options['replacement_separator'] : '-' ); } + + public function createService(ServiceLocatorInterface $serviceLocator) + { + return $this($serviceLocator, self::class, $this->creationOptions); + } + + public function setCreationOptions(array $options) + { + $this->creationOptions = $options; + } } diff --git a/test/FilterPluginManagerTest.php b/test/FilterPluginManagerTest.php index fa59e4bd..2482303f 100644 --- a/test/FilterPluginManagerTest.php +++ b/test/FilterPluginManagerTest.php @@ -9,6 +9,7 @@ namespace ZendTest\Filter; +use Zend\Filter\Exception\RuntimeException; use Zend\Filter\FilterPluginManager; use Zend\Filter\Word\SeparatorToSeparator; use Zend\ServiceManager\Exception\InvalidServiceException; @@ -37,7 +38,7 @@ public function testFilterSuccessfullyRetrieved() public function testRegisteringInvalidFilterRaisesException() { - $this->setExpectedException(InvalidServiceException::class); + $this->setExpectedException($this->getInvalidServiceException()); $this->filters->setService('test', $this); $this->filters->get('test'); } @@ -45,7 +46,7 @@ public function testRegisteringInvalidFilterRaisesException() public function testLoadingInvalidFilterRaisesException() { $this->filters->setInvokableClass('test', get_class($this)); - $this->setExpectedException(InvalidServiceException::class); + $this->setExpectedException($this->getInvalidServiceException()); $this->filters->get('test'); } @@ -62,7 +63,7 @@ public function testFilterSuccessfullyConstructed() 'replacement_separator' => $replacementSeparator, ]; - $filter = $this->filters->build('wordseparatortoseparator', $options); + $filter = $this->filters->get('wordseparatortoseparator', $options); $this->assertInstanceOf(SeparatorToSeparator::class, $filter); $this->assertEquals($searchSeparator, $filter->getSearchSeparator()); @@ -92,4 +93,13 @@ public function testFiltersConstructedAreDifferent() $this->assertNotEquals($filterOne, $filterTwo); } + + + protected function getInvalidServiceException() + { + if (method_exists($this->filters, 'configure')) { + return InvalidServiceException::class; + } + return RuntimeException::class; + } } From 006d0d2653199aad8ae79d8d62d37d7ec5cf7208 Mon Sep 17 00:00:00 2001 From: Matt Kynaston Date: Wed, 27 Jan 2016 18:41:58 +0000 Subject: [PATCH 2/7] Updated travis with SERVICE_MANAGER_VERSION --- .travis.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.travis.yml b/.travis.yml index 1ef118c4..1a15e2db 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,11 +16,15 @@ matrix: include: - php: 5.5 env: + - SERVICE_MANAGER_VERSION="^2.7.3" - EXECUTE_CS_CHECK=true - php: 5.6 env: + - SERVICE_MANAGER_VERSION="^2.7.3" - EXECUTE_TEST_COVERALLS=true - php: 7 + env: + - SERVICE_MANAGER_VERSION="^2.7.3" - php: hhvm allow_failures: - php: hhvm @@ -33,6 +37,8 @@ before_install: - if [[ $EXECUTE_TEST_COVERALLS != 'true' ]]; then phpenv config-rm xdebug.ini || return 0 ; fi - composer self-update - if [[ $EXECUTE_TEST_COVERALLS == 'true' ]]; then composer require --dev --no-update satooshi/php-coveralls ; fi + - if [[ $SERVICE_MANAGER_VERSION != '' ]]; then composer require --dev --no-update "zendframework/zend-servicemanager:$SERVICE_MANAGER_VERSION" ; fi + - if [[ $SERVICE_MANAGER_VERSION == '' ]]; then composer require --dev --no-update "zendframework/zend-servicemanager:^3.0" ; fi install: - travis_retry composer install --no-interaction --ignore-platform-reqs From 93f7ac72ad12aa164763a832dc0aa2975a6cc19d Mon Sep 17 00:00:00 2001 From: Matt Kynaston Date: Sat, 30 Jan 2016 21:27:40 +0000 Subject: [PATCH 3/7] Fixed sm version --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 786f3423..73d5197b 100644 --- a/composer.json +++ b/composer.json @@ -21,7 +21,7 @@ "zendframework/zend-crypt": "dev-develop as 2.7", "zendframework/zend-i18n": "~2.5", "zendframework/zend-loader": "~2.5", - "zendframework/zend-servicemanager": "^2.7.4 || ^3.0", + "zendframework/zend-servicemanager": "^2.7.3 || ^3.0", "zendframework/zend-uri": "~2.5", "fabpot/php-cs-fixer": "1.7.*", "phpunit/PHPUnit": "~4.0" From 10a9d1e3df5f4ca227717b9a8b4f485e3c4a0a86 Mon Sep 17 00:00:00 2001 From: Matthew Weier O'Phinney Date: Thu, 4 Feb 2016 09:05:26 -0600 Subject: [PATCH 4/7] Updated and reduced dependencies - Updated PHP to `^5.5 || ^7.0` - Updated zend-stdlib to `^2.7 || ^3.0` - Updated zend-crypt to `^2.6` - Updated zend-uri to `^2.5` - Added pear/archive_tar (used by the Compress\Tar filter; previously we relied on a PEAR installation, but PEAR packages are now published to packagist) - Removed zend-config, zend-i18n, and zend-loader dependencies. - Replaced references to `Zend\Config\Config` with `ArrayObject`, as it's equivalent for purposes of what's being tested (`Traversable` configuration). - Replaced i18n assets used in testing with local test asset classes. - zend-loader is no longer necessary with the addition of pear/archive_tar. zend-stdlib is installed at 2.7.4, due to the fact that zend-uri uses zend-validator, which is still pinned to v2 of the service manager and v2 of zend-stdlib. All tests continue to pass. --- composer.json | 22 +++---- src/FilterPluginManager.php | 8 +-- test/Compress/TarTest.php | 10 +-- test/FilterChainTest.php | 50 +++++---------- test/HtmlEntitiesTest.php | 7 ++- test/InflectorTest.php | 63 ++++++++----------- test/TestAsset/Alpha.php | 24 +++++++ test/TestAsset/LowerCase.php | 20 ++++++ test/TestAsset/StripUpperCase.php | 20 ++++++ test/_files/TestNamespace/ValidatorBroker.php | 19 ------ test/_files/TestNamespace/ValidatorLoader.php | 25 -------- 11 files changed, 126 insertions(+), 142 deletions(-) create mode 100644 test/TestAsset/Alpha.php create mode 100644 test/TestAsset/LowerCase.php create mode 100644 test/TestAsset/StripUpperCase.php delete mode 100644 test/_files/TestNamespace/ValidatorBroker.php delete mode 100644 test/_files/TestNamespace/ValidatorLoader.php diff --git a/composer.json b/composer.json index 73d5197b..3fa650eb 100644 --- a/composer.json +++ b/composer.json @@ -13,24 +13,22 @@ } }, "require": { - "php": ">=5.5", - "zendframework/zend-stdlib": "~2.5" + "php": "^5.5 || ^7.0", + "zendframework/zend-stdlib": "^2.7 || ^3.0" }, "require-dev": { - "zendframework/zend-config": "~2.5", - "zendframework/zend-crypt": "dev-develop as 2.7", - "zendframework/zend-i18n": "~2.5", - "zendframework/zend-loader": "~2.5", - "zendframework/zend-servicemanager": "^2.7.3 || ^3.0", - "zendframework/zend-uri": "~2.5", + "pear/archive_tar": "^1.4", + "zendframework/zend-crypt": "^2.6", + "zendframework/zend-servicemanager": "^2.7.5 || ^3.0.3", + "zendframework/zend-uri": "^2.5", "fabpot/php-cs-fixer": "1.7.*", "phpunit/PHPUnit": "~4.0" }, "suggest": { - "zendframework/zend-crypt": "Zend\\Crypt component", - "zendframework/zend-i18n": "Zend\\I18n component", - "zendframework/zend-servicemanager": "Zend\\ServiceManager component", - "zendframework/zend-uri": "Zend\\Uri component for UriNormalize filter" + "zendframework/zend-crypt": "Zend\\Crypt component, for encryption filters", + "zendframework/zend-i18n": "Zend\\I18n component for filters depending on i18n functionality", + "zendframework/zend-servicemanager": "Zend\\ServiceManager component, for using the filter chain functionality", + "zendframework/zend-uri": "Zend\\Uri component, for the UriNormalize filter" }, "minimum-stability": "dev", "prefer-stable": true, diff --git a/src/FilterPluginManager.php b/src/FilterPluginManager.php index 194f80bb..8ee3756f 100644 --- a/src/FilterPluginManager.php +++ b/src/FilterPluginManager.php @@ -294,10 +294,10 @@ class FilterPluginManager extends AbstractPluginManager 'zendfiltertoint' => InvokableFactory::class, 'zendfiltertonull' => InvokableFactory::class, - 'zendinfilteralnum' => InvokableFactory::class, - 'zendinfilteralpha' => InvokableFactory::class, - 'zendinviewhelpernumberformat' => InvokableFactory::class, - 'zendinfilternumberparse' => InvokableFactory::class, + 'zendi18nfilteralnum' => InvokableFactory::class, + 'zendi18nfilteralpha' => InvokableFactory::class, + 'zendi18nviewhelpernumberformat' => InvokableFactory::class, + 'zendi18nfilternumberparse' => InvokableFactory::class, 'zendfilterbasename' => InvokableFactory::class, 'zendfilterblacklist' => InvokableFactory::class, 'zendfilterboolean' => InvokableFactory::class, diff --git a/test/Compress/TarTest.php b/test/Compress/TarTest.php index c545406c..eb6de86e 100644 --- a/test/Compress/TarTest.php +++ b/test/Compress/TarTest.php @@ -9,8 +9,8 @@ namespace ZendTest\Filter\Compress; +use Archive_Tar; use Zend\Filter\Compress\Tar as TarCompression; -use Zend\Loader\StandardAutoloader; /** * @group Zend_Filter @@ -21,14 +21,6 @@ class TarTest extends \PHPUnit_Framework_TestCase public function setUp() { - if (!class_exists('Archive_Tar')) { - $autoloader = new StandardAutoloader(); - $autoloader->setFallbackAutoloader(true); - if (!$autoloader->autoload('Archive_Tar')) { - $this->markTestSkipped('This filter needs PEARs Archive_Tar'); - } - } - $this->tmp = sprintf('%s/%s', sys_get_temp_dir(), uniqid('zfilter')); mkdir($this->tmp, 0775, true); } diff --git a/test/FilterChainTest.php b/test/FilterChainTest.php index c8d9aa08..7b336cad 100644 --- a/test/FilterChainTest.php +++ b/test/FilterChainTest.php @@ -9,7 +9,7 @@ namespace ZendTest\Filter; -use Zend\Filter\AbstractFilter; +use ArrayIterator; use Zend\Filter\FilterChain; use Zend\Filter\PregReplace; use Zend\Filter\StringToLower; @@ -31,8 +31,8 @@ public function testEmptyFilterChainReturnsOriginalValue() public function testFiltersAreExecutedInFifoOrder() { $chain = new FilterChain(); - $chain->attach(new LowerCase()) - ->attach(new StripUpperCase()); + $chain->attach(new TestAsset\LowerCase()) + ->attach(new TestAsset\StripUpperCase()); $value = 'AbC'; $valueExpected = 'abc'; $this->assertEquals($valueExpected, $chain->filter($value)); @@ -41,8 +41,8 @@ public function testFiltersAreExecutedInFifoOrder() public function testFiltersAreExecutedAccordingToPriority() { $chain = new FilterChain(); - $chain->attach(new StripUpperCase()) - ->attach(new LowerCase, 100); + $chain->attach(new TestAsset\StripUpperCase()) + ->attach(new TestAsset\LowerCase, 100); $value = 'AbC'; $valueExpected = 'b'; $this->assertEquals($valueExpected, $chain->filter($value)); @@ -96,7 +96,7 @@ public function testAllowsConfiguringFiltersViaConstructor() public function testConfigurationAllowsTraversableObjects() { $config = $this->getChainConfig(); - $config = new \ArrayIterator($config); + $config = new ArrayIterator($config); $chain = new FilterChain($config); $value = ' abc '; $valueExpected = 'ABC'; @@ -180,8 +180,8 @@ public function testClone() public function testCanSerializeFilterChain() { $chain = new FilterChain(); - $chain->attach(new LowerCase()) - ->attach(new StripUpperCase()); + $chain->attach(new TestAsset\LowerCase()) + ->attach(new TestAsset\StripUpperCase()); $serialized = serialize($chain); $unserialized = unserialize($serialized); @@ -198,47 +198,29 @@ public function testMergingTwoFilterChainsKeepFiltersPriority() $valueExpected = 'abc'; $chain = new FilterChain(); - $chain->attach(new StripUpperCase()) - ->attach(new LowerCase(), 1001); + $chain->attach(new TestAsset\StripUpperCase()) + ->attach(new TestAsset\LowerCase(), 1001); $this->assertEquals($valueExpected, $chain->filter($value)); $chain = new FilterChain(); - $chain->attach(new LowerCase(), 1001) - ->attach(new StripUpperCase()); + $chain->attach(new TestAsset\LowerCase(), 1001) + ->attach(new TestAsset\StripUpperCase()); $this->assertEquals($valueExpected, $chain->filter($value)); $chain = new FilterChain(); - $chain->attach(new LowerCase(), 1001); + $chain->attach(new TestAsset\LowerCase(), 1001); $chainToMerge = new FilterChain(); - $chainToMerge->attach(new StripUpperCase()); + $chainToMerge->attach(new TestAsset\StripUpperCase()); $chain->merge($chainToMerge); $this->assertEquals(2, $chain->count()); $this->assertEquals($valueExpected, $chain->filter($value)); $chain = new FilterChain(); - $chain->attach(new StripUpperCase()); + $chain->attach(new TestAsset\StripUpperCase()); $chainToMerge = new FilterChain(); - $chainToMerge->attach(new LowerCase(), 1001); + $chainToMerge->attach(new TestAsset\LowerCase(), 1001); $chain->merge($chainToMerge); $this->assertEquals(2, $chain->count()); $this->assertEquals($valueExpected, $chain->filter($value)); } } - - -class LowerCase extends AbstractFilter -{ - public function filter($value) - { - return strtolower($value); - } -} - - -class StripUpperCase extends AbstractFilter -{ - public function filter($value) - { - return preg_replace('/[A-Z]/', '', $value); - } -} diff --git a/test/HtmlEntitiesTest.php b/test/HtmlEntitiesTest.php index 9563ed20..8a02f812 100644 --- a/test/HtmlEntitiesTest.php +++ b/test/HtmlEntitiesTest.php @@ -9,6 +9,7 @@ namespace ZendTest\Filter; +use ArrayObject; use Zend\Filter\HtmlEntities as HtmlEntitiesFilter; use Zend\Filter\Exception; use Zend\Stdlib\ErrorHandler; @@ -132,12 +133,16 @@ public function testFluentInterface() } /** + * This test uses an ArrayObject in place of a Zend\Config\Config instance; + * they two are interchangeable in this scenario, as HtmlEntitiesFilter is + * checking for arrays or Traversable instances. + * * @group ZF-8995 */ public function testConfigObject() { $options = ['quotestyle' => 5, 'encoding' => 'ISO-8859-1']; - $config = new \Zend\Config\Config($options); + $config = new ArrayObject($options); $filter = new HtmlEntitiesFilter( $config diff --git a/test/InflectorTest.php b/test/InflectorTest.php index ae4a5ba6..7bfdfef2 100644 --- a/test/InflectorTest.php +++ b/test/InflectorTest.php @@ -9,6 +9,7 @@ namespace ZendTest\Filter; +use ArrayObject; use Zend\Filter\FilterPluginManager; use Zend\Filter\Inflector as InflectorFilter; use Zend\Filter\PregReplace; @@ -16,7 +17,6 @@ use Zend\Filter\StringToUpper; use Zend\Filter\Word\CamelCaseToDash; use Zend\Filter\Word\CamelCaseToUnderscore; -use Zend\I18n\Filter\Alpha; use Zend\ServiceManager\ServiceManager; /** @@ -116,13 +116,9 @@ public function testSetFilterRuleWithFilterObjectCreatesRuleEntryWithFilterObjec public function testAddFilterRuleAppendsRuleEntries() { - if (!extension_loaded('intl')) { - $this->markTestSkipped('ext/intl not enabled'); - } - $rules = $this->inflector->getRules(); $this->assertEquals(0, count($rules)); - $this->inflector->setFilterRule('controller', [PregReplace::class, Alpha::class]); + $this->inflector->setFilterRule('controller', [PregReplace::class, TestAsset\Alpha::class]); $rules = $this->inflector->getRules('controller'); $this->assertEquals(2, count($rules)); $this->assertInstanceOf('Zend\Filter\FilterInterface', $rules[0]); @@ -165,14 +161,11 @@ public function testSetStaticRuleReferenceAllowsUpdatingRuleByReference() public function testAddRulesCreatesAppropriateRuleEntries() { - if (!extension_loaded('intl')) { - $this->markTestSkipped('ext/intl not enabled'); - } $rules = $this->inflector->getRules(); $this->assertEquals(0, count($rules)); $this->inflector->addRules([ - ':controller' => [PregReplace::class, Alpha::class], + ':controller' => [PregReplace::class, TestAsset\Alpha::class], 'suffix' => 'phtml', ]); $rules = $this->inflector->getRules(); @@ -183,15 +176,11 @@ public function testAddRulesCreatesAppropriateRuleEntries() public function testSetRulesCreatesAppropriateRuleEntries() { - if (!extension_loaded('intl')) { - $this->markTestSkipped('ext/intl not enabled'); - } - $this->inflector->setStaticRule('some-rules', 'some-value'); $rules = $this->inflector->getRules(); $this->assertEquals(1, count($rules)); $this->inflector->setRules([ - ':controller' => [PregReplace::class, Alpha::class], + ':controller' => [PregReplace::class, TestAsset\Alpha::class], 'suffix' => 'phtml', ]); $rules = $this->inflector->getRules(); @@ -202,11 +191,7 @@ public function testSetRulesCreatesAppropriateRuleEntries() public function testGetRule() { - if (!extension_loaded('intl')) { - $this->markTestSkipped('ext/intl not enabled'); - } - - $this->inflector->setFilterRule(':controller', [Alpha::class, StringToLower::class]); + $this->inflector->setFilterRule(':controller', [TestAsset\Alpha::class, StringToLower::class]); $this->assertInstanceOf('Zend\Filter\StringToLower', $this->inflector->getRule('controller', 1)); $this->assertFalse($this->inflector->getRule('controller', 2)); } @@ -327,11 +312,18 @@ public function getOptions() return $options; } + /** + * This method returns an ArrayObject instance in place of a + * Zend\Config\Config instance; the two are interchangeable, as inflectors + * consume the more general array or Traversable types. + * + * @return \Traversable + */ public function getConfig() { $options = $this->getOptions(); - return new \Zend\Config\Config($options); + return new ArrayObject($options); } protected function _testOptions($inflector) @@ -356,13 +348,6 @@ protected function _testOptions($inflector) $this->assertEquals($options['rules']['suffix'], $rules['suffix']); } - public function testPassingConfigObjectToConstructorSetsStateAndRules() - { - $config = $this->getConfig(); - $inflector = new InflectorFilter($config); - $this->_testOptions($inflector); - } - public function testSetConfigSetsStateAndRules() { $config = $this->getConfig(); @@ -395,8 +380,14 @@ public function testCheckInflectorWithPregBackreferenceLikeParts() 'controller' => 'FooBar', 'action' => 'MooToo' ]); - $this->assertEquals($filtered, - 'C:\htdocs\public\cache\00\01\42\app\modules' . DIRECTORY_SEPARATOR . 'foo-bar' . DIRECTORY_SEPARATOR . 'Moo-Too.phtml'); + $this->assertEquals( + $filtered, + 'C:\htdocs\public\cache\00\01\42\app\modules' + . DIRECTORY_SEPARATOR + . 'foo-bar' + . DIRECTORY_SEPARATOR + . 'Moo-Too.phtml' + ); } /** @@ -426,21 +417,17 @@ public function testNoInflectableTarget() */ public function testAddFilterRuleMultipleTimes() { - if (!extension_loaded('intl')) { - $this->markTestSkipped('ext/intl not enabled'); - } - $rules = $this->inflector->getRules(); $this->assertEquals(0, count($rules)); $this->inflector->setFilterRule('controller', PregReplace::class); $rules = $this->inflector->getRules('controller'); $this->assertEquals(1, count($rules)); - $this->inflector->addFilterRule('controller', [Alpha::class, StringToLower::class]); + $this->inflector->addFilterRule('controller', [TestAsset\Alpha::class, StringToLower::class]); $rules = $this->inflector->getRules('controller'); $this->assertEquals(3, count($rules)); $this->_context = StringToLower::class; $this->inflector->setStaticRuleReference('context', $this->_context); - $this->inflector->addFilterRule('controller', [Alpha::class, StringToLower::class]); + $this->inflector->addFilterRule('controller', [TestAsset\Alpha::class, StringToLower::class]); $rules = $this->inflector->getRules('controller'); $this->assertEquals(5, count($rules)); } @@ -468,7 +455,7 @@ public function testPassingArrayToSetConfigSetsStateAndRules() /** * @group ZF-8997 */ - public function testPassingZendConfigObjectToConstructorSetsStateAndRules() + public function testPassingConfigObjectToConstructorSetsStateAndRules() { $config = $this->getConfig(); $inflector = new InflectorFilter($config); @@ -478,7 +465,7 @@ public function testPassingZendConfigObjectToConstructorSetsStateAndRules() /** * @group ZF-8997 */ - public function testPassingZendConfigObjectToSetConfigSetsStateAndRules() + public function testPassingConfigObjectToSetConfigSetsStateAndRules() { $config = $this->getConfig(); $inflector = new InflectorFilter(); diff --git a/test/TestAsset/Alpha.php b/test/TestAsset/Alpha.php new file mode 100644 index 00000000..4d6f4830 --- /dev/null +++ b/test/TestAsset/Alpha.php @@ -0,0 +1,24 @@ +plugins['mydigits'] = 'TestNamespace\MyDigits'; - $this->plugins['stringequals'] = 'TestNamespace\StringEquals'; - parent::__construct($map); - } -} From 00cec479924a40d7add3e84b1dab8bb564e85ea5 Mon Sep 17 00:00:00 2001 From: Matthew Weier O'Phinney Date: Thu, 4 Feb 2016 09:26:36 -0600 Subject: [PATCH 5/7] 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. --- src/Callback.php | 2 +- src/File/Rename.php | 2 +- src/File/RenameUpload.php | 2 +- src/FilterPluginManager.php | 45 -------------- test/FilterPluginManagerCompatibilityTest.php | 60 +++++++++++++++++++ 5 files changed, 63 insertions(+), 48 deletions(-) create mode 100644 test/FilterPluginManagerCompatibilityTest.php diff --git a/src/Callback.php b/src/Callback.php index 6d6e70a1..8e1d8eb2 100644 --- a/src/Callback.php +++ b/src/Callback.php @@ -25,7 +25,7 @@ class Callback extends AbstractFilter * @param callable|array|Traversable $callbackOrOptions * @param array $callbackParams */ - public function __construct($callbackOrOptions, $callbackParams = []) + public function __construct($callbackOrOptions = [], $callbackParams = []) { if (is_callable($callbackOrOptions)) { $this->setCallback($callbackOrOptions); diff --git a/src/File/Rename.php b/src/File/Rename.php index b72273a1..d42b90bd 100644 --- a/src/File/Rename.php +++ b/src/File/Rename.php @@ -34,7 +34,7 @@ class Rename extends Filter\AbstractFilter * @param string|array|Traversable $options Target file or directory to be renamed * @throws Exception\InvalidArgumentException */ - public function __construct($options) + public function __construct($options = []) { if ($options instanceof Traversable) { $options = ArrayUtils::iteratorToArray($options); diff --git a/src/File/RenameUpload.php b/src/File/RenameUpload.php index 2302e8d4..e58d6cf7 100644 --- a/src/File/RenameUpload.php +++ b/src/File/RenameUpload.php @@ -40,7 +40,7 @@ class RenameUpload extends AbstractFilter * * @param array|string $targetOrOptions The target file path or an options array */ - public function __construct($targetOrOptions) + public function __construct($targetOrOptions = []) { if (is_array($targetOrOptions)) { $this->setOptions($targetOrOptions); diff --git a/src/FilterPluginManager.php b/src/FilterPluginManager.php index 8ee3756f..4041b8ef 100644 --- a/src/FilterPluginManager.php +++ b/src/FilterPluginManager.php @@ -58,27 +58,6 @@ class FilterPluginManager extends AbstractPluginManager 'Callback' => Callback::class, 'compress' => Compress::class, 'Compress' => Compress::class, - 'compressbz2' => Compress\Bz2::class, - 'compressBz2' => Compress\Bz2::class, - 'CompressBz2' => Compress\Bz2::class, - 'compressgz' => Compress\Gz::class, - 'compressGz' => Compress\Gz::class, - 'CompressGz' => Compress\Gz::class, - 'compresslzf' => Compress\Lzf::class, - 'compressLzf' => Compress\Lzf::class, - 'CompressLzf' => Compress\Lzf::class, - 'compressrar' => Compress\Rar::class, - 'compressRar' => Compress\Rar::class, - 'CompressRar' => Compress\Rar::class, - 'compresssnappy' => Compress\Snappy::class, - 'compressSnappy' => Compress\Snappy::class, - 'CompressSnappy' => Compress\Snappy::class, - 'compresstar' => Compress\Tar::class, - 'compressTar' => Compress\Tar::class, - 'CompressTar' => Compress\Tar::class, - 'compresszip' => Compress\Zip::class, - 'compressZip' => Compress\Zip::class, - 'CompressZip' => Compress\Zip::class, 'dataunitformatter' => DataUnitFormatter::class, 'dataUnitFormatter' => DataUnitFormatter::class, 'DataUnitFormatter' => DataUnitFormatter::class, @@ -105,12 +84,6 @@ class FilterPluginManager extends AbstractPluginManager 'Dir' => Dir::class, 'encrypt' => Encrypt::class, 'Encrypt' => Encrypt::class, - 'encryptblockcipher' => Encrypt\BlockCipher::class, - 'encryptBlockCipher' => Encrypt\BlockCipher::class, - 'EncryptBlockCipher' => Encrypt\BlockCipher::class, - 'encryptopenssl' => Encrypt\Openssl::class, - 'encryptOpenssl' => Encrypt\Openssl::class, - 'EncryptOpenssl' => Encrypt\Openssl::class, 'filedecrypt' => File\Decrypt::class, 'fileDecrypt' => File\Decrypt::class, 'FileDecrypt' => File\Decrypt::class, @@ -236,13 +209,6 @@ class FilterPluginManager extends AbstractPluginManager Boolean::class => InvokableFactory::class, Callback::class => InvokableFactory::class, Compress::class => InvokableFactory::class, - Compress\Bz2::class => InvokableFactory::class, - Compress\Gz::class => InvokableFactory::class, - Compress\Lzf::class => InvokableFactory::class, - Compress\Rar::class => InvokableFactory::class, - Compress\Snappy::class => InvokableFactory::class, - Compress\Tar::class => InvokableFactory::class, - Compress\Zip::class => InvokableFactory::class, DataUnitFormatter::class => InvokableFactory::class, DateSelect::class => InvokableFactory::class, DateTimeFormatter::class => InvokableFactory::class, @@ -252,8 +218,6 @@ class FilterPluginManager extends AbstractPluginManager Digits::class => InvokableFactory::class, Dir::class => InvokableFactory::class, Encrypt::class => InvokableFactory::class, - Encrypt\BlockCipher::class => InvokableFactory::class, - Encrypt\Openssl::class => InvokableFactory::class, File\Decrypt::class => InvokableFactory::class, File\Encrypt::class => InvokableFactory::class, File\LowerCase::class => InvokableFactory::class, @@ -303,13 +267,6 @@ class FilterPluginManager extends AbstractPluginManager 'zendfilterboolean' => InvokableFactory::class, 'zendfiltercallback' => InvokableFactory::class, 'zendfiltercompress' => InvokableFactory::class, - 'zendfiltercompressbz' => InvokableFactory::class, - 'zendfiltercompressgz' => InvokableFactory::class, - 'zendfiltercompresslzf' => InvokableFactory::class, - 'zendfiltercompressrar' => InvokableFactory::class, - 'zendfiltercompresssnappy' => InvokableFactory::class, - 'zendfiltercompresstar' => InvokableFactory::class, - 'zendfiltercompresszip' => InvokableFactory::class, 'zendfilterdataunitformatter' => InvokableFactory::class, 'zendfilterdateselect' => InvokableFactory::class, 'zendfilterdatetimeformatter' => InvokableFactory::class, @@ -319,8 +276,6 @@ class FilterPluginManager extends AbstractPluginManager 'zendfilterdigits' => InvokableFactory::class, 'zendfilterdir' => InvokableFactory::class, 'zendfilterencrypt' => InvokableFactory::class, - 'zendfilterencryptblockcipher' => InvokableFactory::class, - 'zendfilterencryptopenssl' => InvokableFactory::class, 'zendfilterfiledecrypt' => InvokableFactory::class, 'zendfilterfileencrypt' => InvokableFactory::class, 'zendfilterfilelowercase' => InvokableFactory::class, diff --git a/test/FilterPluginManagerCompatibilityTest.php b/test/FilterPluginManagerCompatibilityTest.php new file mode 100644 index 00000000..c678fc97 --- /dev/null +++ b/test/FilterPluginManagerCompatibilityTest.php @@ -0,0 +1,60 @@ +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]; + } + } +} From d9f704f3ad0b50c0bfdb7dea9922c2dda83a9937 Mon Sep 17 00:00:00 2001 From: Matthew Weier O'Phinney Date: Thu, 4 Feb 2016 09:36:34 -0600 Subject: [PATCH 6/7] Run CI on both v2 and v3 of zend-servicemanager --- .travis.yml | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 1a15e2db..80ab48df 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,16 +16,24 @@ matrix: include: - php: 5.5 env: - - SERVICE_MANAGER_VERSION="^2.7.3" - EXECUTE_CS_CHECK=true - - php: 5.6 + - php: 5.5 env: - SERVICE_MANAGER_VERSION="^2.7.3" + - php: 5.6 + env: - EXECUTE_TEST_COVERALLS=true + - php: 5.6 + env: + - SERVICE_MANAGER_VERSION="^2.7.3" + - php: 7 - php: 7 env: - SERVICE_MANAGER_VERSION="^2.7.3" - php: hhvm + - php: hhvm + env: + - SERVICE_MANAGER_VERSION="^2.7.3" allow_failures: - php: hhvm @@ -38,7 +46,7 @@ before_install: - composer self-update - if [[ $EXECUTE_TEST_COVERALLS == 'true' ]]; then composer require --dev --no-update satooshi/php-coveralls ; fi - if [[ $SERVICE_MANAGER_VERSION != '' ]]; then composer require --dev --no-update "zendframework/zend-servicemanager:$SERVICE_MANAGER_VERSION" ; fi - - if [[ $SERVICE_MANAGER_VERSION == '' ]]; then composer require --dev --no-update "zendframework/zend-servicemanager:^3.0" ; fi + - if [[ $SERVICE_MANAGER_VERSION == '' ]]; then composer require --dev --no-update "zendframework/zend-servicemanager:^3.0.3" ; fi install: - travis_retry composer install --no-interaction --ignore-platform-reqs From 330a2562725c599cae503b0d8b16b506bba6e7df Mon Sep 17 00:00:00 2001 From: Matthew Weier O'Phinney Date: Thu, 4 Feb 2016 09:41:58 -0600 Subject: [PATCH 7/7] CS fixes per php-cs-fixer --- test/Compress/TarTest.php | 1 - test/InflectorTest.php | 1 - 2 files changed, 2 deletions(-) diff --git a/test/Compress/TarTest.php b/test/Compress/TarTest.php index eb6de86e..de2fdc99 100644 --- a/test/Compress/TarTest.php +++ b/test/Compress/TarTest.php @@ -9,7 +9,6 @@ namespace ZendTest\Filter\Compress; -use Archive_Tar; use Zend\Filter\Compress\Tar as TarCompression; /** diff --git a/test/InflectorTest.php b/test/InflectorTest.php index 7bfdfef2..bdddaef9 100644 --- a/test/InflectorTest.php +++ b/test/InflectorTest.php @@ -161,7 +161,6 @@ public function testSetStaticRuleReferenceAllowsUpdatingRuleByReference() public function testAddRulesCreatesAppropriateRuleEntries() { - $rules = $this->inflector->getRules(); $this->assertEquals(0, count($rules)); $this->inflector->addRules([