PK p?V3VK K phpunit.xml.distnu W+A
tests
src
PK p?VvM1 1
composer.locknu W+A {
"_readme": [
"This file locks the dependencies of your project to a known state",
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
"content-hash": "2d6f92db2ccefd09bfaa429476c80ac6",
"packages": [
{
"name": "consolidation/output-formatters",
"version": "3.1.12",
"source": {
"type": "git",
"url": "https://github.com/consolidation/output-formatters.git",
"reference": "88ef346a1cefb92aab8b57a3214a6d5fc63f5d2a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/consolidation/output-formatters/zipball/88ef346a1cefb92aab8b57a3214a6d5fc63f5d2a",
"reference": "88ef346a1cefb92aab8b57a3214a6d5fc63f5d2a",
"shasum": ""
},
"require": {
"php": ">=5.4.0",
"symfony/console": "^2.8|~3",
"symfony/finder": "~2.5|~3.0"
},
"require-dev": {
"phpunit/phpunit": "^4.8",
"satooshi/php-coveralls": "^1.0",
"squizlabs/php_codesniffer": "^2.7",
"victorjonsson/markdowndocs": "^1.3"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.x-dev"
}
},
"autoload": {
"psr-4": {
"Consolidation\\OutputFormatters\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Greg Anderson",
"email": "greg.1.anderson@greenknowe.org"
}
],
"description": "Format text by applying transformations provided by plug-in formatters.",
"time": "2017-10-12T19:38:03+00:00"
},
{
"name": "psr/log",
"version": "1.0.2",
"source": {
"type": "git",
"url": "https://github.com/php-fig/log.git",
"reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-fig/log/zipball/4ebe3a8bf773a19edfe0a84b6585ba3d401b724d",
"reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d",
"shasum": ""
},
"require": {
"php": ">=5.3.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
},
"autoload": {
"psr-4": {
"Psr\\Log\\": "Psr/Log/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "PHP-FIG",
"homepage": "http://www.php-fig.org/"
}
],
"description": "Common interface for logging libraries",
"homepage": "https://github.com/php-fig/log",
"keywords": [
"log",
"psr",
"psr-3"
],
"time": "2016-10-10T12:19:37+00:00"
},
{
"name": "symfony/console",
"version": "v3.3.10",
"source": {
"type": "git",
"url": "https://github.com/symfony/console.git",
"reference": "116bc56e45a8e5572e51eb43ab58c769a352366c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/console/zipball/116bc56e45a8e5572e51eb43ab58c769a352366c",
"reference": "116bc56e45a8e5572e51eb43ab58c769a352366c",
"shasum": ""
},
"require": {
"php": "^5.5.9|>=7.0.8",
"symfony/debug": "~2.8|~3.0",
"symfony/polyfill-mbstring": "~1.0"
},
"conflict": {
"symfony/dependency-injection": "<3.3"
},
"require-dev": {
"psr/log": "~1.0",
"symfony/config": "~3.3",
"symfony/dependency-injection": "~3.3",
"symfony/event-dispatcher": "~2.8|~3.0",
"symfony/filesystem": "~2.8|~3.0",
"symfony/process": "~2.8|~3.0"
},
"suggest": {
"psr/log": "For using the console logger",
"symfony/event-dispatcher": "",
"symfony/filesystem": "",
"symfony/process": ""
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.3-dev"
}
},
"autoload": {
"psr-4": {
"Symfony\\Component\\Console\\": ""
},
"exclude-from-classmap": [
"/Tests/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony Console Component",
"homepage": "https://symfony.com",
"time": "2017-10-02T06:42:24+00:00"
},
{
"name": "symfony/debug",
"version": "v3.3.10",
"source": {
"type": "git",
"url": "https://github.com/symfony/debug.git",
"reference": "eb95d9ce8f18dcc1b3dfff00cb624c402be78ffd"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/debug/zipball/eb95d9ce8f18dcc1b3dfff00cb624c402be78ffd",
"reference": "eb95d9ce8f18dcc1b3dfff00cb624c402be78ffd",
"shasum": ""
},
"require": {
"php": "^5.5.9|>=7.0.8",
"psr/log": "~1.0"
},
"conflict": {
"symfony/http-kernel": ">=2.3,<2.3.24|~2.4.0|>=2.5,<2.5.9|>=2.6,<2.6.2"
},
"require-dev": {
"symfony/http-kernel": "~2.8|~3.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.3-dev"
}
},
"autoload": {
"psr-4": {
"Symfony\\Component\\Debug\\": ""
},
"exclude-from-classmap": [
"/Tests/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony Debug Component",
"homepage": "https://symfony.com",
"time": "2017-10-02T06:42:24+00:00"
},
{
"name": "symfony/event-dispatcher",
"version": "v3.3.10",
"source": {
"type": "git",
"url": "https://github.com/symfony/event-dispatcher.git",
"reference": "d7ba037e4b8221956ab1e221c73c9e27e05dd423"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/d7ba037e4b8221956ab1e221c73c9e27e05dd423",
"reference": "d7ba037e4b8221956ab1e221c73c9e27e05dd423",
"shasum": ""
},
"require": {
"php": "^5.5.9|>=7.0.8"
},
"conflict": {
"symfony/dependency-injection": "<3.3"
},
"require-dev": {
"psr/log": "~1.0",
"symfony/config": "~2.8|~3.0",
"symfony/dependency-injection": "~3.3",
"symfony/expression-language": "~2.8|~3.0",
"symfony/stopwatch": "~2.8|~3.0"
},
"suggest": {
"symfony/dependency-injection": "",
"symfony/http-kernel": ""
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.3-dev"
}
},
"autoload": {
"psr-4": {
"Symfony\\Component\\EventDispatcher\\": ""
},
"exclude-from-classmap": [
"/Tests/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony EventDispatcher Component",
"homepage": "https://symfony.com",
"time": "2017-10-02T06:42:24+00:00"
},
{
"name": "symfony/finder",
"version": "v3.3.10",
"source": {
"type": "git",
"url": "https://github.com/symfony/finder.git",
"reference": "773e19a491d97926f236942484cb541560ce862d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/finder/zipball/773e19a491d97926f236942484cb541560ce862d",
"reference": "773e19a491d97926f236942484cb541560ce862d",
"shasum": ""
},
"require": {
"php": "^5.5.9|>=7.0.8"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.3-dev"
}
},
"autoload": {
"psr-4": {
"Symfony\\Component\\Finder\\": ""
},
"exclude-from-classmap": [
"/Tests/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony Finder Component",
"homepage": "https://symfony.com",
"time": "2017-10-02T06:42:24+00:00"
},
{
"name": "symfony/polyfill-mbstring",
"version": "v1.5.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-mbstring.git",
"reference": "7c8fae0ac1d216eb54349e6a8baa57d515fe8803"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/7c8fae0ac1d216eb54349e6a8baa57d515fe8803",
"reference": "7c8fae0ac1d216eb54349e6a8baa57d515fe8803",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"suggest": {
"ext-mbstring": "For best performance"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.5-dev"
}
},
"autoload": {
"psr-4": {
"Symfony\\Polyfill\\Mbstring\\": ""
},
"files": [
"bootstrap.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Nicolas Grekas",
"email": "p@tchwork.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony polyfill for the Mbstring extension",
"homepage": "https://symfony.com",
"keywords": [
"compatibility",
"mbstring",
"polyfill",
"portable",
"shim"
],
"time": "2017-06-14T15:44:48+00:00"
}
],
"packages-dev": [
{
"name": "doctrine/instantiator",
"version": "1.0.5",
"source": {
"type": "git",
"url": "https://github.com/doctrine/instantiator.git",
"reference": "8e884e78f9f0eb1329e445619e04456e64d8051d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/doctrine/instantiator/zipball/8e884e78f9f0eb1329e445619e04456e64d8051d",
"reference": "8e884e78f9f0eb1329e445619e04456e64d8051d",
"shasum": ""
},
"require": {
"php": ">=5.3,<8.0-DEV"
},
"require-dev": {
"athletic/athletic": "~0.1.8",
"ext-pdo": "*",
"ext-phar": "*",
"phpunit/phpunit": "~4.0",
"squizlabs/php_codesniffer": "~2.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
},
"autoload": {
"psr-4": {
"Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Marco Pivetta",
"email": "ocramius@gmail.com",
"homepage": "http://ocramius.github.com/"
}
],
"description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors",
"homepage": "https://github.com/doctrine/instantiator",
"keywords": [
"constructor",
"instantiate"
],
"time": "2015-06-14T21:17:01+00:00"
},
{
"name": "guzzle/guzzle",
"version": "v3.8.1",
"source": {
"type": "git",
"url": "https://github.com/guzzle/guzzle.git",
"reference": "4de0618a01b34aa1c8c33a3f13f396dcd3882eba"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/guzzle/guzzle/zipball/4de0618a01b34aa1c8c33a3f13f396dcd3882eba",
"reference": "4de0618a01b34aa1c8c33a3f13f396dcd3882eba",
"shasum": ""
},
"require": {
"ext-curl": "*",
"php": ">=5.3.3",
"symfony/event-dispatcher": ">=2.1"
},
"replace": {
"guzzle/batch": "self.version",
"guzzle/cache": "self.version",
"guzzle/common": "self.version",
"guzzle/http": "self.version",
"guzzle/inflection": "self.version",
"guzzle/iterator": "self.version",
"guzzle/log": "self.version",
"guzzle/parser": "self.version",
"guzzle/plugin": "self.version",
"guzzle/plugin-async": "self.version",
"guzzle/plugin-backoff": "self.version",
"guzzle/plugin-cache": "self.version",
"guzzle/plugin-cookie": "self.version",
"guzzle/plugin-curlauth": "self.version",
"guzzle/plugin-error-response": "self.version",
"guzzle/plugin-history": "self.version",
"guzzle/plugin-log": "self.version",
"guzzle/plugin-md5": "self.version",
"guzzle/plugin-mock": "self.version",
"guzzle/plugin-oauth": "self.version",
"guzzle/service": "self.version",
"guzzle/stream": "self.version"
},
"require-dev": {
"doctrine/cache": "*",
"monolog/monolog": "1.*",
"phpunit/phpunit": "3.7.*",
"psr/log": "1.0.*",
"symfony/class-loader": "*",
"zendframework/zend-cache": "<2.3",
"zendframework/zend-log": "<2.3"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.8-dev"
}
},
"autoload": {
"psr-0": {
"Guzzle": "src/",
"Guzzle\\Tests": "tests/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Michael Dowling",
"email": "mtdowling@gmail.com",
"homepage": "https://github.com/mtdowling"
},
{
"name": "Guzzle Community",
"homepage": "https://github.com/guzzle/guzzle/contributors"
}
],
"description": "Guzzle is a PHP HTTP client library and framework for building RESTful web service clients",
"homepage": "http://guzzlephp.org/",
"keywords": [
"client",
"curl",
"framework",
"http",
"http client",
"rest",
"web service"
],
"abandoned": "guzzlehttp/guzzle",
"time": "2014-01-28T22:29:15+00:00"
},
{
"name": "phpdocumentor/reflection-common",
"version": "1.0.1",
"source": {
"type": "git",
"url": "https://github.com/phpDocumentor/ReflectionCommon.git",
"reference": "21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6",
"reference": "21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6",
"shasum": ""
},
"require": {
"php": ">=5.5"
},
"require-dev": {
"phpunit/phpunit": "^4.6"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
},
"autoload": {
"psr-4": {
"phpDocumentor\\Reflection\\": [
"src"
]
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Jaap van Otterdijk",
"email": "opensource@ijaap.nl"
}
],
"description": "Common reflection classes used by phpdocumentor to reflect the code structure",
"homepage": "http://www.phpdoc.org",
"keywords": [
"FQSEN",
"phpDocumentor",
"phpdoc",
"reflection",
"static analysis"
],
"time": "2017-09-11T18:02:19+00:00"
},
{
"name": "phpdocumentor/reflection-docblock",
"version": "3.2.2",
"source": {
"type": "git",
"url": "https://github.com/phpDocumentor/ReflectionDocBlock.git",
"reference": "4aada1f93c72c35e22fb1383b47fee43b8f1d157"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/4aada1f93c72c35e22fb1383b47fee43b8f1d157",
"reference": "4aada1f93c72c35e22fb1383b47fee43b8f1d157",
"shasum": ""
},
"require": {
"php": ">=5.5",
"phpdocumentor/reflection-common": "^1.0@dev",
"phpdocumentor/type-resolver": "^0.3.0",
"webmozart/assert": "^1.0"
},
"require-dev": {
"mockery/mockery": "^0.9.4",
"phpunit/phpunit": "^4.4"
},
"type": "library",
"autoload": {
"psr-4": {
"phpDocumentor\\Reflection\\": [
"src/"
]
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Mike van Riel",
"email": "me@mikevanriel.com"
}
],
"description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.",
"time": "2017-08-08T06:39:58+00:00"
},
{
"name": "phpdocumentor/type-resolver",
"version": "0.3.0",
"source": {
"type": "git",
"url": "https://github.com/phpDocumentor/TypeResolver.git",
"reference": "fb3933512008d8162b3cdf9e18dba9309b7c3773"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/fb3933512008d8162b3cdf9e18dba9309b7c3773",
"reference": "fb3933512008d8162b3cdf9e18dba9309b7c3773",
"shasum": ""
},
"require": {
"php": "^5.5 || ^7.0",
"phpdocumentor/reflection-common": "^1.0"
},
"require-dev": {
"mockery/mockery": "^0.9.4",
"phpunit/phpunit": "^5.2||^4.8.24"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
},
"autoload": {
"psr-4": {
"phpDocumentor\\Reflection\\": [
"src/"
]
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Mike van Riel",
"email": "me@mikevanriel.com"
}
],
"time": "2017-06-03T08:32:36+00:00"
},
{
"name": "phpspec/prophecy",
"version": "v1.7.2",
"source": {
"type": "git",
"url": "https://github.com/phpspec/prophecy.git",
"reference": "c9b8c6088acd19d769d4cc0ffa60a9fe34344bd6"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpspec/prophecy/zipball/c9b8c6088acd19d769d4cc0ffa60a9fe34344bd6",
"reference": "c9b8c6088acd19d769d4cc0ffa60a9fe34344bd6",
"shasum": ""
},
"require": {
"doctrine/instantiator": "^1.0.2",
"php": "^5.3|^7.0",
"phpdocumentor/reflection-docblock": "^2.0|^3.0.2|^4.0",
"sebastian/comparator": "^1.1|^2.0",
"sebastian/recursion-context": "^1.0|^2.0|^3.0"
},
"require-dev": {
"phpspec/phpspec": "^2.5|^3.2",
"phpunit/phpunit": "^4.8 || ^5.6.5"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.7.x-dev"
}
},
"autoload": {
"psr-0": {
"Prophecy\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Konstantin Kudryashov",
"email": "ever.zet@gmail.com",
"homepage": "http://everzet.com"
},
{
"name": "Marcello Duarte",
"email": "marcello.duarte@gmail.com"
}
],
"description": "Highly opinionated mocking framework for PHP 5.3+",
"homepage": "https://github.com/phpspec/prophecy",
"keywords": [
"Double",
"Dummy",
"fake",
"mock",
"spy",
"stub"
],
"time": "2017-09-04T11:05:03+00:00"
},
{
"name": "phpunit/php-code-coverage",
"version": "2.2.4",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-code-coverage.git",
"reference": "eabf68b476ac7d0f73793aada060f1c1a9bf8979"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/eabf68b476ac7d0f73793aada060f1c1a9bf8979",
"reference": "eabf68b476ac7d0f73793aada060f1c1a9bf8979",
"shasum": ""
},
"require": {
"php": ">=5.3.3",
"phpunit/php-file-iterator": "~1.3",
"phpunit/php-text-template": "~1.2",
"phpunit/php-token-stream": "~1.3",
"sebastian/environment": "^1.3.2",
"sebastian/version": "~1.0"
},
"require-dev": {
"ext-xdebug": ">=2.1.4",
"phpunit/phpunit": "~4"
},
"suggest": {
"ext-dom": "*",
"ext-xdebug": ">=2.2.1",
"ext-xmlwriter": "*"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.2.x-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sb@sebastian-bergmann.de",
"role": "lead"
}
],
"description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.",
"homepage": "https://github.com/sebastianbergmann/php-code-coverage",
"keywords": [
"coverage",
"testing",
"xunit"
],
"time": "2015-10-06T15:47:00+00:00"
},
{
"name": "phpunit/php-file-iterator",
"version": "1.4.2",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-file-iterator.git",
"reference": "3cc8f69b3028d0f96a9078e6295d86e9bf019be5"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/3cc8f69b3028d0f96a9078e6295d86e9bf019be5",
"reference": "3cc8f69b3028d0f96a9078e6295d86e9bf019be5",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.4.x-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sb@sebastian-bergmann.de",
"role": "lead"
}
],
"description": "FilterIterator implementation that filters files based on a list of suffixes.",
"homepage": "https://github.com/sebastianbergmann/php-file-iterator/",
"keywords": [
"filesystem",
"iterator"
],
"time": "2016-10-03T07:40:28+00:00"
},
{
"name": "phpunit/php-text-template",
"version": "1.2.1",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-text-template.git",
"reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/31f8b717e51d9a2afca6c9f046f5d69fc27c8686",
"reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"type": "library",
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de",
"role": "lead"
}
],
"description": "Simple template engine.",
"homepage": "https://github.com/sebastianbergmann/php-text-template/",
"keywords": [
"template"
],
"time": "2015-06-21T13:50:34+00:00"
},
{
"name": "phpunit/php-timer",
"version": "1.0.9",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-timer.git",
"reference": "3dcf38ca72b158baf0bc245e9184d3fdffa9c46f"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/3dcf38ca72b158baf0bc245e9184d3fdffa9c46f",
"reference": "3dcf38ca72b158baf0bc245e9184d3fdffa9c46f",
"shasum": ""
},
"require": {
"php": "^5.3.3 || ^7.0"
},
"require-dev": {
"phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sb@sebastian-bergmann.de",
"role": "lead"
}
],
"description": "Utility class for timing",
"homepage": "https://github.com/sebastianbergmann/php-timer/",
"keywords": [
"timer"
],
"time": "2017-02-26T11:10:40+00:00"
},
{
"name": "phpunit/php-token-stream",
"version": "1.4.11",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-token-stream.git",
"reference": "e03f8f67534427a787e21a385a67ec3ca6978ea7"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/e03f8f67534427a787e21a385a67ec3ca6978ea7",
"reference": "e03f8f67534427a787e21a385a67ec3ca6978ea7",
"shasum": ""
},
"require": {
"ext-tokenizer": "*",
"php": ">=5.3.3"
},
"require-dev": {
"phpunit/phpunit": "~4.2"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.4-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de"
}
],
"description": "Wrapper around PHP's tokenizer extension.",
"homepage": "https://github.com/sebastianbergmann/php-token-stream/",
"keywords": [
"tokenizer"
],
"time": "2017-02-27T10:12:30+00:00"
},
{
"name": "phpunit/phpunit",
"version": "4.8.36",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/phpunit.git",
"reference": "46023de9a91eec7dfb06cc56cb4e260017298517"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/46023de9a91eec7dfb06cc56cb4e260017298517",
"reference": "46023de9a91eec7dfb06cc56cb4e260017298517",
"shasum": ""
},
"require": {
"ext-dom": "*",
"ext-json": "*",
"ext-pcre": "*",
"ext-reflection": "*",
"ext-spl": "*",
"php": ">=5.3.3",
"phpspec/prophecy": "^1.3.1",
"phpunit/php-code-coverage": "~2.1",
"phpunit/php-file-iterator": "~1.4",
"phpunit/php-text-template": "~1.2",
"phpunit/php-timer": "^1.0.6",
"phpunit/phpunit-mock-objects": "~2.3",
"sebastian/comparator": "~1.2.2",
"sebastian/diff": "~1.2",
"sebastian/environment": "~1.3",
"sebastian/exporter": "~1.2",
"sebastian/global-state": "~1.0",
"sebastian/version": "~1.0",
"symfony/yaml": "~2.1|~3.0"
},
"suggest": {
"phpunit/php-invoker": "~1.1"
},
"bin": [
"phpunit"
],
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "4.8.x-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de",
"role": "lead"
}
],
"description": "The PHP Unit Testing framework.",
"homepage": "https://phpunit.de/",
"keywords": [
"phpunit",
"testing",
"xunit"
],
"time": "2017-06-21T08:07:12+00:00"
},
{
"name": "phpunit/phpunit-mock-objects",
"version": "2.3.8",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git",
"reference": "ac8e7a3db35738d56ee9a76e78a4e03d97628983"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/ac8e7a3db35738d56ee9a76e78a4e03d97628983",
"reference": "ac8e7a3db35738d56ee9a76e78a4e03d97628983",
"shasum": ""
},
"require": {
"doctrine/instantiator": "^1.0.2",
"php": ">=5.3.3",
"phpunit/php-text-template": "~1.2",
"sebastian/exporter": "~1.2"
},
"require-dev": {
"phpunit/phpunit": "~4.4"
},
"suggest": {
"ext-soap": "*"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.3.x-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sb@sebastian-bergmann.de",
"role": "lead"
}
],
"description": "Mock Object library for PHPUnit",
"homepage": "https://github.com/sebastianbergmann/phpunit-mock-objects/",
"keywords": [
"mock",
"xunit"
],
"time": "2015-10-02T06:51:40+00:00"
},
{
"name": "satooshi/php-coveralls",
"version": "v1.0.1",
"source": {
"type": "git",
"url": "https://github.com/satooshi/php-coveralls.git",
"reference": "da51d304fe8622bf9a6da39a8446e7afd432115c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/satooshi/php-coveralls/zipball/da51d304fe8622bf9a6da39a8446e7afd432115c",
"reference": "da51d304fe8622bf9a6da39a8446e7afd432115c",
"shasum": ""
},
"require": {
"ext-json": "*",
"ext-simplexml": "*",
"guzzle/guzzle": "^2.8|^3.0",
"php": ">=5.3.3",
"psr/log": "^1.0",
"symfony/config": "^2.1|^3.0",
"symfony/console": "^2.1|^3.0",
"symfony/stopwatch": "^2.0|^3.0",
"symfony/yaml": "^2.0|^3.0"
},
"suggest": {
"symfony/http-kernel": "Allows Symfony integration"
},
"bin": [
"bin/coveralls"
],
"type": "library",
"autoload": {
"psr-4": {
"Satooshi\\": "src/Satooshi/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Kitamura Satoshi",
"email": "with.no.parachute@gmail.com",
"homepage": "https://www.facebook.com/satooshi.jp"
}
],
"description": "PHP client library for Coveralls API",
"homepage": "https://github.com/satooshi/php-coveralls",
"keywords": [
"ci",
"coverage",
"github",
"test"
],
"time": "2016-01-20T17:35:46+00:00"
},
{
"name": "sebastian/comparator",
"version": "1.2.4",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/comparator.git",
"reference": "2b7424b55f5047b47ac6e5ccb20b2aea4011d9be"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/2b7424b55f5047b47ac6e5ccb20b2aea4011d9be",
"reference": "2b7424b55f5047b47ac6e5ccb20b2aea4011d9be",
"shasum": ""
},
"require": {
"php": ">=5.3.3",
"sebastian/diff": "~1.2",
"sebastian/exporter": "~1.2 || ~2.0"
},
"require-dev": {
"phpunit/phpunit": "~4.4"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.2.x-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Jeff Welch",
"email": "whatthejeff@gmail.com"
},
{
"name": "Volker Dusch",
"email": "github@wallbash.com"
},
{
"name": "Bernhard Schussek",
"email": "bschussek@2bepublished.at"
},
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de"
}
],
"description": "Provides the functionality to compare PHP values for equality",
"homepage": "http://www.github.com/sebastianbergmann/comparator",
"keywords": [
"comparator",
"compare",
"equality"
],
"time": "2017-01-29T09:50:25+00:00"
},
{
"name": "sebastian/diff",
"version": "1.4.3",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/diff.git",
"reference": "7f066a26a962dbe58ddea9f72a4e82874a3975a4"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/7f066a26a962dbe58ddea9f72a4e82874a3975a4",
"reference": "7f066a26a962dbe58ddea9f72a4e82874a3975a4",
"shasum": ""
},
"require": {
"php": "^5.3.3 || ^7.0"
},
"require-dev": {
"phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.4-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Kore Nordmann",
"email": "mail@kore-nordmann.de"
},
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de"
}
],
"description": "Diff implementation",
"homepage": "https://github.com/sebastianbergmann/diff",
"keywords": [
"diff"
],
"time": "2017-05-22T07:24:03+00:00"
},
{
"name": "sebastian/environment",
"version": "1.3.8",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/environment.git",
"reference": "be2c607e43ce4c89ecd60e75c6a85c126e754aea"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/be2c607e43ce4c89ecd60e75c6a85c126e754aea",
"reference": "be2c607e43ce4c89ecd60e75c6a85c126e754aea",
"shasum": ""
},
"require": {
"php": "^5.3.3 || ^7.0"
},
"require-dev": {
"phpunit/phpunit": "^4.8 || ^5.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.3.x-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de"
}
],
"description": "Provides functionality to handle HHVM/PHP environments",
"homepage": "http://www.github.com/sebastianbergmann/environment",
"keywords": [
"Xdebug",
"environment",
"hhvm"
],
"time": "2016-08-18T05:49:44+00:00"
},
{
"name": "sebastian/exporter",
"version": "1.2.2",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/exporter.git",
"reference": "42c4c2eec485ee3e159ec9884f95b431287edde4"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/42c4c2eec485ee3e159ec9884f95b431287edde4",
"reference": "42c4c2eec485ee3e159ec9884f95b431287edde4",
"shasum": ""
},
"require": {
"php": ">=5.3.3",
"sebastian/recursion-context": "~1.0"
},
"require-dev": {
"ext-mbstring": "*",
"phpunit/phpunit": "~4.4"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.3.x-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Jeff Welch",
"email": "whatthejeff@gmail.com"
},
{
"name": "Volker Dusch",
"email": "github@wallbash.com"
},
{
"name": "Bernhard Schussek",
"email": "bschussek@2bepublished.at"
},
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de"
},
{
"name": "Adam Harvey",
"email": "aharvey@php.net"
}
],
"description": "Provides the functionality to export PHP variables for visualization",
"homepage": "http://www.github.com/sebastianbergmann/exporter",
"keywords": [
"export",
"exporter"
],
"time": "2016-06-17T09:04:28+00:00"
},
{
"name": "sebastian/global-state",
"version": "1.1.1",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/global-state.git",
"reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/bc37d50fea7d017d3d340f230811c9f1d7280af4",
"reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"require-dev": {
"phpunit/phpunit": "~4.2"
},
"suggest": {
"ext-uopz": "*"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de"
}
],
"description": "Snapshotting of global state",
"homepage": "http://www.github.com/sebastianbergmann/global-state",
"keywords": [
"global state"
],
"time": "2015-10-12T03:26:01+00:00"
},
{
"name": "sebastian/recursion-context",
"version": "1.0.5",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/recursion-context.git",
"reference": "b19cc3298482a335a95f3016d2f8a6950f0fbcd7"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/b19cc3298482a335a95f3016d2f8a6950f0fbcd7",
"reference": "b19cc3298482a335a95f3016d2f8a6950f0fbcd7",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"require-dev": {
"phpunit/phpunit": "~4.4"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Jeff Welch",
"email": "whatthejeff@gmail.com"
},
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de"
},
{
"name": "Adam Harvey",
"email": "aharvey@php.net"
}
],
"description": "Provides functionality to recursively process PHP variables",
"homepage": "http://www.github.com/sebastianbergmann/recursion-context",
"time": "2016-10-03T07:41:43+00:00"
},
{
"name": "sebastian/version",
"version": "1.0.6",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/version.git",
"reference": "58b3a85e7999757d6ad81c787a1fbf5ff6c628c6"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/version/zipball/58b3a85e7999757d6ad81c787a1fbf5ff6c628c6",
"reference": "58b3a85e7999757d6ad81c787a1fbf5ff6c628c6",
"shasum": ""
},
"type": "library",
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de",
"role": "lead"
}
],
"description": "Library that helps with managing the version number of Git-hosted PHP projects",
"homepage": "https://github.com/sebastianbergmann/version",
"time": "2015-06-21T13:59:46+00:00"
},
{
"name": "squizlabs/php_codesniffer",
"version": "2.9.1",
"source": {
"type": "git",
"url": "https://github.com/squizlabs/PHP_CodeSniffer.git",
"reference": "dcbed1074f8244661eecddfc2a675430d8d33f62"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/dcbed1074f8244661eecddfc2a675430d8d33f62",
"reference": "dcbed1074f8244661eecddfc2a675430d8d33f62",
"shasum": ""
},
"require": {
"ext-simplexml": "*",
"ext-tokenizer": "*",
"ext-xmlwriter": "*",
"php": ">=5.1.2"
},
"require-dev": {
"phpunit/phpunit": "~4.0"
},
"bin": [
"scripts/phpcs",
"scripts/phpcbf"
],
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.x-dev"
}
},
"autoload": {
"classmap": [
"CodeSniffer.php",
"CodeSniffer/CLI.php",
"CodeSniffer/Exception.php",
"CodeSniffer/File.php",
"CodeSniffer/Fixer.php",
"CodeSniffer/Report.php",
"CodeSniffer/Reporting.php",
"CodeSniffer/Sniff.php",
"CodeSniffer/Tokens.php",
"CodeSniffer/Reports/",
"CodeSniffer/Tokenizers/",
"CodeSniffer/DocGenerators/",
"CodeSniffer/Standards/AbstractPatternSniff.php",
"CodeSniffer/Standards/AbstractScopeSniff.php",
"CodeSniffer/Standards/AbstractVariableSniff.php",
"CodeSniffer/Standards/IncorrectPatternException.php",
"CodeSniffer/Standards/Generic/Sniffs/",
"CodeSniffer/Standards/MySource/Sniffs/",
"CodeSniffer/Standards/PEAR/Sniffs/",
"CodeSniffer/Standards/PSR1/Sniffs/",
"CodeSniffer/Standards/PSR2/Sniffs/",
"CodeSniffer/Standards/Squiz/Sniffs/",
"CodeSniffer/Standards/Zend/Sniffs/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Greg Sherwood",
"role": "lead"
}
],
"description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.",
"homepage": "http://www.squizlabs.com/php-codesniffer",
"keywords": [
"phpcs",
"standards"
],
"time": "2017-05-22T02:43:20+00:00"
},
{
"name": "symfony/config",
"version": "v3.3.10",
"source": {
"type": "git",
"url": "https://github.com/symfony/config.git",
"reference": "4ab62407bff9cd97c410a7feaef04c375aaa5cfd"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/config/zipball/4ab62407bff9cd97c410a7feaef04c375aaa5cfd",
"reference": "4ab62407bff9cd97c410a7feaef04c375aaa5cfd",
"shasum": ""
},
"require": {
"php": "^5.5.9|>=7.0.8",
"symfony/filesystem": "~2.8|~3.0"
},
"conflict": {
"symfony/dependency-injection": "<3.3",
"symfony/finder": "<3.3"
},
"require-dev": {
"symfony/dependency-injection": "~3.3",
"symfony/finder": "~3.3",
"symfony/yaml": "~3.0"
},
"suggest": {
"symfony/yaml": "To use the yaml reference dumper"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.3-dev"
}
},
"autoload": {
"psr-4": {
"Symfony\\Component\\Config\\": ""
},
"exclude-from-classmap": [
"/Tests/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony Config Component",
"homepage": "https://symfony.com",
"time": "2017-10-04T18:56:58+00:00"
},
{
"name": "symfony/filesystem",
"version": "v3.3.10",
"source": {
"type": "git",
"url": "https://github.com/symfony/filesystem.git",
"reference": "90bc45abf02ae6b7deb43895c1052cb0038506f1"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/filesystem/zipball/90bc45abf02ae6b7deb43895c1052cb0038506f1",
"reference": "90bc45abf02ae6b7deb43895c1052cb0038506f1",
"shasum": ""
},
"require": {
"php": "^5.5.9|>=7.0.8"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.3-dev"
}
},
"autoload": {
"psr-4": {
"Symfony\\Component\\Filesystem\\": ""
},
"exclude-from-classmap": [
"/Tests/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony Filesystem Component",
"homepage": "https://symfony.com",
"time": "2017-10-03T13:33:10+00:00"
},
{
"name": "symfony/stopwatch",
"version": "v3.3.10",
"source": {
"type": "git",
"url": "https://github.com/symfony/stopwatch.git",
"reference": "170edf8b3247d7b6779eb6fa7428f342702ca184"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/stopwatch/zipball/170edf8b3247d7b6779eb6fa7428f342702ca184",
"reference": "170edf8b3247d7b6779eb6fa7428f342702ca184",
"shasum": ""
},
"require": {
"php": "^5.5.9|>=7.0.8"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.3-dev"
}
},
"autoload": {
"psr-4": {
"Symfony\\Component\\Stopwatch\\": ""
},
"exclude-from-classmap": [
"/Tests/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony Stopwatch Component",
"homepage": "https://symfony.com",
"time": "2017-10-02T06:42:24+00:00"
},
{
"name": "symfony/yaml",
"version": "v3.3.10",
"source": {
"type": "git",
"url": "https://github.com/symfony/yaml.git",
"reference": "8c7bf1e7d5d6b05a690b715729cb4cd0c0a99c46"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/yaml/zipball/8c7bf1e7d5d6b05a690b715729cb4cd0c0a99c46",
"reference": "8c7bf1e7d5d6b05a690b715729cb4cd0c0a99c46",
"shasum": ""
},
"require": {
"php": "^5.5.9|>=7.0.8"
},
"require-dev": {
"symfony/console": "~2.8|~3.0"
},
"suggest": {
"symfony/console": "For validating YAML files using the lint command"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.3-dev"
}
},
"autoload": {
"psr-4": {
"Symfony\\Component\\Yaml\\": ""
},
"exclude-from-classmap": [
"/Tests/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony Yaml Component",
"homepage": "https://symfony.com",
"time": "2017-10-05T14:43:42+00:00"
},
{
"name": "webmozart/assert",
"version": "1.2.0",
"source": {
"type": "git",
"url": "https://github.com/webmozart/assert.git",
"reference": "2db61e59ff05fe5126d152bd0655c9ea113e550f"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/webmozart/assert/zipball/2db61e59ff05fe5126d152bd0655c9ea113e550f",
"reference": "2db61e59ff05fe5126d152bd0655c9ea113e550f",
"shasum": ""
},
"require": {
"php": "^5.3.3 || ^7.0"
},
"require-dev": {
"phpunit/phpunit": "^4.6",
"sebastian/version": "^1.0.1"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.3-dev"
}
},
"autoload": {
"psr-4": {
"Webmozart\\Assert\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Bernhard Schussek",
"email": "bschussek@gmail.com"
}
],
"description": "Assertions to validate method input/output with nice error messages.",
"keywords": [
"assert",
"check",
"validate"
],
"time": "2016-11-23T20:04:58+00:00"
}
],
"aliases": [],
"minimum-stability": "stable",
"stability-flags": [],
"prefer-stable": false,
"prefer-lowest": false,
"platform": {
"php": ">=5.4.0"
},
"platform-dev": [],
"platform-overrides": {
"php": "5.6"
}
}
PK p?Vƻ
.editorconfignu W+A # This file is for unifying the coding style for different editors and IDEs
# editorconfig.org
root = true
[*]
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
[**.php]
indent_style = space
indent_size = 4
PK p?V1 1 LICENSEnu W+A Copyright (c) 2016 Consolidation Org Developers
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
PK p?V9ཚ infection.json.distnu W+A {
"timeout": 10,
"source": {
"directories": [
"src"
]
},
"logs": {
"text": "infection-log.txt"
}
}PK p?V.܅ appveyor.ymlnu W+A build: false
shallow_clone: true
platform: 'x86'
clone_folder: C:\projects\annotated-commands
branches:
only:
- master
## Cache composer bits
cache:
- '%LOCALAPPDATA%\Composer\files -> composer.lock'
init:
#https://github.com/composer/composer/blob/master/appveyor.yml
#- SET ANSICON=121x90 (121x90)
# Inspired by https://github.com/Codeception/base/blob/master/appveyor.yml and https://github.com/phpmd/phpmd/blob/master/appveyor.yml
install:
- cinst -y curl
- SET PATH=C:\Program Files\curl;%PATH%
#which is only needed by the test suite.
- cinst -y which
- SET PATH=C:\Program Files\which;%PATH%
- git clone -q https://github.com/acquia/DevDesktopCommon.git #For tar, cksum, ...
- SET PATH=%APPVEYOR_BUILD_FOLDER%/DevDesktopCommon/bintools-win/msys/bin;%PATH%
- SET PATH=C:\Program Files\MySql\MySQL Server 5.7\bin\;%PATH%
#Install PHP per https://blog.wyrihaximus.net/2016/11/running-php-unit-tests-on-windows-using-appveyor-and-chocolatey/
- ps: appveyor-retry cinst --ignore-checksums -y php --version ((choco search php --exact --all-versions -r | select-string -pattern $Env:php_ver_target | Select-Object -first 1) -replace '[php|]','')
- cd c:\tools\php70
- copy php.ini-production php.ini
- echo extension_dir=ext >> php.ini
- echo extension=php_openssl.dll >> php.ini
- echo date.timezone="UTC" >> php.ini
- echo variables_order="EGPCS" >> php.ini #May be unneeded.
- echo mbstring.http_input=pass >> php.ini
- echo mbstring.http_output=pass >> php.ini
- echo sendmail_path=nul >> php.ini
- echo extension=php_mbstring.dll >> php.ini
- echo extension=php_curl.dll >> php.ini
- echo extension=php_pdo_mysql.dll >> php.ini
- echo extension=php_pdo_pgsql.dll >> php.ini
- echo extension=php_pdo_sqlite.dll >> php.ini
- echo extension=php_pgsql.dll >> php.ini
- echo extension=php_gd2.dll >> php.ini
- SET PATH=C:\tools\php70;%PATH%
#Install Composer
- cd %APPVEYOR_BUILD_FOLDER%
#- appveyor DownloadFile https://getcomposer.org/composer.phar
- php -r "readfile('http://getcomposer.org/installer');" | php
#Install dependencies via Composer
- php composer.phar -q install --prefer-dist -n
- SET PATH=%APPVEYOR_BUILD_FOLDER%;%APPVEYOR_BUILD_FOLDER%/vendor/bin;%PATH%
#Create a sandbox for testing. Don't think we need this.
- mkdir c:\test_temp
test_script:
- phpunit
- php composer.phar cs
# environment variables
environment:
global:
SHELL_INTERACTIVE: true
php_ver_target: 7.0
PK p?VѩS S CONTRIBUTING.mdnu W+A # Contributing to Consolidation
Thank you for your interest in contributing to the Consolidation effort! Consolidation aims to provide reusable, loosely-coupled components useful for building command-line tools. Consolidation is built on top of Symfony Console, but aims to separate the tool from the implementation details of Symfony.
Here are some of the guidelines you should follow to make the most of your efforts:
## Code Style Guidelines
Consolidation adheres to the [PSR-2 Coding Style Guide](http://www.php-fig.org/psr/psr-2/) for PHP code.
## Pull Request Guidelines
Every pull request is run through:
- phpcs -n --standard=PSR2 src
- phpunit
- [Scrutinizer](https://scrutinizer-ci.com/g/consolidation/annotated-command/)
It is easy to run the unit tests and code sniffer locally; just run:
- composer cs
To run the code beautifier, which will fix many of the problems reported by phpcs:
- composer cbf
These two commands (`composer cs` and `composer cbf`) are defined in the `scripts` section of [composer.json](composer.json).
After submitting a pull request, please examine the Scrutinizer report. It is not required to fix all Scrutinizer issues; you may ignore recommendations that you disagree with. The spacing patches produced by Scrutinizer do not conform to PSR2 standards, and therefore should never be applied. DocBlock patches may be applied at your discression. Things that Scrutinizer identifies as a bug nearly always need to be addressed.
Pull requests must pass phpcs and phpunit in order to be merged; ideally, new functionality will also include new unit tests.
PK p?VW' ' .travis.ymlnu W+A language: php
branches:
# Only test the master branch and SemVer tags.
only:
- master
- /^[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+.*$/
matrix:
include:
- php: 7.1
env: dependencies=highest
- php: 7.0
- php: 5.6
- php: 5.5
env: dependencies=lowest
- php: 5.4
env: dependencies=lowest
sudo: false
cache:
directories:
- $HOME/.composer/cache
before_script:
- if [ -z "$dependencies" ]; then composer install --prefer-dist; fi;
- if [ "$dependencies" = "lowest" ]; then composer update --prefer-dist --prefer-lowest -n; fi;
- if [ "$dependencies" = "highest" ]; then composer update --prefer-dist -n; fi;
script:
- vendor/bin/phpunit
- vendor/bin/phpcs --standard=PSR2 -n src
after_success:
- travis_retry php vendor/bin/coveralls -v
PK p?V#` .github/pull_request_template.mdnu W+A ### Disposition
This pull request:
- [ ] Fixes a bug
- [ ] Adds a feature
- [ ] Breaks backwards compatibility
- [ ] Has tests that cover changes
### Summary
Short overview of what changed.
### Description
Any additional information.
PK p?V .github/issue_template.mdnu W+A ### Steps to reproduce
What did you do?
### Expected behavior
Tell us what should happen
### Actual behavior
Tell us what happens instead
### System Configuration
Which O.S. and PHP version are you using?
PK p?V
composer.jsonnu W+A {
"name": "consolidation/annotated-command",
"description": "Initialize Symfony Console commands from annotated command class methods.",
"license": "MIT",
"authors": [
{
"name": "Greg Anderson",
"email": "greg.1.anderson@greenknowe.org"
}
],
"autoload":{
"psr-4":{
"Consolidation\\AnnotatedCommand\\": "src"
}
},
"autoload-dev": {
"psr-4": {
"Consolidation\\TestUtils\\": "tests/src"
}
},
"require": {
"php": ">=5.4.0",
"consolidation/output-formatters": "^3.1.12",
"psr/log": "^1",
"symfony/console": "^2.8|~3",
"symfony/event-dispatcher": "^2.5|^3",
"symfony/finder": "^2.5|^3"
},
"require-dev": {
"phpunit/phpunit": "^4.8",
"satooshi/php-coveralls": "^1.0",
"squizlabs/php_codesniffer": "^2.7"
},
"config": {
"optimize-autoloader": true,
"preferred-install": "dist",
"sort-packages": true,
"platform": {
"php": "5.6"
}
},
"scripts": {
"cs": "phpcs --standard=PSR2 -n src",
"cbf": "phpcbf --standard=PSR2 -n src",
"unit": "SHELL_INTERACTIVE=true phpunit --colors=always",
"test": [
"@unit",
"@cs"
]
},
"extra": {
"branch-alias": {
"dev-master": "2.x-dev"
}
}
}
PK p?Vp\/
CHANGELOG.mdnu W+A # Change Log
### 2.8.1
- Add hook methods to allow Symfony command events to be added directly to the hook manager, givig better control of hook order. (#131)
### 2.8.0
- Remove phpdocumentor/reflection-docblock in favor of using a bespoke parser (#130)
### 2.7.0
- Add support for options with a default value of 'true' (#119)
- BUGFIX: Improve handling of options with optional values, which previously was not working correctly. (#118)
### 2.6.1 - 18 Sep 2017
- Reverts to contents of the 2.4.13 release.
### 2.5.0 & 2.5.1 - 17 Sep 2017
- BACKED OUT. These releases accidentally introduced breaking changes.
### 2.4.13 - 28 Aug 2017
- Add a followLinks() method (#108)
### 2.4.12 - 24 Aug 2017
- BUGFIX: Allow annotated commands to directly use InputInterface and OutputInterface (#106)
### 2.4.11 - 27 July 2017
- Back out #102: do not change behavior of word wrap based on STDOUT redirection.
### 2.4.10 - 21 July 2017
- Add a method CommandProcessor::setPassExceptions() to allow applicationsto prevent the command processor from catching exceptions thrown by command methods and hooks. (#103)
### 2.4.9 - 20 Jul 2017
- Automatically disable wordwrap when the terminal is not connected to STDOUT (#102)
### 2.4.8 - 3 Apr 2017
- Allow multiple annotations with the same key. These are returned as a csv, or, alternately, can be accessed as an array via the new accessor.
- Unprotect two methods for benefit of Drush help. (#99)
- BUGFIX: Remove symfony/console pin (#100)
### 2.4.7 & 2.4.6 - 17 Mar 2017
- Avoid wrapping help text (#93)
- Pin symfony/console to version < 3.2.5 (#94)
- Add getExampleUsages() to AnnotatedCommand. (#92)
### 2.4.5 - 28 Feb 2017
- Ensure that placeholder entries are written into the commandfile cache. (#86)
### 2.4.4 - 27 Feb 2017
- BUGFIX: Avoid rewriting the command cache unless something has changed.
- BUGFIX: Ensure that the default value of options are correctly cached.
### 2.4.2 - 24 Feb 2017
- Add SimpleCacheInterface as a documentation interface (not enforced).
### 2.4.1 - 20 Feb 2017
- Support array options: multiple options on the commandline may be passed in to options array as an array of values.
- Add php 7.1 to the test matrix.
### 2.4.0 - 3 Feb 2017
- Automatically rebuild cached commandfile data when commandfile changes.
- Provide path to command file in AnnotationData objects.
- Bugfix: Add dynamic options when user runs '--help my:command' (previously, only 'help my:command' worked).
- Bugfix: Include description of last parameter in help (was omitted if no options present)
- Add Windows testing with Appveyor
### 2.3.0 - 19 Jan 2017
- Add a command info cache to improve performance of applications with many commands
- Bugfix: Allow trailing backslashes in namespaces in CommandFileDiscovery
- Bugfix: Rename @topic to @topics
### 2.2.0 - 23 November 2016
- Support custom events
- Add xml and json output for replacement help command. Text / html format for replacement help command not available yet.
### 2.1.0 - 14 November 2016
- Add support for output formatter wordwrapping
- Fix version requirement for output-formatters in composer.json
- Use output-formatters ~3
- Move php_codesniffer back to require-dev (moved to require by mistake)
### 2.0.0 - 30 September 2016
- **Breaking** Hooks with no command name now apply to all commands defined in the same class. This is a change of behavior from the 1.x branch, where hooks with no command name applied to a command with the same method name in a *different* class.
- **Breaking** The interfaces ValidatorInterface, ProcessResultInterface and AlterResultInterface have been updated to be passed a CommandData object, which contains an Input and Output object, plus the AnnotationData.
- **Breaking** The Symfony Command Event hook has been renamed to COMMAND_EVENT. There is a new COMMAND hook that behaves like the existing Drush command hook (i.e. the post-command event is called after the primary command method runs).
- Add an accessor function AnnotatedCommandFactory::setIncludeAllPublicMethods() to control whether all public methods of a command class, or only those with a @command annotation will be treated as commands. Default remains to treat all public methods as commands. The parameters to AnnotatedCommandFactory::createCommandsFromClass() and AnnotatedCommandFactory::createCommandsFromClassInfo() still behave the same way, but are deprecated. If omitted, the value set by the accessor will be used.
- @option and @usage annotations provided with @hook methods will be added to the help text of the command they hook. This should be done if a hook needs to add a new option, e.g. to control the behavior of the hook.
- @option annotations can now be either `@option type $name description`, or just `@option name description`.
- `@hook option` can be used to programatically add options to a command.
- A CommandInfoAltererInterface can be added via AnnotatedCommandFactory::addCommandInfoAlterer(); it will be given the opportunity to adjust every CommandInfo object parsed from a command file prior to the creation of commands.
- AnnotatedCommandFactory::setIncludeAllPublicMethods(false) may be used to require methods to be annotated with @commnad in order to be considered commands. This is in preference to the existing parameters of various command-creation methods of AnnotatedCommandFactory, which are now all deprecated in favor of this setter function.
- If a --field option is given, it will also force the output format to 'string'.
- Setter methods more consistently return $this.
- Removed PassThroughArgsInput. This class was unnecessary.
### 1.4.0 - 13 September 2016
- Add basic annotation hook capability, to allow hook functions to be attached to commands with arbitrary annotations.
### 1.3.0 - 8 September 2016
- Add ComandFileDiscovery::setSearchDepth(). The search depth applies to each search location, unless there are no search locations, in which case it applies to the base directory.
### 1.2.0 - 2 August 2016
- Support both the 2.x and 3.x versions of phpdocumentor/reflection-docblock.
- Support php 5.4.
- **Bug** Do not allow an @param docblock comment for the options to override the meaning of the options.
### 1.1.0 - 6 July 2016
- Introduce AnnotatedCommandFactory::createSelectedCommandsFromClassInfo() method.
### 1.0.0 - 20 May 2016
- First stable release.
PK p?VPS[ S[ tests/testFullStack.phpnu W+A application = new ApplicationWithTerminalWidth('TestApplication', '0.0.0');
$this->commandFactory = new AnnotatedCommandFactory();
$alterOptionsEventManager = new AlterOptionsCommandEvent($this->application);
$eventDispatcher = new \Symfony\Component\EventDispatcher\EventDispatcher();
$eventDispatcher->addSubscriber($this->commandFactory->commandProcessor()->hookManager());
$this->commandFactory->commandProcessor()->hookManager()->addCommandEvent($alterOptionsEventManager);
$this->application->setDispatcher($eventDispatcher);
$this->application->setAutoExit(false);
}
function testValidFormats()
{
$formatter = new FormatterManager();
$formatter->addDefaultFormatters();
$formatter->addDefaultSimplifiers();
$commandInfo = CommandInfo::create('\Consolidation\TestUtils\alpha\AlphaCommandFile', 'exampleTable');
$this->assertEquals('example:table', $commandInfo->getName());
$this->assertEquals('\Consolidation\OutputFormatters\StructuredData\RowsOfFields', $commandInfo->getReturnType());
}
function testAutomaticOptions()
{
$commandFileInstance = new \Consolidation\TestUtils\alpha\AlphaCommandFile;
$formatter = new FormatterManager();
$formatter->addDefaultFormatters();
$formatter->addDefaultSimplifiers();
$this->commandFactory->commandProcessor()->setFormatterManager($formatter);
$this->assertAutomaticOptionsForCommand($commandFileInstance, 'exampleTable', 'example:table');
$this->assertAutomaticOptionsForCommand($commandFileInstance, 'exampleTableTwo', 'example:table2');
}
function assertAutomaticOptionsForCommand($commandFileInstance, $functionName, $commandName)
{
$commandInfo = $this->commandFactory->createCommandInfo($commandFileInstance, $functionName);
$command = $this->commandFactory->createCommand($commandInfo, $commandFileInstance);
$this->application->add($command);
$containsList =
[
'--format[=FORMAT] Format the result data. Available formats: csv,json,list,php,print-r,sections,string,table,tsv,var_export,xml,yaml [default: "table"]',
'--fields[=FIELDS] Available fields: I (first), II (second), III (third) [default: ""]',
];
$this->assertRunCommandViaApplicationContains('help ' . $commandName, $containsList);
}
function testCommandsAndHooks()
{
// First, search for commandfiles in the 'alpha'
// directory. Note that this same functionality
// is tested more thoroughly in isolation in
// testCommandFileDiscovery.php
$discovery = new CommandFileDiscovery();
$discovery
->setSearchPattern('*CommandFile.php')
->setIncludeFilesAtBase(false)
->setSearchLocations(['alpha']);
chdir(__DIR__);
$commandFiles = $discovery->discover('.', '\Consolidation\TestUtils');
$formatter = new FormatterManager();
$formatter->addDefaultFormatters();
$formatter->addDefaultSimplifiers();
$hookManager = new HookManager();
$terminalWidthOption = new PrepareTerminalWidthOption();
$terminalWidthOption->enableWrap(true);
$terminalWidthOption->setApplication($this->application);
$testTerminal = new TestTerminal(0);
$terminalWidthOption->setTerminal($testTerminal);
$commandProcessor = new CommandProcessor($hookManager);
$commandProcessor->setFormatterManager($formatter);
$commandProcessor->addPrepareFormatter($terminalWidthOption);
// Create a new factory, and load all of the files
// discovered above.
$factory = new AnnotatedCommandFactory();
$factory->setCommandProcessor($commandProcessor);
// Add a listener to configure our command handler object
$factory->addListernerCallback(function($command) use($hookManager) {
if ($command instanceof CustomEventAwareInterface) {
$command->setHookManager($hookManager);
}
} );
$factory->setIncludeAllPublicMethods(false);
$this->addDiscoveredCommands($factory, $commandFiles);
$this->assertRunCommandViaApplicationContains('list', ['example:table'], ['additional:option', 'without:annotations']);
$this->assertTrue($this->application->has('example:table'));
$this->assertFalse($this->application->has('without:annotations'));
// Run the use:event command that defines a custom event, my-event.
$this->assertRunCommandViaApplicationEquals('use:event', 'one,two');
// Watch as we dynamically add a custom event to the hook manager to change the command results:
$hookManager->add(function () { return 'three'; }, HookManager::ON_EVENT, 'my-event');
$this->assertRunCommandViaApplicationEquals('use:event', 'one,three,two');
// Fetch a reference to the 'example:table' command and test its valid format types
$exampleTableCommand = $this->application->find('example:table');
$returnType = $exampleTableCommand->getReturnType();
$this->assertEquals('\Consolidation\OutputFormatters\StructuredData\RowsOfFields', $returnType);
$validFormats = $formatter->validFormats($returnType);
$this->assertEquals('csv,json,list,php,print-r,sections,string,table,tsv,var_export,xml,yaml', implode(',', $validFormats));
// Control: run commands without hooks.
$this->assertRunCommandViaApplicationEquals('always:fail', 'This command always fails.', 13);
$this->assertRunCommandViaApplicationEquals('simulated:status', '42');
$this->assertRunCommandViaApplicationEquals('example:output', 'Hello, World.');
$this->assertRunCommandViaApplicationEquals('example:cat bet alpha --flip', 'alphabet');
$this->assertRunCommandViaApplicationEquals('example:echo a b c', "a\tb\tc");
$this->assertRunCommandViaApplicationEquals('example:message', 'Shipwrecked; send bananas.');
$this->assertRunCommandViaApplicationEquals('command:with-one-optional-argument', 'Hello, world');
$this->assertRunCommandViaApplicationEquals('command:with-one-optional-argument Joe', 'Hello, Joe');
// Add some hooks.
$factory->hookManager()->addValidator(new ExampleValidator());
$factory->hookManager()->addResultProcessor(new ExampleResultProcessor());
$factory->hookManager()->addAlterResult(new ExampleResultAlterer());
$factory->hookManager()->addStatusDeterminer(new ExampleStatusDeterminer());
$factory->hookManager()->addOutputExtractor(new ExampleOutputExtractor());
// Run the same commands as before, and confirm that results
// are different now that the hooks are in place.
$this->assertRunCommandViaApplicationEquals('simulated:status', '', 42);
$this->assertRunCommandViaApplicationEquals('example:output', 'Hello, World!');
$this->assertRunCommandViaApplicationEquals('example:cat bet alpha --flip', 'alphareplaced');
$this->assertRunCommandViaApplicationEquals('example:echo a b c', 'a,b,c');
$this->assertRunCommandViaApplicationEquals('example:message', 'Shipwrecked; send bananas.');
$expected = <<assertRunCommandViaApplicationEquals('example:table', $expected);
$expected = <<assertRunCommandViaApplicationEquals('example:table --fields=III,II', $expected);
$expectedSingleField = <<assertRunCommandViaApplicationEquals('example:table --field=II', $expectedSingleField);
// Check the help for the example table command and see if the options
// from the alter hook were added. We expect that we should not see
// any of the information from the alter hook in the 'beta' folder yet.
$this->assertRunCommandViaApplicationContains('help example:table',
[
'Option added by @hook option example:table',
'example:table --french',
'Add a row with French numbers.'
],
[
'chinese',
'kanji',
]
);
$expectedOutputWithFrench = <<assertRunCommandViaApplicationEquals('example:table --french', $expectedOutputWithFrench);
$expectedAssociativeListTable = <<assertRunCommandViaApplicationEquals('example:list', $expectedAssociativeListTable);
$this->assertRunCommandViaApplicationEquals('example:list --field=sftp_command', 'sftp -o Port=2222 dev@appserver.dev.drush.in');
$this->assertRunCommandViaApplicationEquals('get:serious', 'very serious');
$this->assertRunCommandViaApplicationContains('get:lost', 'Command "get:lost" is not defined.', [], 1);
$this->assertRunCommandViaApplicationContains('help example:wrap',
[
'Test word wrapping',
'[default: "table"]',
]
);
$expectedUnwrappedOutput = <<application->setWidthAndHeight(0, 0);
$this->assertRunCommandViaApplicationEquals('example:wrap', $expectedUnwrappedOutput);
$expectedWrappedOutput = <<application->setWidthAndHeight(42, 24);
$testTerminal->setWidth(42);
$this->assertRunCommandViaApplicationEquals('example:wrap', $expectedWrappedOutput);
}
function testCommandsAndHooksIncludeAllPublicMethods()
{
// First, search for commandfiles in the 'alpha'
// directory. Note that this same functionality
// is tested more thoroughly in isolation in
// testCommandFileDiscovery.php
$discovery = new CommandFileDiscovery();
$discovery
->setSearchPattern('*CommandFile.php')
->setIncludeFilesAtBase(false)
->setSearchLocations(['alpha']);
chdir(__DIR__);
$commandFiles = $discovery->discover('.', '\Consolidation\TestUtils');
$formatter = new FormatterManager();
$formatter->addDefaultFormatters();
$formatter->addDefaultSimplifiers();
$hookManager = new HookManager();
$commandProcessor = new CommandProcessor($hookManager);
$commandProcessor->setFormatterManager($formatter);
// Create a new factory, and load all of the files
// discovered above. The command factory class is
// tested in isolation in testAnnotatedCommandFactory.php,
// but this is the only place where
$factory = new AnnotatedCommandFactory();
$factory->setCommandProcessor($commandProcessor);
// $factory->addListener(...);
// Now we will once again add all commands, this time including all
// public methods. The command 'withoutAnnotations' should now be found.
$factory->setIncludeAllPublicMethods(true);
$this->addDiscoveredCommands($factory, $commandFiles);
$this->assertTrue($this->application->has('without:annotations'));
$this->assertRunCommandViaApplicationContains('list', ['example:table', 'without:annotations'], ['alter:formatters']);
$this->assertRunCommandViaApplicationEquals('get:serious', 'very serious');
$this->assertRunCommandViaApplicationContains('get:lost', 'Command "get:lost" is not defined.', [], 1);
}
function testCommandsAndHooksWithBetaFolder()
{
// First, search for commandfiles in the 'alpha'
// directory. Note that this same functionality
// is tested more thoroughly in isolation in
// testCommandFileDiscovery.php
$discovery = new CommandFileDiscovery();
$discovery
->setSearchPattern('*CommandFile.php')
->setIncludeFilesAtBase(false)
->setSearchLocations(['alpha', 'beta']);
chdir(__DIR__);
$commandFiles = $discovery->discover('.', '\Consolidation\TestUtils');
$formatter = new FormatterManager();
$formatter->addDefaultFormatters();
$formatter->addDefaultSimplifiers();
$hookManager = new HookManager();
$commandProcessor = new CommandProcessor($hookManager);
$commandProcessor->setFormatterManager($formatter);
// Create a new factory, and load all of the files
// discovered above. The command factory class is
// tested in isolation in testAnnotatedCommandFactory.php,
// but this is the only place where
$factory = new AnnotatedCommandFactory();
$factory->setCommandProcessor($commandProcessor);
// $factory->addListener(...);
$factory->setIncludeAllPublicMethods(true);
$this->addDiscoveredCommands($factory, $commandFiles);
// A few asserts, to make sure that our hooks all get registered.
$allRegisteredHooks = $hookManager->getAllHooks();
$registeredHookNames = array_keys($allRegisteredHooks);
sort($registeredHookNames);
$this->assertEquals('*,example:table,my-event', implode(',', $registeredHookNames));
$allHooksForExampleTable = $allRegisteredHooks['example:table'];
$allHookPhasesForExampleTable = array_keys($allHooksForExampleTable);
sort($allHookPhasesForExampleTable);
$this->assertEquals('alter,option', implode(',', $allHookPhasesForExampleTable));
$this->assertContains('alterFormattersChinese', var_export($allHooksForExampleTable, true));
$alterHooksForExampleTable = $this->callProtected($hookManager, 'getHooks', [['example:table'], 'alter']);
$this->assertContains('alterFormattersKanji', var_export($alterHooksForExampleTable, true));
$allHooksForAnyCommand = $allRegisteredHooks['*'];
$allHookPhasesForAnyCommand = array_keys($allHooksForAnyCommand);
sort($allHookPhasesForAnyCommand);
$this->assertEquals('alter', implode(',', $allHookPhasesForAnyCommand));
$this->assertContains('alterFormattersKanji', var_export($allHooksForAnyCommand, true));
// Help should have the information from the hooks in the 'beta' folder
$this->assertRunCommandViaApplicationContains('help example:table',
[
'Option added by @hook option example:table',
'example:table --french',
'Add a row with French numbers.',
'chinese',
'kanji',
]
);
// Confirm that the "unavailable" command is now available
$this->assertTrue($this->application->has('unavailable:command'));
$expectedOutputWithChinese = <<assertRunCommandViaApplicationEquals('example:table --chinese', $expectedOutputWithChinese);
$expectedOutputWithKanji = <<assertRunCommandViaApplicationEquals('example:table --kanji', $expectedOutputWithKanji);
}
public function addDiscoveredCommands($factory, $commandFiles) {
foreach ($commandFiles as $path => $commandClass) {
$this->assertFileExists($path);
if (!class_exists($commandClass)) {
include $path;
}
$commandInstance = new $commandClass();
$commandList = $factory->createCommandsFromClass($commandInstance);
foreach ($commandList as $command) {
$this->application->add($command);
}
}
}
function assertRunCommandViaApplicationEquals($cmd, $expectedOutput, $expectedStatusCode = 0)
{
$input = new StringInput($cmd);
$output = new BufferedOutput();
$statusCode = $this->application->run($input, $output);
$commandOutput = trim($output->fetch());
$expectedOutput = $this->simplifyWhitespace($expectedOutput);
$commandOutput = $this->simplifyWhitespace($commandOutput);
$this->assertEquals($expectedOutput, $commandOutput);
$this->assertEquals($expectedStatusCode, $statusCode);
}
function assertRunCommandViaApplicationContains($cmd, $containsList, $doesNotContainList = [], $expectedStatusCode = 0)
{
$input = new StringInput($cmd);
$output = new BufferedOutput();
$containsList = (array) $containsList;
$statusCode = $this->application->run($input, $output);
$commandOutput = trim($output->fetch());
$commandOutput = $this->simplifyWhitespace($commandOutput);
foreach ($containsList as $expectedToContain) {
$this->assertContains($this->simplifyWhitespace($expectedToContain), $commandOutput);
}
foreach ($doesNotContainList as $expectedToNotContain) {
$this->assertNotContains($this->simplifyWhitespace($expectedToNotContain), $commandOutput);
}
$this->assertEquals($expectedStatusCode, $statusCode);
}
function simplifyWhitespace($data)
{
return trim(preg_replace('#\s+$#m', '', $data));
}
function callProtected($object, $method, $args = [])
{
$r = new \ReflectionMethod($object, $method);
$r->setAccessible(true);
return $r->invokeArgs($object, $args);
}
}
class ExampleValidator implements ValidatorInterface
{
public function validate(CommandData $commandData)
{
$args = $commandData->arguments();
if (isset($args['one']) && ($args['one'] == 'bet')) {
$commandData->input()->setArgument('one', 'replaced');
return $args;
}
}
}
class ExampleResultProcessor implements ProcessResultInterface
{
public function process($result, CommandData $commandData)
{
if (is_array($result) && array_key_exists('item-list', $result)) {
return implode(',', $result['item-list']);
}
}
}
class ExampleResultAlterer implements AlterResultInterface
{
public function process($result, CommandData $commandData)
{
if (is_string($result) && ($result == 'Hello, World.')) {
return 'Hello, World!';
}
}
}
class ExampleStatusDeterminer implements StatusDeterminerInterface
{
public function determineStatusCode($result)
{
if (is_array($result) && array_key_exists('status-code', $result)) {
return $result['status-code'];
}
}
}
class ExampleOutputExtractor implements ExtractOutputInterface
{
public function extractOutput($result)
{
if (is_array($result) && array_key_exists('message', $result)) {
return $result['message'];
}
}
}
PK p?VD4 % tests/testAnnotatedCommandFactory.phpnu W+A commandFileInstance = new \Consolidation\TestUtils\ExampleCommandFile;
$this->commandFactory = new AnnotatedCommandFactory();
$commandInfo = $this->commandFactory->createCommandInfo($this->commandFileInstance, 'fibonacci');
$command = $this->commandFactory->createCommand($commandInfo, $this->commandFileInstance);
$this->assertEquals('fibonacci', $command->getName());
$this->assertEquals('fibonacci [--graphic] [--] ', $command->getSynopsis());
$this->assertEquals('Calculate the fibonacci sequence between two numbers.', $command->getDescription());
$this->assertEquals("Graphic output will look like
+----+---+-------------+
| | | |
| |-+-| |
|----+-+-+ |
| | |
| | |
| | |
+--------+-------------+", $command->getHelp());
$this->assertInstanceOf('\Symfony\Component\Console\Command\Command', $command);
$input = new StringInput('help fibonacci');
$this->assertRunCommandViaApplicationContains($command, $input, ['Display the sequence graphically using cube representation']);
}
function testSniff()
{
$this->commandFileInstance = new \Consolidation\TestUtils\ExampleCommandFile;
$this->commandFactory = new AnnotatedCommandFactory();
$commandInfo = $this->commandFactory->createCommandInfo($this->commandFileInstance, 'sniff');
$command = $this->commandFactory->createCommand($commandInfo, $this->commandFileInstance);
$this->assertEquals('sniff', $command->getName());
$this->assertEquals('sniff [--autofix] [--strict] [--] []', $command->getSynopsis());
$this->assertInstanceOf('\Symfony\Component\Console\Command\Command', $command);
$input = new StringInput('help sniff');
$this->assertRunCommandViaApplicationContains($command, $input, ['A file or directory to analyze.']);
$input = new StringInput('sniff --autofix --strict -- foo');
$this->assertRunCommandViaApplicationContains($command, $input, ["'autofix' => true",
"'strict' => true"]);
}
function testOptionDefaultValue()
{
$this->commandFileInstance = new \Consolidation\TestUtils\ExampleCommandFile;
$this->commandFactory = new AnnotatedCommandFactory();
$commandInfo = $this->commandFactory->createCommandInfo($this->commandFileInstance, 'defaultOptionOne');
$command = $this->commandFactory->createCommand($commandInfo, $this->commandFileInstance);
$this->assertEquals('default:option-one', $command->getName());
$this->assertEquals('default:option-one [--foo [FOO]]', $command->getSynopsis());
$this->assertInstanceOf('\Symfony\Component\Console\Command\Command', $command);
$input = new StringInput('default:option-one');
$this->assertRunCommandViaApplicationEquals($command, $input, 'Foo is 1');
$commandInfo = $this->commandFactory->createCommandInfo($this->commandFileInstance, 'defaultOptionTwo');
$command = $this->commandFactory->createCommand($commandInfo, $this->commandFileInstance);
$command = $this->commandFactory->createCommand($commandInfo, $this->commandFileInstance);
$this->assertEquals('default:option-two', $command->getName());
$this->assertEquals('default:option-two [--foo [FOO]]', $command->getSynopsis());
$input = new StringInput('default:option-two');
$this->assertRunCommandViaApplicationEquals($command, $input, 'Foo is 2');
$commandInfo = $this->commandFactory->createCommandInfo($this->commandFileInstance, 'defaultOptionNone');
$command = $this->commandFactory->createCommand($commandInfo, $this->commandFileInstance);
$command = $this->commandFactory->createCommand($commandInfo, $this->commandFileInstance);
$this->assertEquals('default:option-none', $command->getName());
$this->assertEquals('default:option-none [--foo FOO]', $command->getSynopsis());
// Skip failing test until Symfony is fixed.
$this->markTestSkipped('Symfony Console 3.2.5 and 3.2.6 do not handle default options with required values correctly.');
$input = new StringInput('default:option-none --foo');
$this->assertRunCommandViaApplicationContains($command, $input, ['The "--foo" option requires a value.'], 1);
}
function testGlobalOptionsOnly()
{
$this->commandFileInstance = new \Consolidation\TestUtils\ExampleCommandFile;
$this->commandFactory = new AnnotatedCommandFactory();
$commandInfo = $this->commandFactory->createCommandInfo($this->commandFileInstance, 'globalOptionsOnly');
$command = $this->commandFactory->createCommand($commandInfo, $this->commandFileInstance);
$input = new StringInput('global-options-only test');
$this->assertRunCommandViaApplicationEquals($command, $input, "Arg is test, options[help] is false");
}
function testOptionWithOptionalValue()
{
$this->commandFileInstance = new \Consolidation\TestUtils\ExampleCommandFile;
$this->commandFactory = new AnnotatedCommandFactory();
$commandInfo = $this->commandFactory->createCommandInfo($this->commandFileInstance, 'defaultOptionalValue');
$command = $this->commandFactory->createCommand($commandInfo, $this->commandFileInstance);
// Test to see if we can differentiate between a missing option, and
// an option that has no value at all.
$input = new StringInput('default:optional-value --foo=bar');
$this->assertRunCommandViaApplicationEquals($command, $input, "Foo is 'bar'");
$input = new StringInput('default:optional-value --foo');
$this->assertRunCommandViaApplicationEquals($command, $input, 'Foo is true');
$input = new StringInput('default:optional-value');
$this->assertRunCommandViaApplicationEquals($command, $input, 'Foo is NULL');
}
function testOptionThatDefaultsToTrue()
{
$this->commandFileInstance = new \Consolidation\TestUtils\ExampleCommandFile;
$this->commandFactory = new AnnotatedCommandFactory();
$commandInfo = $this->commandFactory->createCommandInfo($this->commandFileInstance, 'defaultOptionDefaultsToTrue');
$command = $this->commandFactory->createCommand($commandInfo, $this->commandFileInstance);
// Test to see if we can differentiate between a missing option, and
// an option that has no value at all.
$input = new StringInput('default:option-defaults-to-true --foo=bar');
$this->assertRunCommandViaApplicationEquals($command, $input, "Foo is 'bar'");
$input = new StringInput('default:option-defaults-to-true --foo');
$this->assertRunCommandViaApplicationEquals($command, $input, 'Foo is true');
$input = new StringInput('default:option-defaults-to-true');
$this->assertRunCommandViaApplicationEquals($command, $input, 'Foo is true');
$input = new StringInput('help default:option-defaults-to-true');
$this->assertRunCommandViaApplicationContains(
$command,
$input,
[
'--no-foo',
'Negate --foo option',
]
);
$input = new StringInput('default:option-defaults-to-true --no-foo');
$this->assertRunCommandViaApplicationEquals($command, $input, 'Foo is false');
}
/**
* Test CommandInfo command caching.
*
* Sequence:
* - Create all of the command info objects from one class, caching them.
* - Change the method name of one of the items in the cache to a non-existent method
* - Restore all of the cached commandinfo objects
* - Ensure that the non-existent method cached commandinfo was not created
* - Ensure that the now-missing cached commandinfo was still created
*
* This tests both save/restore, plus adding a new command method to
* a class, and removing a command method from a class.
*/
function testAnnotatedCommandCache()
{
$testCacheStore = new \Consolidation\TestUtils\InMemoryCacheStore();
$this->commandFileInstance = new \Consolidation\TestUtils\ExampleCommandFile;
$this->commandFactory = new AnnotatedCommandFactory();
$this->commandFactory->setDataStore($testCacheStore);
// Make commandInfo objects for every command in the test commandfile.
// These will also be stored in our cache.
$commandInfoList = $this->commandFactory->getCommandInfoListFromClass($this->commandFileInstance);
$cachedClassName = get_class($this->commandFileInstance);
$this->assertTrue($testCacheStore->has($cachedClassName));
$cachedData = $testCacheStore->get($cachedClassName);
$this->assertFalse(empty($cachedData));
$this->assertTrue(array_key_exists('testArithmatic', $cachedData));
$alterCommandInfoCache = $cachedData['testArithmatic'];
unset($cachedData['testArithmatic']);
$alterCommandInfoCache['method_name'] = 'nonExistentMethod';
$cachedData[$alterCommandInfoCache['method_name']] = $alterCommandInfoCache;
$testCacheStore->set($cachedClassName, $cachedData);
$restoredCommandInfoList = $this->commandFactory->getCommandInfoListFromClass($this->commandFileInstance);
$rebuiltCachedData = $testCacheStore->get($cachedClassName);
$this->assertFalse(empty($rebuiltCachedData));
$this->assertTrue(array_key_exists('testArithmatic', $rebuiltCachedData));
$this->assertFalse(array_key_exists('nonExistentMethod', $rebuiltCachedData));
}
/**
* Test CommandInfo command annotation parsing.
*/
function testAnnotatedCommandCreation()
{
$this->commandFileInstance = new \Consolidation\TestUtils\ExampleCommandFile;
$this->commandFactory = new AnnotatedCommandFactory();
$commandInfo = $this->commandFactory->createCommandInfo($this->commandFileInstance, 'testArithmatic');
$command = $this->commandFactory->createCommand($commandInfo, $this->commandFileInstance);
$this->assertInstanceOf('\Symfony\Component\Console\Command\Command', $command);
$this->assertEquals('test:arithmatic', $command->getName());
$this->assertEquals('This is the test:arithmatic command', $command->getDescription());
$this->assertEquals("This command will add one and two. If the --negate flag\nis provided, then the result is negated.", $command->getHelp());
$this->assertEquals('arithmatic', implode(',', $command->getAliases()));
$this->assertEquals('test:arithmatic [--negate] [--unused [UNUSED]] [--] []', $command->getSynopsis());
$this->assertEquals('test:arithmatic 2 2 --negate', implode(',', $command->getUsages()));
$input = new StringInput('arithmatic 2 3 --negate');
$this->assertRunCommandViaApplicationEquals($command, $input, '-5');
}
/**
* Test CommandInfo command annotation altering.
*/
function testAnnotatedCommandInfoAlteration()
{
$this->commandFileInstance = new \Consolidation\TestUtils\ExampleCommandFile;
$this->commandFactory = new AnnotatedCommandFactory();
$commandInfo = $this->commandFactory->createCommandInfo($this->commandFileInstance, 'myCat');
$command = $this->commandFactory->createCommand($commandInfo, $this->commandFileInstance);
$annotationData = $command->getAnnotationData();
$this->assertTrue($annotationData->has('arbitrary'));
$this->assertFalse($annotationData->has('dynamic'));
$this->commandFactory->addCommandInfoAlterer(new ExampleCommandInfoAlterer());
$command = $this->commandFactory->createCommand($commandInfo, $this->commandFileInstance);
$annotationData = $command->getAnnotationData();
$this->assertTrue($annotationData->has('arbitrary'));
$this->assertTrue($annotationData->has('dynamic'));
}
function testMyCatCommand()
{
$this->commandFileInstance = new \Consolidation\TestUtils\ExampleCommandFile;
$this->commandFactory = new AnnotatedCommandFactory();
$commandInfo = $this->commandFactory->createCommandInfo($this->commandFileInstance, 'myCat');
$command = $this->commandFactory->createCommand($commandInfo, $this->commandFileInstance);
$this->assertInstanceOf('\Symfony\Component\Console\Command\Command', $command);
$this->assertEquals('my:cat', $command->getName());
$this->assertEquals('This is the my:cat command', $command->getDescription());
$this->assertEquals("This command will concatenate two parameters. If the --flip flag\nis provided, then the result is the concatenation of two and one.", $command->getHelp());
$this->assertEquals('c', implode(',', $command->getAliases()));
$this->assertEquals('my:cat [--flip] [--] []', $command->getSynopsis());
$this->assertEquals('my:cat bet alpha --flip', implode(',', $command->getUsages()));
$input = new StringInput('my:cat bet alpha --flip');
$this->assertRunCommandViaApplicationEquals($command, $input, 'alphabet');
}
function testJoinCommandHelp()
{
$this->commandFileInstance = new \Consolidation\TestUtils\ExampleCommandFile;
$this->commandFactory = new AnnotatedCommandFactory();
$commandInfo = $this->commandFactory->createCommandInfo($this->commandFileInstance, 'myJoin');
$command = $this->commandFactory->createCommand($commandInfo, $this->commandFileInstance);
$this->assertInstanceOf('\Symfony\Component\Console\Command\Command', $command);
$this->assertEquals('my:join', $command->getName());
$this->assertEquals('This is the my:join command', $command->getDescription());
$this->assertEquals("This command will join its parameters together. It can also reverse and repeat its arguments.", $command->getHelp());
$this->assertEquals('my:join [--flip] [--repeat [REPEAT]] [--] []...', $command->getSynopsis());
// TODO: Extra whitespace character if there are no options et. al. in the
// usage. This is uncommon, and the defect is invisible. Maybe find it someday.
$actualUsages = implode(',', $command->getUsages());
$this->assertEquals('my:join a b,my:join ', $actualUsages);
$input = new StringInput('my:join bet alpha --flip --repeat=2');
$this->assertRunCommandViaApplicationEquals($command, $input, 'alphabetalphabet');
}
function testDefaultsCommand()
{
$this->commandFileInstance = new \Consolidation\TestUtils\ExampleCommandFile;
$this->commandFactory = new AnnotatedCommandFactory();
$commandInfo = $this->commandFactory->createCommandInfo($this->commandFileInstance, 'defaults');
$command = $this->commandFactory->createCommand($commandInfo, $this->commandFileInstance);
$this->assertInstanceOf('\Symfony\Component\Console\Command\Command', $command);
$this->assertEquals('defaults', $command->getName());
$this->assertEquals('Test default values in arguments', $command->getDescription());
$input = new StringInput('defaults');
$this->assertRunCommandViaApplicationEquals($command, $input, 'nothing provided');
$input = new StringInput('defaults ichi');
$this->assertRunCommandViaApplicationEquals($command, $input, 'only ichi');
$input = new StringInput('defaults I II');
$this->assertRunCommandViaApplicationEquals($command, $input, 'I and II');
}
function testCommandWithNoOptions()
{
$this->commandFileInstance = new \Consolidation\TestUtils\ExampleCommandFile;
$this->commandFactory = new AnnotatedCommandFactory();
$commandInfo = $this->commandFactory->createCommandInfo($this->commandFileInstance, 'commandWithNoOptions');
$command = $this->commandFactory->createCommand($commandInfo, $this->commandFileInstance);
$this->assertInstanceOf('\Symfony\Component\Console\Command\Command', $command);
$this->assertEquals('command:with-no-options', $command->getName());
$this->assertEquals('This is a command with no options', $command->getDescription());
$this->assertEquals("This command will concatenate two parameters.", $command->getHelp());
$this->assertEquals('nope', implode(',', $command->getAliases()));
$this->assertEquals('command:with-no-options []', $command->getSynopsis());
$this->assertEquals('command:with-no-options alpha bet', implode(',', $command->getUsages()));
$input = new StringInput('command:with-no-options something');
$this->assertRunCommandViaApplicationEquals($command, $input, 'somethingdefault');
$input = new StringInput('help command:with-no-options something');
$this->assertRunCommandViaApplicationContains(
$command,
$input,
[
'The first parameter.',
'The other parameter.',
]
);
}
function testCommandWithIOParameters()
{
$this->commandFileInstance = new \Consolidation\TestUtils\ExampleCommandFile;
$this->commandFactory = new AnnotatedCommandFactory();
$commandInfo = $this->commandFactory->createCommandInfo($this->commandFileInstance, 'commandWithIOParameters');
$command = $this->commandFactory->createCommand($commandInfo, $this->commandFileInstance);
$this->assertInstanceOf('\Symfony\Component\Console\Command\Command', $command);
$this->assertEquals('command:with-io-parameters', $command->getName());
$this->assertEquals("This command work with app's input and output", $command->getDescription());
$this->assertEquals('', $command->getHelp());
$this->assertEquals('command:with-io-parameters', $command->getSynopsis());
$input = new StringInput('command:with-io-parameters');
$this->assertRunCommandViaApplicationEquals($command, $input, 'command:with-io-parameters');
}
function testCommandWithNoArguments()
{
$this->commandFileInstance = new \Consolidation\TestUtils\ExampleCommandFile;
$this->commandFactory = new AnnotatedCommandFactory();
$commandInfo = $this->commandFactory->createCommandInfo($this->commandFileInstance, 'commandWithNoArguments');
$command = $this->commandFactory->createCommand($commandInfo, $this->commandFileInstance);
$this->assertInstanceOf('\Symfony\Component\Console\Command\Command', $command);
$this->assertEquals('command:with-no-arguments', $command->getName());
$this->assertEquals('This command has no arguments--only options', $command->getDescription());
$this->assertEquals("Return a result only if not silent.", $command->getHelp());
$this->assertEquals('command:with-no-arguments [-s|--silent]', $command->getSynopsis());
$input = new StringInput('command:with-no-arguments');
$this->assertRunCommandViaApplicationEquals($command, $input, 'Hello, world');
$input = new StringInput('command:with-no-arguments -s');
$this->assertRunCommandViaApplicationEquals($command, $input, '');
$input = new StringInput('command:with-no-arguments --silent');
$this->assertRunCommandViaApplicationEquals($command, $input, '');
}
function testCommandWithShortcutOnAnnotation()
{
$this->commandFileInstance = new \Consolidation\TestUtils\ExampleCommandFile;
$this->commandFactory = new AnnotatedCommandFactory();
$commandInfo = $this->commandFactory->createCommandInfo($this->commandFileInstance, 'shortcutOnAnnotation');
$command = $this->commandFactory->createCommand($commandInfo, $this->commandFileInstance);
$this->assertInstanceOf('\Symfony\Component\Console\Command\Command', $command);
$this->assertEquals('shortcut:on-annotation', $command->getName());
$this->assertEquals('Shortcut on annotation', $command->getDescription());
$this->assertEquals("This command defines the option shortcut on the annotation instead of in the options array.", $command->getHelp());
$this->assertEquals('shortcut:on-annotation [-s|--silent]', $command->getSynopsis());
$input = new StringInput('shortcut:on-annotation');
$this->assertRunCommandViaApplicationEquals($command, $input, 'Hello, world');
$input = new StringInput('shortcut:on-annotation -s');
$this->assertRunCommandViaApplicationEquals($command, $input, '');
$input = new StringInput('shortcut:on-annotation --silent');
$this->assertRunCommandViaApplicationEquals($command, $input, '');
}
function testState()
{
$this->commandFileInstance = new \Consolidation\TestUtils\ExampleCommandFile('secret secret');
$this->commandFactory = new AnnotatedCommandFactory();
$commandInfo = $this->commandFactory->createCommandInfo($this->commandFileInstance, 'testState');
$command = $this->commandFactory->createCommand($commandInfo, $this->commandFileInstance);
$this->assertInstanceOf('\Symfony\Component\Console\Command\Command', $command);
$this->assertEquals('test:state', $command->getName());
$input = new StringInput('test:state');
$this->assertRunCommandViaApplicationEquals($command, $input, 'secret secret');
}
function testPassthroughArray()
{
$this->commandFileInstance = new \Consolidation\TestUtils\ExampleCommandFile;
$this->commandFactory = new AnnotatedCommandFactory();
$commandInfo = $this->commandFactory->createCommandInfo($this->commandFileInstance, 'testPassthrough');
$command = $this->commandFactory->createCommand($commandInfo, $this->commandFileInstance);
$this->assertInstanceOf('\Symfony\Component\Console\Command\Command', $command);
$this->assertEquals('test:passthrough', $command->getName());
$input = new StringInput('test:passthrough a b c -- x y z');
$this->assertRunCommandViaApplicationEquals($command, $input, 'a,b,c,x,y,z');
}
function testPassThroughNonArray()
{
$this->commandFileInstance = new \Consolidation\TestUtils\ExampleCommandFile;
$this->commandFactory = new AnnotatedCommandFactory();
$commandInfo = $this->commandFactory->createCommandInfo($this->commandFileInstance, 'myJoin');
$command = $this->commandFactory->createCommand($commandInfo, $this->commandFileInstance);
$input = new StringInput('my:join bet --flip -- x y z');
$this->assertRunCommandViaApplicationEquals($command, $input, 'zyxbet');
// Can't look at 'hasOption' until after the command initializes the
// option, because Symfony.
$this->assertTrue($input->hasOption('flip'));
}
function testPassThroughWithInputManipulation()
{
$this->commandFileInstance = new \Consolidation\TestUtils\ExampleCommandFile;
$this->commandFactory = new AnnotatedCommandFactory();
$commandInfo = $this->commandFactory->createCommandInfo($this->commandFileInstance, 'myJoin');
$command = $this->commandFactory->createCommand($commandInfo, $this->commandFileInstance);
$input = new StringInput('my:join bet --repeat=2 -- x y z');
$this->assertRunCommandViaApplicationEquals($command, $input, 'betxyzbetxyz');
// Symfony does not allow us to manipulate the options via setOption until
// the definition from the command object has been set up.
$input->setOption('repeat', 3);
$this->assertEquals(3, $input->getOption('repeat'));
$input->setArgument(0, 'q');
// Manipulating $input does not work -- the changes are not effective.
// The end result here should be 'qx y yqx y yqx y y'
$this->assertRunCommandViaApplicationEquals($command, $input, 'betxyzbetxyz');
}
function testRequiredArrayOption()
{
$this->commandFileInstance = new \Consolidation\TestUtils\ExampleCommandFile;
$this->commandFactory = new AnnotatedCommandFactory();
$commandInfo = $this->commandFactory->createCommandInfo($this->commandFileInstance, 'testRequiredArrayOption');
$command = $this->commandFactory->createCommand($commandInfo, $this->commandFileInstance);
$this->assertEquals('test:required-array-option [-a|--arr ARR]', $command->getSynopsis());
$input = new StringInput('test:required-array-option --arr=1 --arr=2 --arr=3');
$this->assertRunCommandViaApplicationEquals($command, $input, '1 2 3');
$input = new StringInput('test:required-array-option -a 1 -a 2 -a 3');
$this->assertRunCommandViaApplicationEquals($command, $input, '1 2 3');
}
function testArrayOption()
{
$this->commandFileInstance = new \Consolidation\TestUtils\ExampleCommandFile;
$this->commandFactory = new AnnotatedCommandFactory();
$commandInfo = $this->commandFactory->createCommandInfo($this->commandFileInstance, 'testArrayOption');
$command = $this->commandFactory->createCommand($commandInfo, $this->commandFileInstance);
$this->assertEquals('test:array-option [-a|--arr [ARR]]', $command->getSynopsis());
$input = new StringInput('test:array-option');
$this->assertRunCommandViaApplicationEquals($command, $input, '1 2 3');
$input = new StringInput('test:array-option --arr=a --arr=b --arr=c');
$this->assertRunCommandViaApplicationEquals($command, $input, 'a b c');
$input = new StringInput('test:array-option -a a');
$this->assertRunCommandViaApplicationEquals($command, $input, 'a');
}
function testHookedCommand()
{
$this->commandFileInstance = new \Consolidation\TestUtils\ExampleCommandFile();
$this->commandFactory = new AnnotatedCommandFactory();
$hookInfo = $this->commandFactory->createCommandInfo($this->commandFileInstance, 'hookTestHook');
$this->assertTrue($hookInfo->hasAnnotation('hook'));
$this->assertEquals('alter test:hook', $hookInfo->getAnnotation('hook'));
$this->commandFactory->registerCommandHook($hookInfo, $this->commandFileInstance);
$hookCallback = $this->commandFactory->hookManager()->get('test:hook', [HookManager::ALTER_RESULT]);
$this->assertTrue($hookCallback != null);
$this->assertEquals(1, count($hookCallback));
$this->assertEquals(2, count($hookCallback[0]));
$this->assertTrue(is_callable($hookCallback[0]));
$this->assertEquals('hookTestHook', $hookCallback[0][1]);
$commandInfo = $this->commandFactory->createCommandInfo($this->commandFileInstance, 'testHook');
$command = $this->commandFactory->createCommand($commandInfo, $this->commandFileInstance);
$this->assertInstanceOf('\Symfony\Component\Console\Command\Command', $command);
$this->assertEquals('test:hook', $command->getName());
$input = new StringInput('test:hook bar');
$this->assertRunCommandViaApplicationEquals($command, $input, '<[bar]>');
$input = new StringInput('list --raw');
$this->assertRunCommandViaApplicationContains($command, $input, ['This command wraps its parameter in []; its alter hook then wraps the result in .']);
}
function testReplaceCommandHook(){
$this->commandFileInstance = new \Consolidation\TestUtils\ExampleCommandFile();
$this->commandFactory = new AnnotatedCommandFactory();
$hookInfo = $this->commandFactory->createCommandInfo($this->commandFileInstance, 'hookTestReplaceCommandHook');
$this->assertTrue($hookInfo->hasAnnotation('hook'));
$this->assertEquals('replace-command test:replace-command', $hookInfo->getAnnotation('hook'));
$this->commandFactory->registerCommandHook($hookInfo, $this->commandFileInstance);
$hookCallback = $this->commandFactory->hookManager()->get('test:replace-command', [HookManager::REPLACE_COMMAND_HOOK]);
$this->assertTrue($hookCallback != null);
$this->assertEquals(1, count($hookCallback));
$this->assertEquals(2, count($hookCallback[0]));
$this->assertTrue(is_callable($hookCallback[0]));
$this->assertEquals('hookTestReplaceCommandHook', $hookCallback[0][1]);
$input = new StringInput('test:replace-command foo');
$commandInfo = $this->commandFactory->createCommandInfo($this->commandFileInstance, 'testReplaceCommand');
$command = $this->commandFactory->createCommand($commandInfo, $this->commandFileInstance);
$this->assertRunCommandViaApplicationEquals($command, $input, "bar", 0);
}
function testPostCommandCalledAfterCommand()
{
$this->commandFileInstance = new \Consolidation\TestUtils\ExampleCommandFile();
$this->commandFactory = new AnnotatedCommandFactory();
$hookInfo = $this->commandFactory->createCommandInfo($this->commandFileInstance, 'hookTestPostCommandHook');
$this->assertTrue($hookInfo->hasAnnotation('hook'));
$this->assertEquals('post-command test:post-command', $hookInfo->getAnnotation('hook'));
$this->commandFactory->registerCommandHook($hookInfo, $this->commandFileInstance);
$hookCallback = $this->commandFactory->hookManager()->get('test:post-command', [HookManager::POST_COMMAND_HOOK]);
$this->assertTrue($hookCallback != null);
$this->assertEquals(1, count($hookCallback));
$this->assertEquals(2, count($hookCallback[0]));
$this->assertTrue(is_callable($hookCallback[0]));
$this->assertEquals('hookTestPostCommandHook', $hookCallback[0][1]);
$hookInfo = $this->commandFactory->createCommandInfo($this->commandFileInstance, 'hookTestPreCommandHook');
$this->assertTrue($hookInfo->hasAnnotation('hook'));
$this->assertEquals('pre-command test:post-command', $hookInfo->getAnnotation('hook'));
$this->commandFactory->registerCommandHook($hookInfo, $this->commandFileInstance);
$hookCallback = $this->commandFactory->hookManager()->get('test:post-command', [HookManager::PRE_COMMAND_HOOK]);
$this->assertTrue($hookCallback != null);
$this->assertEquals(1, count($hookCallback));
$this->assertEquals(2, count($hookCallback[0]));
$this->assertTrue(is_callable($hookCallback[0]));
$this->assertEquals('hookTestPreCommandHook', $hookCallback[0][1]);
$commandInfo = $this->commandFactory->createCommandInfo($this->commandFileInstance, 'testPostCommand');
$command = $this->commandFactory->createCommand($commandInfo, $this->commandFileInstance);
$this->assertInstanceOf('\Symfony\Component\Console\Command\Command', $command);
$this->assertEquals('test:post-command', $command->getName());
$input = new StringInput('test:post-command bar');
$this->assertRunCommandViaApplicationEquals($command, $input, "foo\nbar\nbaz", 0, $this->commandFileInstance);
}
function testHookAllCommands()
{
$this->commandFileInstance = new \Consolidation\TestUtils\ExampleHookAllCommandFile();
$this->commandFactory = new AnnotatedCommandFactory();
$hookInfo = $this->commandFactory->createCommandInfo($this->commandFileInstance, 'alterAllCommands');
$this->assertTrue($hookInfo->hasAnnotation('hook'));
$this->assertEquals('alter', $hookInfo->getAnnotation('hook'));
$this->commandFactory->registerCommandHook($hookInfo, $this->commandFileInstance);
$hookCallback = $this->commandFactory->hookManager()->get('Consolidation\TestUtils\ExampleHookAllCommandFile', [HookManager::ALTER_RESULT]);
$this->assertTrue($hookCallback != null);
$this->assertEquals(1, count($hookCallback));
$this->assertEquals(2, count($hookCallback[0]));
$this->assertTrue(is_callable($hookCallback[0]));
$this->assertEquals('alterAllCommands', $hookCallback[0][1]);
$commandInfo = $this->commandFactory->createCommandInfo($this->commandFileInstance, 'doCat');
$command = $this->commandFactory->createCommand($commandInfo, $this->commandFileInstance);
$this->assertInstanceOf('\Symfony\Component\Console\Command\Command', $command);
$this->assertEquals('do:cat', $command->getName());
$input = new StringInput('do:cat bar');
$this->assertRunCommandViaApplicationEquals($command, $input, '*** bar ***');
}
function testDoubleDashWithVersion()
{
$this->commandFileInstance = new \Consolidation\TestUtils\ExampleHookAllCommandFile();
$this->commandFactory = new AnnotatedCommandFactory();
$commandInfo = $this->commandFactory->createCommandInfo($this->commandFileInstance, 'doCat');
$command = $this->commandFactory->createCommand($commandInfo, $this->commandFileInstance);
$input = new ArgvInput(['placeholder', 'do:cat', 'one', '--', '--version']);
list($statusCode, $commandOutput) = $this->runCommandViaApplication($command, $input);
if ($commandOutput == 'TestApplication version 0.0.0') {
$this->markTestSkipped('Symfony/Console 2.x does not respect -- with --version');
}
$this->assertEquals('one--version', $commandOutput);
}
function testAnnotatedHookedCommand()
{
$this->commandFileInstance = new \Consolidation\TestUtils\ExampleCommandFile();
$this->commandFactory = new AnnotatedCommandFactory();
$hookInfo = $this->commandFactory->createCommandInfo($this->commandFileInstance, 'hookTestAnnotatedHook');
$this->assertTrue($hookInfo->hasAnnotation('hook'));
$this->assertEquals('alter @hookme', $hookInfo->getAnnotation('hook'));
$this->commandFactory->registerCommandHook($hookInfo, $this->commandFileInstance);
$hookCallback = $this->commandFactory->hookManager()->get('@hookme', [HookManager::ALTER_RESULT]);
$this->assertTrue($hookCallback != null);
$this->assertEquals(1, count($hookCallback));
$this->assertEquals(2, count($hookCallback[0]));
$this->assertTrue(is_callable($hookCallback[0]));
$this->assertEquals('hookTestAnnotatedHook', $hookCallback[0][1]);
$commandInfo = $this->commandFactory->createCommandInfo($this->commandFileInstance, 'testAnnotationHook');
$annotationData = $commandInfo->getRawAnnotations();
$this->assertEquals('hookme,before,after', implode(',', $annotationData->keys()));
$this->assertEquals('@hookme,@before,@after', implode(',', array_map(function ($item) { return "@$item"; }, $annotationData->keys())));
$command = $this->commandFactory->createCommand($commandInfo, $this->commandFileInstance);
$this->assertInstanceOf('\Symfony\Component\Console\Command\Command', $command);
$this->assertEquals('test:annotation-hook', $command->getName());
$input = new StringInput('test:annotation-hook baz');
$this->assertRunCommandViaApplicationEquals($command, $input, '>(baz)<');
}
function testHookHasCommandAnnotation()
{
$this->commandFileInstance = new \Consolidation\TestUtils\ExampleCommandFile();
$this->commandFactory = new AnnotatedCommandFactory();
$hookInfo = $this->commandFactory->createCommandInfo($this->commandFileInstance, 'hookAddCommandName');
$this->assertTrue($hookInfo->hasAnnotation('hook'));
$this->assertEquals('alter @addmycommandname', $hookInfo->getAnnotation('hook'));
$this->commandFactory->registerCommandHook($hookInfo, $this->commandFileInstance);
$hookCallback = $this->commandFactory->hookManager()->get('@addmycommandname', [HookManager::ALTER_RESULT]);
$this->assertTrue($hookCallback != null);
$this->assertEquals(1, count($hookCallback));
$this->assertEquals(2, count($hookCallback[0]));
$this->assertTrue(is_callable($hookCallback[0]));
$this->assertEquals('hookAddCommandName', $hookCallback[0][1]);
$commandInfo = $this->commandFactory->createCommandInfo($this->commandFileInstance, 'alterMe');
$annotationData = $commandInfo->getRawAnnotations();
$this->assertEquals('command,addmycommandname', implode(',', $annotationData->keys()));
$command = $this->commandFactory->createCommand($commandInfo, $this->commandFileInstance);
$this->assertInstanceOf('\Symfony\Component\Console\Command\Command', $command);
$this->assertEquals('alter-me', $command->getName());
$input = new StringInput('alter-me');
$this->assertRunCommandViaApplicationEquals($command, $input, 'splendiferous from alter-me');
$commandInfo = $this->commandFactory->createCommandInfo($this->commandFileInstance, 'alterMeToo');
$annotationData = $commandInfo->getRawAnnotations();
$this->assertEquals('addmycommandname', implode(',', $annotationData->keys()));
$annotationData = $commandInfo->getAnnotations();
$this->assertEquals('addmycommandname,command,_path,_classname', implode(',', $annotationData->keys()));
$command = $this->commandFactory->createCommand($commandInfo, $this->commandFileInstance);
$this->assertInstanceOf('\Symfony\Component\Console\Command\Command', $command);
$this->assertEquals('alter:me-too', $command->getName());
$input = new StringInput('alter:me-too');
$this->assertRunCommandViaApplicationEquals($command, $input, 'fantabulous from alter:me-too');
}
function testHookedCommandWithHookAddedLater()
{
$this->commandFileInstance = new \Consolidation\TestUtils\ExampleCommandFile();
$this->commandFactory = new AnnotatedCommandFactory();
$commandInfo = $this->commandFactory->createCommandInfo($this->commandFileInstance, 'testHook');
$command = $this->commandFactory->createCommand($commandInfo, $this->commandFileInstance);
$this->assertInstanceOf('\Symfony\Component\Console\Command\Command', $command);
$this->assertEquals('test:hook', $command->getName());
// Run the command once without the hook
$input = new StringInput('test:hook foo');
$this->assertRunCommandViaApplicationEquals($command, $input, '[foo]');
// Register the hook and run the command again
$hookInfo = $this->commandFactory->createCommandInfo($this->commandFileInstance, 'hookTestHook');
$this->assertTrue($hookInfo->hasAnnotation('hook'));
$this->assertEquals('alter test:hook', $hookInfo->getAnnotation('hook'));
$this->commandFactory->registerCommandHook($hookInfo, $this->commandFileInstance);
$hookCallback = $this->commandFactory->hookManager()->get('test:hook', [HookManager::ALTER_RESULT]);;
$this->assertTrue($hookCallback != null);
$this->assertEquals(1, count($hookCallback));
$this->assertEquals(2, count($hookCallback[0]));
$this->assertTrue(is_callable($hookCallback[0]));
$this->assertEquals('hookTestHook', $hookCallback[0][1]);
$input = new StringInput('test:hook bar');
$this->assertRunCommandViaApplicationEquals($command, $input, '<[bar]>');
}
function testInitializeHook()
{
$this->commandFileInstance = new \Consolidation\TestUtils\ExampleCommandFile();
$this->commandFactory = new AnnotatedCommandFactory();
$hookInfo = $this->commandFactory->createCommandInfo($this->commandFileInstance, 'initializeTestHello');
$this->assertTrue($hookInfo->hasAnnotation('hook'));
$this->assertEquals($hookInfo->getAnnotation('hook'), 'init test:hello');
$this->commandFactory->registerCommandHook($hookInfo, $this->commandFileInstance);
$hookCallback = $this->commandFactory->hookManager()->get('test:hello', [HookManager::INITIALIZE]);
$this->assertTrue($hookCallback != null);
$this->assertEquals(1, count($hookCallback));
$this->assertEquals(2, count($hookCallback[0]));
$this->assertTrue(is_callable($hookCallback[0]));
$this->assertEquals('initializeTestHello', $hookCallback[0][1]);
$commandInfo = $this->commandFactory->createCommandInfo($this->commandFileInstance, 'testHello');
$command = $this->commandFactory->createCommand($commandInfo, $this->commandFileInstance);
$this->assertInstanceOf('\Symfony\Component\Console\Command\Command', $command);
$this->assertEquals('test:hello', $command->getName());
$commandGetNames = $this->callProtected($command, 'getNames');
$this->assertEquals('test:hello,Consolidation\TestUtils\ExampleCommandFile', implode(',', $commandGetNames));
$hookCallback = $command->commandProcessor()->hookManager()->get('test:hello', 'init');
$this->assertTrue($hookCallback != null);
$this->assertEquals('initializeTestHello', $hookCallback[0][1]);
$input = new StringInput('test:hello');
$this->assertRunCommandViaApplicationEquals($command, $input, "Hello, Huey.");
}
function testCommandEventHook()
{
$this->commandFileInstance = new \Consolidation\TestUtils\ExampleCommandFile();
$this->commandFactory = new AnnotatedCommandFactory();
$hookInfo = $this->commandFactory->createCommandInfo($this->commandFileInstance, 'commandEventTestHello');
$this->assertTrue($hookInfo->hasAnnotation('hook'));
$this->assertEquals($hookInfo->getAnnotation('hook'), 'command-event test:hello');
$this->commandFactory->registerCommandHook($hookInfo, $this->commandFileInstance);
$hookCallback = $this->commandFactory->hookManager()->get('test:hello', [HookManager::COMMAND_EVENT]);
$this->assertTrue($hookCallback != null);
$this->assertEquals(1, count($hookCallback));
$this->assertEquals(2, count($hookCallback[0]));
$this->assertTrue(is_callable($hookCallback[0]));
$this->assertEquals('commandEventTestHello', $hookCallback[0][1]);
$commandInfo = $this->commandFactory->createCommandInfo($this->commandFileInstance, 'testHello');
$command = $this->commandFactory->createCommand($commandInfo, $this->commandFileInstance);
$this->assertInstanceOf('\Symfony\Component\Console\Command\Command', $command);
$this->assertEquals('test:hello', $command->getName());
$commandGetNames = $this->callProtected($command, 'getNames');
$this->assertEquals('test:hello,Consolidation\TestUtils\ExampleCommandFile', implode(',', $commandGetNames));
$hookCallback = $command->commandProcessor()->hookManager()->get('test:hello', 'command-event');
$this->assertTrue($hookCallback != null);
$this->assertEquals('commandEventTestHello', $hookCallback[0][1]);
$input = new StringInput('test:hello Pluto');
$this->assertRunCommandViaApplicationEquals($command, $input, "Here comes Pluto!\nHello, Pluto.");
}
function testInteractAndValidate()
{
$this->commandFileInstance = new \Consolidation\TestUtils\ExampleCommandFile();
$this->commandFactory = new AnnotatedCommandFactory();
$hookInfo = $this->commandFactory->createCommandInfo($this->commandFileInstance, 'interactTestHello');
$this->assertTrue($hookInfo->hasAnnotation('hook'));
$this->assertEquals($hookInfo->getAnnotation('hook'), 'interact test:hello');
$this->commandFactory->registerCommandHook($hookInfo, $this->commandFileInstance);
$hookInfo = $this->commandFactory->createCommandInfo($this->commandFileInstance, 'validateTestHello');
$this->assertTrue($hookInfo->hasAnnotation('hook'));
$this->assertEquals($hookInfo->getAnnotation('hook'), 'validate test:hello');
$this->commandFactory->registerCommandHook($hookInfo, $this->commandFileInstance);
$hookCallback = $this->commandFactory->hookManager()->get('test:hello', [HookManager::ARGUMENT_VALIDATOR]);
$this->assertTrue($hookCallback != null);
$this->assertEquals(1, count($hookCallback));
$this->assertEquals(2, count($hookCallback[0]));
$this->assertTrue(is_callable($hookCallback[0]));
$this->assertEquals('validateTestHello', $hookCallback[0][1]);
$hookCallback = $this->commandFactory->hookManager()->get('test:hello', [HookManager::INTERACT]);
$this->assertTrue($hookCallback != null);
$this->assertEquals(1, count($hookCallback));
$this->assertEquals(2, count($hookCallback[0]));
$this->assertTrue(is_callable($hookCallback[0]));
$this->assertEquals('interactTestHello', $hookCallback[0][1]);
$commandInfo = $this->commandFactory->createCommandInfo($this->commandFileInstance, 'testHello');
$command = $this->commandFactory->createCommand($commandInfo, $this->commandFileInstance);
$this->assertInstanceOf('\Symfony\Component\Console\Command\Command', $command);
$this->assertEquals('test:hello', $command->getName());
$commandGetNames = $this->callProtected($command, 'getNames');
$this->assertEquals('test:hello,Consolidation\TestUtils\ExampleCommandFile', implode(',', $commandGetNames));
$testInteractInput = new StringInput('test:hello');
$definition = new \Symfony\Component\Console\Input\InputDefinition(
[
new \Symfony\Component\Console\Input\InputArgument('application', \Symfony\Component\Console\Input\InputArgument::REQUIRED),
new \Symfony\Component\Console\Input\InputArgument('who', \Symfony\Component\Console\Input\InputArgument::REQUIRED),
]
);
$testInteractInput->bind($definition);
$testInteractOutput = new BufferedOutput();
$command->commandProcessor()->interact(
$testInteractInput,
$testInteractOutput,
$commandGetNames,
$command->getAnnotationData()
);
$this->assertEquals('Goofey', $testInteractInput->getArgument('who'));
$hookCallback = $command->commandProcessor()->hookManager()->get('test:hello', 'interact');
$this->assertTrue($hookCallback != null);
$this->assertEquals('interactTestHello', $hookCallback[0][1]);
$input = new StringInput('test:hello "Mickey Mouse"');
$this->assertRunCommandViaApplicationEquals($command, $input, 'Hello, Mickey Mouse.');
$input = new StringInput('test:hello');
$this->assertRunCommandViaApplicationEquals($command, $input, 'Hello, Goofey.');
$input = new StringInput('test:hello "Donald Duck"');
$this->assertRunCommandViaApplicationEquals($command, $input, "I won't say hello to Donald Duck.", 1);
$input = new StringInput('test:hello "Drumph"');
$this->assertRunCommandViaApplicationEquals($command, $input, "Irrational value error.", 1);
// Try the last test again with a display error function installed.
$this->commandFactory->commandProcessor()->setDisplayErrorFunction(
function ($output, $message) {
$output->writeln("*** $message ****");
}
);
$input = new StringInput('test:hello "Drumph"');
$this->assertRunCommandViaApplicationEquals($command, $input, "*** Irrational value error. ****", 1);
}
function callProtected($object, $method, $args = [])
{
$r = new \ReflectionMethod($object, $method);
$r->setAccessible(true);
return $r->invokeArgs($object, $args);
}
function assertRunCommandViaApplicationContains($command, $input, $containsList, $expectedStatusCode = 0)
{
list($statusCode, $commandOutput) = $this->runCommandViaApplication($command, $input);
foreach ($containsList as $contains) {
$this->assertContains($contains, $commandOutput);
}
$this->assertEquals($expectedStatusCode, $statusCode);
}
function assertRunCommandViaApplicationEquals($command, $input, $expectedOutput, $expectedStatusCode = 0)
{
list($statusCode, $commandOutput) = $this->runCommandViaApplication($command, $input);
$this->assertEquals($expectedOutput, $commandOutput);
$this->assertEquals($expectedStatusCode, $statusCode);
}
function runCommandViaApplication($command, $input)
{
$output = new BufferedOutput();
if ($this->commandFileInstance && method_exists($this->commandFileInstance, 'setOutput')) {
$this->commandFileInstance->setOutput($output);
}
$application = new Application('TestApplication', '0.0.0');
$alterOptionsEventManager = new AlterOptionsCommandEvent($application);
$eventDispatcher = new \Symfony\Component\EventDispatcher\EventDispatcher();
$eventDispatcher->addSubscriber($this->commandFactory->commandProcessor()->hookManager());
$this->commandFactory->commandProcessor()->hookManager()->addCommandEvent($alterOptionsEventManager);
$application->setDispatcher($eventDispatcher);
$application->setAutoExit(false);
$application->add($command);
$statusCode = $application->run($input, $output);
$commandOutput = trim(str_replace("\r", '', $output->fetch()));
return [$statusCode, $commandOutput];
}
}
PK p?Vg " tests/testCommandFileDiscovery.phpnu W+A setSearchPattern('*CommandFile.php')
->setSearchLocations(['alpha']);
chdir(__DIR__);
$commandFiles = $discovery->discover('.', '\Consolidation\TestUtils');
$commandFilePaths = array_keys($commandFiles);
$commandFileNamespaces = array_values($commandFiles);
// Ensure that the command files that we expected to
// find were all found. We don't find anything in
// 'beta' because only 'alpha' is in the search path.
$this->assertContains('./src/ExampleCommandFile.php', $commandFilePaths);
$this->assertContains('./src/ExampleHookAllCommandFile.php', $commandFilePaths);
$this->assertContains('./src/alpha/AlphaCommandFile.php', $commandFilePaths);
$this->assertContains('./src/alpha/Inclusive/IncludedCommandFile.php', $commandFilePaths);
// Make sure that there are no additional items found.
$this->assertEquals(4, count($commandFilePaths));
// Ensure that the command file namespaces that we expected
// to be generated all match.
$this->assertContains('\Consolidation\TestUtils\ExampleCommandFile', $commandFileNamespaces);
$this->assertContains('\Consolidation\TestUtils\ExampleHookAllCommandFile', $commandFileNamespaces);
$this->assertContains('\Consolidation\TestUtils\alpha\AlphaCommandFile', $commandFileNamespaces);
$this->assertContains('\Consolidation\TestUtils\alpha\Inclusive\IncludedCommandFile', $commandFileNamespaces);
// We do not need to test for additional namespace items, because we
// know that the length of the array_keys must be the same as the
// length of the array_values.
}
function testDeepCommandDiscovery()
{
$discovery = new CommandFileDiscovery();
$discovery
->setSearchPattern('*CommandFile.php')
->setSearchDepth(1)
->setSearchLocations([]);
chdir(__DIR__);
$commandFiles = $discovery->discover('.', '\Consolidation\TestUtils');
$commandFilePaths = array_keys($commandFiles);
$commandFileNamespaces = array_values($commandFiles);
// Ensure that the command files that we expected to
// find were all found. We find both 'alpha' and 'beta'
// items because the search locations is empty, which
// causes the search at the base directory to be deep.
// We do not find alpha/Inclusive, though, as the search
// depth is only 2, which excludes directories that are
// three levels deep.
$this->assertContains('./src/ExampleCommandFile.php', $commandFilePaths);
$this->assertContains('./src/ExampleHookAllCommandFile.php', $commandFilePaths);
$this->assertContains('./src/alpha/AlphaCommandFile.php', $commandFilePaths);
$this->assertContains('./src/beta/BetaCommandFile.php', $commandFilePaths);
// Make sure that there are no additional items found.
$this->assertEquals(4, count($commandFilePaths));
// Ensure that the command file namespaces that we expected
// to be generated all match.
$this->assertContains('\Consolidation\TestUtils\ExampleCommandFile', $commandFileNamespaces);
$this->assertContains('\Consolidation\TestUtils\ExampleHookAllCommandFile', $commandFileNamespaces);
$this->assertContains('\Consolidation\TestUtils\alpha\AlphaCommandFile', $commandFileNamespaces);
$this->assertContains('\Consolidation\TestUtils\beta\BetaCommandFile', $commandFileNamespaces);
// We do not need to test for additional namespace items, because we
// know that the length of the array_keys must be the same as the
// length of the array_values.
}
}
PK p?VH tests/testCommandInfo.phpnu W+A $value) {
if (!is_string($value)) {
$value = var_export($value, true);
}
$result[] = "{$key}=>{$value}";
}
return implode("\n", $result);
}
/**
* Test CommandInfo command annotation parsing.
*/
function testParsing()
{
$commandInfo = CommandInfo::create('\Consolidation\TestUtils\ExampleCommandFile', 'testArithmatic');
$this->assertCommandInfoIsAsExpected($commandInfo);
$serializer = new CommandInfoSerializer();
$serialized = $serializer->serialize($commandInfo);
$deserializer = new CommandInfoDeserializer();
$deserializedCommandInfo = $deserializer->deserialize($serialized);
$this->assertCommandInfoIsAsExpected($deserializedCommandInfo);
}
function testWithConfigImport()
{
$commandInfo = CommandInfo::create('\Consolidation\TestUtils\ExampleCommandFile', 'import');
$this->assertEquals('config:import', $commandInfo->getName());
$this->assertEquals(
'A config directory label (i.e. a key in \$config_directories array in settings.php).',
$commandInfo->arguments()->getDescription('label')
);
}
function assertCommandInfoIsAsExpected($commandInfo)
{
$this->assertEquals('test:arithmatic', $commandInfo->getName());
$this->assertEquals(
'This is the test:arithmatic command',
$commandInfo->getDescription()
);
$this->assertEquals(
"This command will add one and two. If the --negate flag\nis provided, then the result is negated.",
$commandInfo->getHelp()
);
$this->assertEquals('arithmatic', implode(',', $commandInfo->getAliases()));
$this->assertEquals(
'2 2 --negate=>Add two plus two and then negate.',
$this->flattenArray($commandInfo->getExampleUsages())
);
$this->assertEquals(
'The first number to add.',
$commandInfo->arguments()->getDescription('one')
);
$this->assertEquals(
'The other number to add.',
$commandInfo->arguments()->getDescription('two')
);
$this->assertEquals(
'2',
$commandInfo->arguments()->get('two')
);
$this->assertEquals(
'Whether or not the result should be negated.',
$commandInfo->options()->getDescription('negate')
);
$this->assertEquals(
'bob',
$commandInfo->options()->get('unused')
);
$this->assertEquals(
'one,two',
$commandInfo->getAnnotation('dup')
);
$this->assertEquals(
['one','two'],
$commandInfo->getAnnotationList('dup')
);
}
function testReturnValue()
{
$commandInfo = CommandInfo::create('\Consolidation\TestUtils\alpha\AlphaCommandFile', 'exampleTable');
$this->assertEquals('example:table', $commandInfo->getName());
$this->assertEquals('\Consolidation\OutputFormatters\StructuredData\RowsOfFields', $commandInfo->getReturnType());
}
}
PK p?VG. . tests/testHelp.phpnu W+A application = new ApplicationWithTerminalWidth('TestApplication', '0.0.0');
$this->commandFactory = new AnnotatedCommandFactory();
// $factory->addListener(...);
$alterOptionsEventManager = new AlterOptionsCommandEvent($this->application);
$eventDispatcher = new \Symfony\Component\EventDispatcher\EventDispatcher();
$eventDispatcher->addSubscriber($this->commandFactory->commandProcessor()->hookManager());
$this->commandFactory->commandProcessor()->hookManager()->addCommandEvent($alterOptionsEventManager);
$this->application->setDispatcher($eventDispatcher);
$this->application->setAutoExit(false);
$discovery = new CommandFileDiscovery();
$discovery
->setSearchPattern('*CommandFile.php')
->setIncludeFilesAtBase(false)
->setSearchLocations(['alpha']);
chdir(__DIR__);
$commandFiles = $discovery->discover('.', '\Consolidation\TestUtils');
$formatter = new FormatterManager();
$formatter->addDefaultFormatters();
$formatter->addDefaultSimplifiers();
$terminalWidthOption = new PrepareTerminalWidthOption();
$terminalWidthOption->setApplication($this->application);
$this->commandFactory->commandProcessor()->setFormatterManager($formatter);
$this->commandFactory->commandProcessor()->addPrepareFormatter($terminalWidthOption);
$this->commandFactory->setIncludeAllPublicMethods(false);
$this->addDiscoveredCommands($this->commandFactory, $commandFiles);
$helpCommandfile = new HelpCommand($this->application);
$commandList = $this->commandFactory->createCommandsFromClass($helpCommandfile);
foreach ($commandList as $command) {
$this->application->add($command);
}
}
public function addDiscoveredCommands($factory, $commandFiles) {
foreach ($commandFiles as $path => $commandClass) {
$this->assertFileExists($path);
if (!class_exists($commandClass)) {
include $path;
}
$commandInstance = new $commandClass();
$commandList = $factory->createCommandsFromClass($commandInstance);
foreach ($commandList as $command) {
$this->application->add($command);
}
}
}
function assertRunCommandViaApplicationEquals($cmd, $expectedOutput, $expectedStatusCode = 0)
{
$input = new StringInput($cmd);
$output = new BufferedOutput();
$statusCode = $this->application->run($input, $output);
$commandOutput = trim($output->fetch());
$expectedOutput = $this->simplifyWhitespace($expectedOutput);
$commandOutput = $this->simplifyWhitespace($commandOutput);
$this->assertEquals($expectedOutput, $commandOutput);
$this->assertEquals($expectedStatusCode, $statusCode);
}
function simplifyWhitespace($data)
{
return trim(preg_replace('#\s+$#m', '', $data));
}
function testHelp()
{
$expectedXML = <<
example:table [--format [FORMAT]] [--fields [FIELDS]] [--field FIELD] [--] [<unused>]
example:table --format=yml
Show the example table in yml format.
example:table --fields=first,third
Show only the first and third fields in the table.
example:table --fields=II,III
Note that either the field ID or the visible field label may be used.
Test command with formatters
An unused argument
Test command with formatters
extab
docs-tables
EOT;
$this->assertRunCommandViaApplicationEquals('my-help --format=xml example:table', $expectedXML);
$expectedJSON = <<]"
],
"examples": [
{
"usage": "example:table --format=yml",
"description": "Show the example table in yml format."
},
{
"usage": "example:table --fields=first,third",
"description": "Show only the first and third fields in the table."
},
{
"usage": "example:table --fields=II,III",
"description": "Note that either the field ID or the visible field label may be used."
}
],
"description": "Test command with formatters",
"arguments": {
"unused": {
"name": "unused",
"is_required": "0",
"is_array": "0",
"description": "An unused argument"
}
},
"options": {
"format": {
"name": "--format",
"shortcut": "",
"accept_value": "1",
"is_value_required": "0",
"is_multiple": "0",
"description": "Format the result data. Available formats: csv,json,list,php,print-r,sections,string,table,tsv,var_export,xml,yaml",
"defaults": [
"table"
]
},
"fields": {
"name": "--fields",
"shortcut": "",
"accept_value": "1",
"is_value_required": "0",
"is_multiple": "0",
"description": "Available fields: I (first), II (second), III (third)"
},
"field": {
"name": "--field",
"shortcut": "",
"accept_value": "1",
"is_value_required": "1",
"is_multiple": "0",
"description": "Select just one field, and force format to 'string'."
},
"help": {
"name": "--help",
"shortcut": "-h",
"accept_value": "0",
"is_value_required": "0",
"is_multiple": "0",
"description": "Display this help message"
},
"quiet": {
"name": "--quiet",
"shortcut": "-q",
"accept_value": "0",
"is_value_required": "0",
"is_multiple": "0",
"description": "Do not output any message"
},
"verbose": {
"name": "--verbose",
"shortcut": "-v",
"shortcuts": "-v|-vv|-vvv",
"accept_value": "0",
"is_value_required": "0",
"is_multiple": "0",
"description": "Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug"
},
"version": {
"name": "--version",
"shortcut": "-V",
"accept_value": "0",
"is_value_required": "0",
"is_multiple": "0",
"description": "Display this application version"
},
"ansi": {
"name": "--ansi",
"shortcut": "",
"accept_value": "0",
"is_value_required": "0",
"is_multiple": "0",
"description": "Force ANSI output"
},
"no-ansi": {
"name": "--no-ansi",
"shortcut": "",
"accept_value": "0",
"is_value_required": "0",
"is_multiple": "0",
"description": "Disable ANSI output"
},
"no-interaction": {
"name": "--no-interaction",
"shortcut": "-n",
"accept_value": "0",
"is_value_required": "0",
"is_multiple": "0",
"description": "Do not ask any interactive question"
}
},
"help": "Test command with formatters",
"aliases": [
"extab"
],
"topics": [
"docs-tables"
]
}
EOT;
$this->assertRunCommandViaApplicationEquals('my-help --format=json example:table', $expectedJSON);
}
}
PK p?V"s s tests/testAnnotatedCommand.phpnu W+A assertInstanceOf('\Symfony\Component\Console\Command\Command', $command);
$this->assertEquals('my:cat', $command->getName());
$this->assertEquals('This is the my:cat command implemented as an AnnotatedCommand subclass.', $command->getDescription());
$this->assertEquals("This command will concatenate two parameters. If the --flip flag\nis provided, then the result is the concatenation of two and one.", $command->getHelp());
$this->assertEquals('c', implode(',', $command->getAliases()));
// Symfony Console composes the synopsis; perhaps we should not test it. Remove if this gives false failures.
$this->assertEquals('my:cat [--multiple MULTIPLE] [--flip] [--] []', $command->getSynopsis());
$this->assertEquals('my:cat bet alpha --flip', implode(',', $command->getUsages()));
$input = new StringInput('my:cat b alpha --multiple=t --multiple=e --flip');
$this->assertRunCommandViaApplicationEquals($command, $input, 'alphabet');
}
// TODO: Make a base test class to hold this.
function assertRunCommandViaApplicationEquals($command, $input, $expectedOutput, $expectedStatusCode = 0)
{
$output = new BufferedOutput();
$application = new Application('TestApplication', '0.0.0');
$application->setAutoExit(false);
$application->add($command);
$statusCode = $application->run($input, $output);
$commandOutput = trim($output->fetch());
$this->assertEquals($expectedOutput, $commandOutput);
$this->assertEquals($expectedStatusCode, $statusCode);
}
}
PK p?V@]2J J ' tests/FullyQualifiedClassCacheTests.phpnu W+A getFileName();
$fqcnCache = new FullyQualifiedClassCache();
$handle = fopen($filename, "r");
$this->assertTrue($handle !== false);
$namespaceName = $this->callProtected($fqcnCache, 'readNamespace', [$handle]);
$this->assertEquals('Consolidation\TestUtils\alpha', $namespaceName);
$usedClasses = $this->callProtected($fqcnCache, 'readUseStatements', [$handle]);
$this->assertTrue(isset($usedClasses['RowsOfFields']));
$this->assertEquals('Consolidation\OutputFormatters\StructuredData\RowsOfFields', $usedClasses['RowsOfFields']);
fclose($handle);
$fqcn = $fqcnCache->qualify($filename, 'RowsOfFields');
$this->assertEquals('Consolidation\OutputFormatters\StructuredData\RowsOfFields', $fqcn);
$fqcn = $fqcnCache->qualify($filename, 'ClassWithoutUse');
$this->assertEquals('Consolidation\TestUtils\alpha\ClassWithoutUse', $fqcn);
$fqcn = $fqcnCache->qualify($filename, 'ExampleAliasedClass');
$this->assertEquals('Consolidation\TestUtils\ExampleCommandFile', $fqcn);
}
function callProtected($object, $method, $args = [])
{
$r = new \ReflectionMethod($object, $method);
$r->setAccessible(true);
return $r->invokeArgs($object, $args);
}
}
PK p?V[,NI I tests/src/TestTerminal.phpnu W+A width = $width;
}
public function getWidth()
{
return $this->width;
}
public function setWidth($width)
{
$this->width = $width;
}
}
PK p?V)2^ tests/src/InMemoryCacheStore.phpnu W+A cache = [];
}
/**
* Test for an entry from the cache
* @param string $key
* @return boolean
*/
public function has($key)
{
return array_key_exists($key, $this->cache);
}
/**
* Get an entry from the cache
* @param string $key
* @return array
*/
public function get($key)
{
if (!$this->has($key)) {
return [];
}
return $this->cache[$key];
}
/**
* Store an entry in the cache
* @param string $key
* @param array $data
*/
public function set($key, $data)
{
$this->cache[$key] = $data;
}
}
PK p?VVbB~7 7 * tests/src/ApplicationWithTerminalWidth.phpnu W+A width = $width;
$this->height = $height;
}
public function getTerminalDimensions()
{
return [ $this->width, $this->height ];
}
}
PK p?Vb % tests/src/ExampleAnnotatedCommand.phpnu W+A getArgument('one');
$two = $input->getArgument('two');
$multiple = $input->getOption('multiple');
$flip = $input->getOption('flip');
$result = $this->myCat($one, $two, $multiple, $flip);
// We could also just use $output->writeln($result) here,
// but calling processResults enables the use of output
// formatters. Note also that if you use processResults, you
// should correctly inject the command processor into your
// annotated command via AnnotatedCommand::setCommandProcessor().
return $this->processResults($input, $output, $result);
}
}
PK p?V҄6 6 tests/src/ExampleCommandFile.phpnu W+A state = $state;
}
public function setOutput($output)
{
$this->output = $output;
}
/**
* Import config from a config directory.
*
* @command config:import
* @param $label A config directory label (i.e. a key in \$config_directories array in settings.php).
* @interact-config-label
* @option preview Format for displaying proposed changes. Recognized values: list, diff.
* @option source An arbitrary directory that holds the configuration files. An alternative to label argument
* @option partial Allows for partial config imports from the source directory. Only updates and new configs will be processed with this flag (missing configs will not be deleted).
* @aliases cim,config-import
*/
public function import($label = null, $options = ['preview' => 'list', 'source' => InputOption::VALUE_REQUIRED, 'partial' => false])
{
}
/**
* Calculate the fibonacci sequence between two numbers.
*
* Graphic output will look like
* +----+---+-------------+
* | | | |
* | |-+-| |
* |----+-+-+ |
* | | |
* | | |
* | | |
* +--------+-------------+
*
* @param int $start Number to start from
* @param int $steps Number of steps to perform
* @param array $opts
* @option $graphic Display the sequence graphically using cube
* representation
*/
public function fibonacci($start, $steps, $opts = ['graphic' => false])
{
}
/**
* Code sniffer.
*
* Run the PHP Codesniffer on a file or directory.
*
* @param string $file
* A file or directory to analyze.
* @option $autofix Whether to run the automatic fixer or not.
* @option $strict Show warnings as well as errors.
* Default is to show only errors.
*/
public function sniff(
$file = 'src',
array $options = [
'autofix' => false,
'strict' => false,
]
) {
return var_export($options, true);
}
/**
* This is the my:cat command
*
* This command will concatenate two parameters. If the --flip flag
* is provided, then the result is the concatenation of two and one.
*
* @param string $one The first parameter.
* @param string $two The other parameter.
* @option boolean $flip Whether or not the second parameter should come first in the result.
* @aliases c
* @usage bet alpha --flip
* Concatenate "alpha" and "bet".
* @arbitrary This annotation is here merely as a marker used in testing.
*/
public function myCat($one, $two = '', array $options = ['flip' => false])
{
if ($options['flip']) {
return "{$two}{$one}";
}
return "{$one}{$two}";
}
/**
* @command my:repeat
*/
public function myRepeat($one, $two = '', array $options = ['repeat' => 1])
{
return str_repeat("{$one}{$two}", $options['repeat']);
}
/**
* This is the my:join command
*
* This command will join its parameters together. It can also reverse and repeat its arguments.
*
* @command my:join
* @usage a b
* Join a and b to produce "a,b"
* @usage
* Example with no parameters or options
*/
public function myJoin(array $args, array $options = ['flip' => false, 'repeat' => 1])
{
if ($options['flip']) {
$args = array_reverse($args);
}
$result = implode('', $args);
return str_repeat($result, $options['repeat']);
}
/**
* This is a command with no options
*
* This command will concatenate two parameters.
*
* @param $one The first parameter.
* @param $two The other parameter.
* @aliases nope
* @usage alpha bet
* Concatenate "alpha" and "bet".
*/
public function commandWithNoOptions($one, $two = 'default')
{
return "{$one}{$two}";
}
/**
* This command work with app's input and output
*
* @command command:with-io-parameters
*/
public function commandWithIOParameters(InputInterface $input, OutputInterface $output)
{
return $input->getFirstArgument();
}
/**
* This command has no arguments--only options
*
* Return a result only if not silent.
*
* @option silent Supress output.
*/
public function commandWithNoArguments(array $opts = ['silent|s' => false])
{
if (!$opts['silent']) {
return "Hello, world";
}
}
/**
* Shortcut on annotation
*
* This command defines the option shortcut on the annotation instead of in the options array.
*
* @param $opts The options
* @option silent|s Supress output.
*/
public function shortcutOnAnnotation(array $opts = ['silent' => false])
{
if (!$opts['silent']) {
return "Hello, world";
}
}
/**
* This is the test:arithmatic command
*
* This command will add one and two. If the --negate flag
* is provided, then the result is negated.
*
* @command test:arithmatic
* @param integer $one The first number to add.
* @param integer $two The other number to add.
* @option negate Whether or not the result should be negated.
* @aliases arithmatic
* @usage 2 2 --negate
* Add two plus two and then negate.
* @custom
* @dup one
* @dup two
*/
public function testArithmatic($one, $two = 2, array $options = ['negate' => false, 'unused' => 'bob'])
{
$result = $one + $two;
if ($options['negate']) {
$result = -$result;
}
// Integer return codes are exit codes (errors), so
// return a the result as a string so that it will be printed.
return "$result";
}
/**
* This is the test:state command
*
* This command tests to see if the state of the Commandfile instance
*/
public function testState()
{
return $this->state;
}
/**
* This is the test:passthrough command
*
* This command takes a variable number of parameters as
* an array and returns them as a csv.
*/
public function testPassthrough(array $params)
{
return implode(',', $params);
}
/**
* This command wraps its parameter in []; its alter hook
* then wraps the result in <>.
*/
public function testHook($parameter)
{
return "[$parameter]";
}
/**
* Wrap the results of test:hook in <>.
*
* @hook alter test:hook
*/
public function hookTestHook($result)
{
return "<$result>";
}
/**
* This test is very similar to the preceding test, except
* it uses an annotation hook instead of a named-function hook.
*
* @hookme
* @before >
* @after <
*/
public function testAnnotationHook($parameter)
{
return "($parameter)";
}
/**
* Wrap the results of test:hook in whatever the @before and @after
* annotations contain.
*
* @hook alter @hookme
*/
public function hookTestAnnotatedHook($result, CommandData $commandData)
{
$before = $commandData->annotationData()->get('before', '-');
$after = $commandData->annotationData()->get('after', '-');
return "$before$result$after";
}
/**
* Alter the results of the hook with its command name.
*
* @hook alter @addmycommandname
*/
public function hookAddCommandName($result, CommandData $commandData)
{
$annotationData = $commandData->annotationData();
return "$result from " . $annotationData['command'];
}
/**
* Here is a hook with an explicit command annotation that we will alter
* with the preceeding hook
*
* @command alter-me
* @addmycommandname
*/
public function alterMe()
{
return "splendiferous";
}
/**
* Here is another hook that has no command annotation that should be
* altered with the default value for the command name
*
* @addmycommandname
*/
public function alterMeToo()
{
return "fantabulous";
}
/**
* @command test:replace-command
*/
public function testReplaceCommand($value)
{
$this->output->writeln($value);
}
/**
* @hook replace-command test:replace-command
*/
public function hookTestReplaceCommandHook($value)
{
$this->output->writeln("bar");
}
/**
* @hook pre-command test:post-command
*/
public function hookTestPreCommandHook(CommandData $commandData)
{
// Use 'writeln' to detect order that hooks are called
$this->output->writeln("foo");
}
/**
* @command test:post-command
*/
public function testPostCommand($value)
{
$this->output->writeln($value);
}
/**
* @hook post-command test:post-command
*/
public function hookTestPostCommandHook($result, CommandData $commandData)
{
// Use 'writeln' to detect order that hooks are called
$this->output->writeln("baz");
}
public function testHello($who)
{
return "Hello, $who.";
}
public function testException($what)
{
throw new \Exception($what);
}
/**
* @hook init test:hello
*/
public function initializeTestHello($input, AnnotationData $annotationData)
{
$who = $input->getArgument('who');
if (!$who) {
$input->setArgument('who', 'Huey');
}
}
/**
* @hook command-event test:hello
*/
public function commandEventTestHello(ConsoleCommandEvent $event)
{
// Note that Symfony Console will not allow us to alter the
// input from this hook, so we'll just print something to
// show that this hook was executed.
$input = $event->getInput();
$who = $input->getArgument('who');
$this->output->writeln("Here comes $who!");
}
/**
* @hook interact test:hello
*/
public function interactTestHello($input, $output)
{
$who = $input->getArgument('who');
if (!$who) {
$input->setArgument('who', 'Goofey');
}
}
/**
* @hook validate test:hello
*/
public function validateTestHello($commandData)
{
$args = $commandData->arguments();
if ($args['who'] == 'Donald Duck') {
return new CommandError("I won't say hello to Donald Duck.");
}
if ($args['who'] == 'Drumph') {
throw new \Exception('Irrational value error.');
}
}
/**
* Test default values in arguments
*
* @param string|null $one
* @param string|null $two
* @return string
*/
public function defaults($one = null, $two = null)
{
if ($one && $two) {
return "$one and $two";
}
if ($one) {
return "only $one";
}
return "nothing provided";
}
/**
* @return string
*/
public function defaultOptionOne(array $options = ['foo' => '1'])
{
return "Foo is " . $options['foo'];
}
/**
* @return string
*/
public function defaultOptionTwo(array $options = ['foo' => '2'])
{
return "Foo is " . $options['foo'];
}
/**
* @return string
*/
public function defaultOptionNone(array $options = ['foo' => InputOption::VALUE_REQUIRED])
{
return "Foo is " . $options['foo'];
}
/**
* @return string
*/
public function defaultOptionalValue(array $options = ['foo' => InputOption::VALUE_OPTIONAL])
{
return "Foo is " . var_export($options['foo'], true);
}
/**
* @return string
*/
public function defaultOptionDefaultsToTrue(array $options = ['foo' => true])
{
return "Foo is " . var_export($options['foo'], true);
}
/**
* This is the test:required-array-option command
*
* This command will print all the valused of passed option
*
* @param array $opts
* @return string
*/
public function testRequiredArrayOption(array $opts = ['arr|a' => []])
{
return implode(' ', $opts['arr']);
}
/**
* This is the test:array-option command
*
* This command will print all the valused of passed option
*
* @param array $opts
* @return string
*/
public function testArrayOption(array $opts = ['arr|a' => ['1', '2', '3']])
{
return implode(' ', $opts['arr']);
}
/**
* @command global-options-only
*/
public function globalOptionsOnly($arg, array $options = [])
{
return "Arg is $arg, options[help] is " . var_export($options['help'], true) . "\n";
}
}
PK p?VG
" tests/src/beta/BetaCommandFile.phpnu W+A input()->getOption('chinese')) {
$result[] = [ 'first' => '壹', 'second' => '貳', 'third' => '叁' ];
}
return $result;
}
/**
* Demonstrate an alter hook with an option
*
* @hook alter *
* @option kanji Add a row with Kanji numbers.
* @usage example:table --kanji
*/
public function alterFormattersKanji($result, CommandData $commandData)
{
if ($commandData->input()->getOption('kanji')) {
$result[] = [ 'first' => '一', 'second' => '二', 'third' => '三' ];
}
return $result;
}
}
PK p?V)\
' tests/src/ExampleCommandInfoAlterer.phpnu W+A hasAnnotation('arbitrary')) {
$commandInfo->addAnnotation('dynamic', "This annotation was dynamically added by ExampleCommandInfoAlterer");
}
}
}
PK p?V&