diff --git a/composer.json b/composer.json index 0fac0b3f..7ac0817c 100644 --- a/composer.json +++ b/composer.json @@ -31,10 +31,15 @@ "symfony/phpunit-bridge": "^2.8|^3|^4.1", "phpunit/phpunit": "^7.3", "phpstan/phpstan": "^0.11.9", - "phpstan/phpstan-symfony": "^0.11.6" + "phpstan/phpstan-symfony": "^0.11.6", + "phpro/grumphp": "^0.15.2", + "jakub-onderka/php-parallel-lint": "^1.0" }, "autoload": { - "psr-4": {"Phabalicious\\": "src/"} + "psr-4": { + "Phabalicious\\": "src/", + "Phabalicious\\Tests\\": "tests/" + } }, "authors": [ { diff --git a/composer.lock b/composer.lock index 20e27fd4..1379ef3c 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "01824884920783e645d401709c59687e", + "content-hash": "a8014ada1b8bd894667531b070b988f3", "packages": [ { "name": "composer/ca-bundle", @@ -2221,6 +2221,146 @@ } ], "packages-dev": [ + { + "name": "composer/composer", + "version": "1.9.0", + "source": { + "type": "git", + "url": "https://github.com/composer/composer.git", + "reference": "314aa57fdcfc942065996f59fb73a8b3f74f3fa5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/composer/composer/zipball/314aa57fdcfc942065996f59fb73a8b3f74f3fa5", + "reference": "314aa57fdcfc942065996f59fb73a8b3f74f3fa5", + "shasum": "" + }, + "require": { + "composer/ca-bundle": "^1.0", + "composer/semver": "^1.0", + "composer/spdx-licenses": "^1.2", + "composer/xdebug-handler": "^1.1", + "justinrainbow/json-schema": "^3.0 || ^4.0 || ^5.0", + "php": "^5.3.2 || ^7.0", + "psr/log": "^1.0", + "seld/jsonlint": "^1.4", + "seld/phar-utils": "^1.0", + "symfony/console": "^2.7 || ^3.0 || ^4.0", + "symfony/filesystem": "^2.7 || ^3.0 || ^4.0", + "symfony/finder": "^2.7 || ^3.0 || ^4.0", + "symfony/process": "^2.7 || ^3.0 || ^4.0" + }, + "conflict": { + "symfony/console": "2.8.38" + }, + "require-dev": { + "phpunit/phpunit": "^4.8.35 || ^5.7", + "phpunit/phpunit-mock-objects": "^2.3 || ^3.0" + }, + "suggest": { + "ext-openssl": "Enabling the openssl extension allows you to access https URLs for repositories and packages", + "ext-zip": "Enabling the zip extension allows you to unzip archives", + "ext-zlib": "Allow gzip compression of HTTP requests" + }, + "bin": [ + "bin/composer" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.9-dev" + } + }, + "autoload": { + "psr-4": { + "Composer\\": "src/Composer" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nils Adermann", + "email": "naderman@naderman.de", + "homepage": "http://www.naderman.de" + }, + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "http://seld.be" + } + ], + "description": "Composer helps you declare, manage and install dependencies of PHP projects. It ensures you have the right stack everywhere.", + "homepage": "https://getcomposer.org/", + "keywords": [ + "autoload", + "dependency", + "package" + ], + "time": "2019-08-02T18:55:33+00:00" + }, + { + "name": "composer/spdx-licenses", + "version": "1.5.2", + "source": { + "type": "git", + "url": "https://github.com/composer/spdx-licenses.git", + "reference": "7ac1e6aec371357df067f8a688c3d6974df68fa5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/composer/spdx-licenses/zipball/7ac1e6aec371357df067f8a688c3d6974df68fa5", + "reference": "7ac1e6aec371357df067f8a688c3d6974df68fa5", + "shasum": "" + }, + "require": { + "php": "^5.3.2 || ^7.0 || ^8.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.8.35 || ^5.7 || 6.5 - 7" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.x-dev" + } + }, + "autoload": { + "psr-4": { + "Composer\\Spdx\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nils Adermann", + "email": "naderman@naderman.de", + "homepage": "http://www.naderman.de" + }, + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "http://seld.be" + }, + { + "name": "Rob Bast", + "email": "rob.bast@gmail.com", + "homepage": "http://robbast.nl" + } + ], + "description": "SPDX licenses list and validation library.", + "keywords": [ + "license", + "spdx", + "validator" + ], + "time": "2019-07-29T10:31:59+00:00" + }, { "name": "composer/xdebug-handler", "version": "1.3.3", @@ -2265,6 +2405,76 @@ ], "time": "2019-05-27T17:52:04+00:00" }, + { + "name": "doctrine/collections", + "version": "v1.6.2", + "source": { + "type": "git", + "url": "https://github.com/doctrine/collections.git", + "reference": "c5e0bc17b1620e97c968ac409acbff28b8b850be" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/collections/zipball/c5e0bc17b1620e97c968ac409acbff28b8b850be", + "reference": "c5e0bc17b1620e97c968ac409acbff28b8b850be", + "shasum": "" + }, + "require": { + "php": "^7.1.3" + }, + "require-dev": { + "doctrine/coding-standard": "^6.0", + "phpstan/phpstan-shim": "^0.9.2", + "phpunit/phpunit": "^7.0", + "vimeo/psalm": "^3.2.2" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.6.x-dev" + } + }, + "autoload": { + "psr-4": { + "Doctrine\\Common\\Collections\\": "lib/Doctrine/Common/Collections" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + } + ], + "description": "PHP Doctrine Collections library that adds additional functionality on top of PHP arrays.", + "homepage": "https://www.doctrine-project.org/projects/collections.html", + "keywords": [ + "array", + "collections", + "iterators", + "php" + ], + "time": "2019-06-09T13:48:14+00:00" + }, { "name": "doctrine/instantiator", "version": "1.1.0", @@ -2319,6 +2529,110 @@ ], "time": "2017-07-22T11:58:36+00:00" }, + { + "name": "gitonomy/gitlib", + "version": "v1.1.0", + "source": { + "type": "git", + "url": "https://github.com/gitonomy/gitlib.git", + "reference": "49e599915eae04b734f31e6e88f773d32d921e2e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/gitonomy/gitlib/zipball/49e599915eae04b734f31e6e88f773d32d921e2e", + "reference": "49e599915eae04b734f31e6e88f773d32d921e2e", + "shasum": "" + }, + "require": { + "php": "^5.6 || ^7.0", + "symfony/process": "^3.4|^4.0" + }, + "require-dev": { + "phpunit/phpunit": "^5.7|^6.5", + "psr/log": "^1.0" + }, + "suggest": { + "psr/log": "Required to use loggers for reporting of execution" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1-dev" + } + }, + "autoload": { + "psr-4": { + "Gitonomy\\Git\\": "src/Gitonomy/Git/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Alexandre Salomé", + "email": "alexandre.salome@gmail.com", + "homepage": "http://alexandre-salome.fr" + }, + { + "name": "Julien DIDIER", + "email": "genzo.wm@gmail.com", + "homepage": "http://www.jdidier.net" + } + ], + "description": "Library for accessing git", + "homepage": "http://gitonomy.com", + "time": "2019-06-23T09:49:01+00:00" + }, + { + "name": "jakub-onderka/php-parallel-lint", + "version": "v1.0.0", + "source": { + "type": "git", + "url": "https://github.com/JakubOnderka/PHP-Parallel-Lint.git", + "reference": "04fbd3f5fb1c83f08724aa58a23db90bd9086ee8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/JakubOnderka/PHP-Parallel-Lint/zipball/04fbd3f5fb1c83f08724aa58a23db90bd9086ee8", + "reference": "04fbd3f5fb1c83f08724aa58a23db90bd9086ee8", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "jakub-onderka/php-console-highlighter": "~0.3", + "nette/tester": "~1.3", + "squizlabs/php_codesniffer": "~2.7" + }, + "suggest": { + "jakub-onderka/php-console-highlighter": "Highlight syntax in code snippet" + }, + "bin": [ + "parallel-lint" + ], + "type": "library", + "autoload": { + "classmap": [ + "./" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-2-Clause" + ], + "authors": [ + { + "name": "Jakub Onderka", + "email": "ahoj@jakubonderka.cz" + } + ], + "description": "This tool check syntax of PHP files about 20x faster than serial check.", + "homepage": "https://github.com/JakubOnderka/PHP-Parallel-Lint", + "time": "2018-02-24T15:31:20+00:00" + }, { "name": "jean85/pretty-package-versions", "version": "1.2", @@ -2370,6 +2684,72 @@ ], "time": "2018-06-13T13:22:40+00:00" }, + { + "name": "justinrainbow/json-schema", + "version": "5.2.8", + "source": { + "type": "git", + "url": "https://github.com/justinrainbow/json-schema.git", + "reference": "dcb6e1006bb5fd1e392b4daa68932880f37550d4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/justinrainbow/json-schema/zipball/dcb6e1006bb5fd1e392b4daa68932880f37550d4", + "reference": "dcb6e1006bb5fd1e392b4daa68932880f37550d4", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "~2.2.20", + "json-schema/json-schema-test-suite": "1.2.0", + "phpunit/phpunit": "^4.8.35" + }, + "bin": [ + "bin/validate-json" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "JsonSchema\\": "src/JsonSchema/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Bruno Prieto Reis", + "email": "bruno.p.reis@gmail.com" + }, + { + "name": "Justin Rainbow", + "email": "justin.rainbow@gmail.com" + }, + { + "name": "Igor Wiedler", + "email": "igor@wiedler.ch" + }, + { + "name": "Robert Schönthal", + "email": "seroscho@googlemail.com" + } + ], + "description": "A library to validate a json schema.", + "homepage": "https://github.com/justinrainbow/json-schema", + "keywords": [ + "json", + "schema" + ], + "time": "2019-01-14T23:55:14+00:00" + }, { "name": "myclabs/deep-copy", "version": "1.8.1", @@ -3296,6 +3676,112 @@ ], "time": "2017-07-14T14:27:02+00:00" }, + { + "name": "phpro/grumphp", + "version": "v0.15.2", + "source": { + "type": "git", + "url": "https://github.com/phpro/grumphp.git", + "reference": "c153840bead6fbed370d35cc84c63dca33de0ca4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpro/grumphp/zipball/c153840bead6fbed370d35cc84c63dca33de0ca4", + "reference": "c153840bead6fbed370d35cc84c63dca33de0ca4", + "shasum": "" + }, + "require": { + "composer-plugin-api": "~1.0", + "composer/composer": "^1.0", + "doctrine/collections": "~1.2", + "gitonomy/gitlib": "^1.0.3", + "monolog/monolog": "~1.16", + "php": ">=7.0", + "seld/jsonlint": "~1.1", + "symfony/config": "~3.4|~4.0", + "symfony/console": "~3.4|~4.0", + "symfony/dependency-injection": "~3.4|~4.0", + "symfony/event-dispatcher": "~3.4|~4.0", + "symfony/filesystem": "~3.4|~4.0", + "symfony/finder": "~3.4|~4.0", + "symfony/options-resolver": "~3.4|~4.0", + "symfony/process": "~3.4|~4.0", + "symfony/yaml": "~3.4|~4.0" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "~2", + "jakub-onderka/php-parallel-lint": "^0.9.2", + "nikic/php-parser": "~2.1", + "phpspec/phpspec": "^3.2.2", + "phpspec/prophecy": "^1.6.2", + "phpunit/phpunit": "^6.5|^7.0", + "sebastian/comparator": "^2.1", + "sebastian/diff": "^2.0", + "sebastian/exporter": "^3.1", + "sensiolabs/security-checker": "^5.0", + "squizlabs/php_codesniffer": "~2.9" + }, + "suggest": { + "allocine/twigcs": "Lets GrumPHP check Twig coding standard.", + "atoum/atoum": "Lets GrumPHP run your unit tests.", + "behat/behat": "Lets GrumPHP validate your project features.", + "brianium/paratest": "Lets GrumPHP run PHPUnit in parallel.", + "codeception/codeception": "Lets GrumPHP run your project's full stack tests", + "codegyre/robo": "Lets GrumPHP run your automated PHP tasks.", + "designsecurity/progpilot": "Lets GrumPHP be sure that there are no vulnerabilities in your code.", + "doctrine/orm": "Lets GrumPHP validate your Doctrine mapping files.", + "friendsofphp/php-cs-fixer": "Lets GrumPHP automatically fix your codestyle.", + "infection/infection": "Lets GrumPHP evaluate the quality your unit tests", + "jakub-onderka/php-parallel-lint": "Lets GrumPHP quickly lint your entire code base.", + "localheinz/composer-normalize": "Lets GrumPHP tidy and normalize your composer.json file.", + "maglnet/composer-require-checker": "Lets GrumPHP analyze composer dependencies.", + "malukenho/kawaii-gherkin": "Lets GrumPHP lint your Gherkin files.", + "nikic/php-parser": "Lets GrumPHP run static analyses through your PHP files.", + "phan/phan": "Lets GrumPHP unleash a static analyzer on your code", + "phing/phing": "Lets GrumPHP run your automated PHP tasks.", + "phpmd/phpmd": "Lets GrumPHP sort out the mess in your code", + "phpspec/phpspec": "Lets GrumPHP spec your code.", + "phpstan/phpstan": "Lets GrumPHP discover bugs in your code without running it.", + "phpunit/phpunit": "Lets GrumPHP run your unit tests.", + "povils/phpmnd": "Lets GrumPHP help you detect magic numbers in PHP code.", + "roave/security-advisories": "Lets GrumPHP be sure that there are no known security issues.", + "sebastian/phpcpd": "Lets GrumPHP find duplicated code.", + "sensiolabs/security-checker": "Lets GrumPHP be sure that there are no known security issues.", + "squizlabs/php_codesniffer": "Lets GrumPHP sniff on your code.", + "sstalle/php7cc": "Lets GrumPHP check PHP 5.3 - 5.6 code compatibility with PHP 7.", + "symfony/phpunit-bridge": "Lets GrumPHP run your unit tests with the phpunit-bridge of Symfony.", + "symplify/easycodingstandard": "Lets GrumPHP check coding standard.", + "vimeo/psalm": "Lets GrumPHP discover errors in your code without running it." + }, + "bin": [ + "bin/grumphp" + ], + "type": "composer-plugin", + "extra": { + "class": "GrumPHP\\Composer\\GrumPHPPlugin" + }, + "autoload": { + "psr-4": { + "GrumPHP\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Toon Verwerft", + "email": "toon.verwerft@phpro.be" + }, + { + "name": "Community", + "homepage": "https://github.com/phpro/grumphp/graphs/contributors" + } + ], + "description": "A composer plugin that enables source code quality checks.", + "time": "2019-05-17T11:56:59+00:00" + }, { "name": "phpspec/prophecy", "version": "1.8.0", @@ -4452,6 +4938,153 @@ "homepage": "https://github.com/sebastianbergmann/version", "time": "2016-10-03T07:35:21+00:00" }, + { + "name": "seld/jsonlint", + "version": "1.7.1", + "source": { + "type": "git", + "url": "https://github.com/Seldaek/jsonlint.git", + "reference": "d15f59a67ff805a44c50ea0516d2341740f81a38" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Seldaek/jsonlint/zipball/d15f59a67ff805a44c50ea0516d2341740f81a38", + "reference": "d15f59a67ff805a44c50ea0516d2341740f81a38", + "shasum": "" + }, + "require": { + "php": "^5.3 || ^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0" + }, + "bin": [ + "bin/jsonlint" + ], + "type": "library", + "autoload": { + "psr-4": { + "Seld\\JsonLint\\": "src/Seld/JsonLint/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "http://seld.be" + } + ], + "description": "JSON Linter", + "keywords": [ + "json", + "linter", + "parser", + "validator" + ], + "time": "2018-01-24T12:46:19+00:00" + }, + { + "name": "seld/phar-utils", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/Seldaek/phar-utils.git", + "reference": "7009b5139491975ef6486545a39f3e6dad5ac30a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Seldaek/phar-utils/zipball/7009b5139491975ef6486545a39f3e6dad5ac30a", + "reference": "7009b5139491975ef6486545a39f3e6dad5ac30a", + "shasum": "" + }, + "require": { + "php": ">=5.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.x-dev" + } + }, + "autoload": { + "psr-4": { + "Seld\\PharUtils\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be" + } + ], + "description": "PHAR file format utilities, for when PHP phars you up", + "keywords": [ + "phra" + ], + "time": "2015-10-13T18:44:15+00:00" + }, + { + "name": "symfony/options-resolver", + "version": "v4.3.4", + "source": { + "type": "git", + "url": "https://github.com/symfony/options-resolver.git", + "reference": "81c2e120522a42f623233968244baebd6b36cb6a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/options-resolver/zipball/81c2e120522a42f623233968244baebd6b36cb6a", + "reference": "81c2e120522a42f623233968244baebd6b36cb6a", + "shasum": "" + }, + "require": { + "php": "^7.1.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.3-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\OptionsResolver\\": "" + }, + "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 OptionsResolver Component", + "homepage": "https://symfony.com", + "keywords": [ + "config", + "configuration", + "options" + ], + "time": "2019-08-08T09:29:19+00:00" + }, { "name": "symfony/phpunit-bridge", "version": "v4.2.3", diff --git a/fabfile.yaml b/fabfile.yaml new file mode 100644 index 00000000..3204e9bc --- /dev/null +++ b/fabfile.yaml @@ -0,0 +1,14 @@ +name: git-tests + + +hosts: + base: + type: dev + needs: + - local + - git + + hostA: + inheritsFrom: base + branch: master + diff --git a/grumphp.yml b/grumphp.yml new file mode 100644 index 00000000..8824be46 --- /dev/null +++ b/grumphp.yml @@ -0,0 +1,14 @@ +parameters: + process_timeout: 180 + git_dir: . + bin_dir: vendor/bin + tasks: + composer: ~ + git_commit_message: ~ + phplint: ~ + phpcs: + standard: + - PSR2 + phpunit: ~ + phpstan: ~ + diff --git a/symfony.lock b/symfony.lock index fc3acc00..ee4c8a4f 100644 --- a/symfony.lock +++ b/symfony.lock @@ -2,15 +2,27 @@ "composer/ca-bundle": { "version": "1.1.3" }, + "composer/composer": { + "version": "1.9.0" + }, "composer/semver": { "version": "1.4.2" }, + "composer/spdx-licenses": { + "version": "1.5.2" + }, "composer/xdebug-handler": { "version": "1.3.3" }, + "doctrine/collections": { + "version": "v1.6.2" + }, "doctrine/instantiator": { "version": "1.1.0" }, + "gitonomy/gitlib": { + "version": "v1.1.0" + }, "graze/data-structure": { "version": "2.1.0" }, @@ -32,9 +44,15 @@ "jakeasmith/http_build_url": { "version": "1.0.1" }, + "jakub-onderka/php-parallel-lint": { + "version": "v1.0.0" + }, "jean85/pretty-package-versions": { "version": "1.2" }, + "justinrainbow/json-schema": { + "version": "5.2.8" + }, "lesstif/php-jira-rest-client": { "version": "1.35.0" }, @@ -98,6 +116,9 @@ "phpdocumentor/type-resolver": { "version": "0.4.0" }, + "phpro/grumphp": { + "version": "v0.15.2" + }, "phpspec/prophecy": { "version": "1.8.0" }, @@ -179,6 +200,12 @@ "sebastian/version": { "version": "2.0.1" }, + "seld/jsonlint": { + "version": "1.7.1" + }, + "seld/phar-utils": { + "version": "1.0.1" + }, "stecman/symfony-console-completion": { "version": "0.8.0" }, @@ -230,6 +257,9 @@ "symfony/http-kernel": { "version": "v4.1.6" }, + "symfony/options-resolver": { + "version": "v4.3.4" + }, "symfony/phpunit-bridge": { "version": "4.1", "recipe": { diff --git a/tests/AppCreateCommandTest.php b/tests/AppCreateCommandTest.php index 8ab3e326..106a07e7 100644 --- a/tests/AppCreateCommandTest.php +++ b/tests/AppCreateCommandTest.php @@ -9,12 +9,11 @@ use Phabalicious\Method\MethodFactory; use Phabalicious\Method\ScriptMethod; use Phabalicious\Utilities\Utilities; -use PHPUnit\Framework\TestCase; use Psr\Log\LoggerInterface; use Symfony\Component\Console\Application; use Symfony\Component\Console\Tester\CommandTester; -class AppCreateCommandTest extends TestCase +class AppCreateCommandTest extends PhabTestCase { /** @var Application */ protected $application; @@ -30,7 +29,7 @@ public function setup() $method_factory->addMethod(new ScriptMethod($logger)); $method_factory->addMethod(new DockerMethod($logger)); - $configuration->readConfiguration(getcwd() . '/assets/app-create-tests/fabfile.yaml'); + $configuration->readConfiguration($this->getcwd() . '/assets/app-create-tests/fabfile.yaml'); $this->application->add(new AppCreateCommand($configuration, $method_factory)); $this->application->add(new ResetCommand($configuration, $method_factory)); @@ -38,7 +37,7 @@ public function setup() public function testAppCreateWithoutPrepare() { - $target_folder = getcwd() . '/tmp'; + $target_folder = $this->getcwd() . '/tmp'; if (!is_dir($target_folder)) { mkdir($target_folder); } @@ -61,7 +60,7 @@ public function testAppCreateWithoutPrepare() public function testAppCreateWithPrepare() { - $target_folder = getcwd() . '/tmp'; + $target_folder = $this->getcwd() . '/tmp'; if (!is_dir($target_folder)) { mkdir($target_folder); } diff --git a/tests/AppScaffoldCommandTest.php b/tests/AppScaffoldCommandTest.php index 4f705494..fa12c584 100644 --- a/tests/AppScaffoldCommandTest.php +++ b/tests/AppScaffoldCommandTest.php @@ -17,7 +17,7 @@ use Symfony\Component\Console\Application; use Symfony\Component\Console\Tester\CommandTester; -class AppScaffoldCommandTest extends TestCase +class AppScaffoldCommandTest extends PhabTestCase { /** @var Application */ protected $application; @@ -40,7 +40,7 @@ public function setup() */ public function testAppScaffolder() { - $target_folder = getcwd() . '/tmp'; + $target_folder = $this->getcwd() . '/tmp'; if (!is_dir($target_folder)) { mkdir($target_folder); } @@ -52,7 +52,7 @@ public function testAppScaffolder() '--name' => 'Test', '--output' => $target_folder, '--override' => true, - 'scaffold-url' => getcwd() . '/assets/scaffold-tests/scaffold-drupal-commerce.yml' + 'scaffold-url' => $this->getcwd() . '/assets/scaffold-tests/scaffold-drupal-commerce.yml' )); // the output of the command in the console @@ -81,7 +81,7 @@ public function testAppScaffolder() */ public function testScaffoldWithRelativeFolder() { - $root = getcwd(); + $root = $this->getcwd(); $target_folder = $root . '/tmp'; if (!is_dir($target_folder)) { mkdir($target_folder); @@ -123,7 +123,7 @@ public function testScaffoldWithRelativeFolder() public function testScaffoldQuestions() { - $root = getcwd(); + $root = $this->getcwd(); $target_folder = $root . '/tmp'; if (!is_dir($target_folder)) { mkdir($target_folder); @@ -150,7 +150,7 @@ public function testScaffoldQuestions() public function testScaffoldSubfolder() { - $root = getcwd(); + $root = $this->getcwd(); $target_folder = $root . '/tmp/here'; if (!is_dir($target_folder)) { mkdir($target_folder, 0777, true); @@ -180,7 +180,7 @@ public function testScaffoldSubfolder() public function testScaffoldExistingProjectFolder() { - $root = getcwd(); + $root = $this->getcwd(); $target_folder = $root . '/tmp/tst-test'; if (!is_dir($target_folder)) { mkdir($target_folder, 0777, true); @@ -213,7 +213,7 @@ public function testScaffoldExistingProjectFolder() */ public function testErrorWhileScaffolding() { - $root = getcwd(); + $root = $this->getcwd(); $target_folder = $root . '/tmp/tst-test'; if (!is_dir($target_folder)) { mkdir($target_folder, 0777, true); diff --git a/tests/ConfigurationServiceTest.php b/tests/ConfigurationServiceTest.php index fdf92158..1a3f1044 100644 --- a/tests/ConfigurationServiceTest.php +++ b/tests/ConfigurationServiceTest.php @@ -13,7 +13,7 @@ use Psr\Log\LogLevel; use Symfony\Component\Console\Application; -class ConfigurationServiceTest extends TestCase +class ConfigurationServiceTest extends PhabTestCase { /** @@ -50,11 +50,11 @@ public function setUp() public function testCustomFabfile() { $result = $this->config->readConfiguration( - getcwd(), - getcwd() . '/assets/custom-fabfile-tests/custom_fabfile.yaml' + $this->getcwd(), + $this->getcwd() . '/assets/custom-fabfile-tests/custom_fabfile.yaml' ); $this->assertTrue($result); - $this->assertEquals($this->config->getFabfilePath(), getCwd() . '/assets/custom-fabfile-tests'); + $this->assertEquals($this->config->getFabfilePath(), $this->getcwd() . '/assets/custom-fabfile-tests'); } /** @@ -62,39 +62,42 @@ public function testCustomFabfile() */ public function testNonExistingCustomFabfile() { - $result = $this->config->readConfiguration(getcwd(), getcwd() . '/assets/custom__not_existing.yaml'); + $result = $this->config->readConfiguration( + $this->getcwd(), + $this->getcwd() . '/assets/custom__not_existing.yaml' + ); } public function testRegularFabfile() { - $result = $this->config->readConfiguration(getcwd() . '/assets/fabfile-hierarchy-tests'); + $result = $this->config->readConfiguration($this->getcwd() . '/assets/fabfile-hierarchy-tests'); $this->assertTrue($result); - $this->assertEquals($this->config->getFabfilePath(), getCwd() . '/assets/fabfile-hierarchy-tests'); + $this->assertEquals($this->config->getFabfilePath(), $this->getcwd() . '/assets/fabfile-hierarchy-tests'); } public function testRegularFabfileInSubfolder() { - $result = $this->config->readConfiguration(getcwd() . '/assets/fabfile-hierarchy-tests/folder1'); + $result = $this->config->readConfiguration($this->getcwd() . '/assets/fabfile-hierarchy-tests/folder1'); $this->assertTrue($result); - $this->assertEquals($this->config->getFabfilePath(), getCwd() . '/assets/fabfile-hierarchy-tests'); + $this->assertEquals($this->config->getFabfilePath(), $this->getcwd() . '/assets/fabfile-hierarchy-tests'); } public function testRegularFabfileInSubSubFolder() { - $result = $this->config->readConfiguration(getcwd() . '/assets/fabfile-hierarchy-tests/folder1/folder2'); + $result = $this->config->readConfiguration($this->getcwd() . '/assets/fabfile-hierarchy-tests/folder1/folder2'); $this->assertTrue($result); - $this->assertEquals($this->config->getFabfilePath(), getCwd() . '/assets/fabfile-hierarchy-tests'); + $this->assertEquals($this->config->getFabfilePath(), $this->getcwd() . '/assets/fabfile-hierarchy-tests'); } public function testRegularFabfileInSubSubSubFolder() { $result = $this->config->readConfiguration( - getcwd() . '/assets/fabfile-hierarchy-tests/folder1/folder2/folder3' + $this->getcwd() . '/assets/fabfile-hierarchy-tests/folder1/folder2/folder3' ); $this->assertTrue($result); - $this->assertEquals($this->config->getFabfilePath(), getCwd() . '/assets/fabfile-hierarchy-tests'); + $this->assertEquals($this->config->getFabfilePath(), $this->getcwd() . '/assets/fabfile-hierarchy-tests'); } /** @@ -102,7 +105,9 @@ public function testRegularFabfileInSubSubSubFolder() */ public function testNonExistingFabfile() { - $result = $this->config->readConfiguration(getcwd() . '/assets/non-existing-fabfile-tests/one/two/three'); + $result = $this->config->readConfiguration( + $this->getcwd() . '/assets/non-existing-fabfile-tests/one/two/three' + ); } /** @@ -120,12 +125,12 @@ public function testNonMatchingVersion() $logger = $this->getMockBuilder(LoggerInterface::class)->getMock(); $config = new ConfigurationService($application, $logger); - $result = $config->readConfiguration(getcwd() . '/assets/fabfile-hierarchy-tests'); + $result = $config->readConfiguration($this->getcwd() . '/assets/fabfile-hierarchy-tests'); } public function testGlobalInheritance() { - $this->config->readConfiguration(getcwd() . '/assets/inherits'); + $this->config->readConfiguration($this->getcwd() . '/assets/inherits'); $this->assertEquals(123, $this->config->getSetting('fromFile1.value1')); $this->assertEquals(456, $this->config->getSetting('fromFile1.value2.value')); @@ -138,14 +143,14 @@ public function testGlobalInheritance() public function testDeprecatedInheritance() { - $this->config->readConfiguration(getcwd() . '/assets/inherits'); + $this->config->readConfiguration($this->getcwd() . '/assets/inherits'); $host_config = $this->config->getHostConfig('hostDeprecated'); $this->assertTrue($this->logger->containsMessage(LogLevel::WARNING, 'Please use a newer version of this file')); } public function testHostInheritance() { - $this->config->readConfiguration(getcwd() . '/assets/inherits'); + $this->config->readConfiguration($this->getcwd() . '/assets/inherits'); $this->assertEquals('host-a', $this->config->getHostConfig('hostA')['host']); $this->assertEquals('user-a', $this->config->getHostConfig('hostA')['user']); $this->assertEquals('host-b', $this->config->getHostConfig('hostB')['host']); @@ -155,7 +160,7 @@ public function testHostInheritance() public function testDockerHostInheritance() { - $this->config->readConfiguration(getcwd() . '/assets/inherits'); + $this->config->readConfiguration($this->getcwd() . '/assets/inherits'); $this->assertEquals('dockerhost-a', $this->config->getDockerConfig('hostA')['host']); $this->assertEquals('user-a', $this->config->getDockerConfig('hostA')['user']); $this->assertEquals('dockerhost-b', $this->config->getDockerConfig('hostB')['host']); @@ -166,7 +171,7 @@ public function testExecutables() { $this->config->getMethodFactory()->addMethod(new DrushMethod($this->logger)); $this->config->getMethodFactory()->addMethod(new ScriptMethod($this->logger)); - $this->config->readConfiguration(getcwd() . '/assets/executables-tests'); + $this->config->readConfiguration($this->getcwd() . '/assets/executables-tests'); $this->assertEquals('/usr/bin/drush', $this->config->getHostConfig('unaltered')['executables']['drush']); $this->assertEquals( '/usr/local/bin/drush', @@ -179,7 +184,7 @@ public function testSshTunnelConfiguration() { $this->config->getMethodFactory()->addMethod(new SshMethod($this->logger)); $this->config->getMethodFactory()->addMethod(new ScriptMethod($this->logger)); - $this->config->readConfiguration(getcwd() . '/assets/sshtunnel-tests'); + $this->config->readConfiguration($this->getcwd() . '/assets/sshtunnel-tests'); $ssh_tunnel = $this->config->getHostConfig('unaltered')['sshTunnel']; $this->assertEquals('1.2.3.4', $ssh_tunnel['destHost']); $this->assertEquals('1234', $ssh_tunnel['destPort']); diff --git a/tests/ConfigurationServiceValidationTest.php b/tests/ConfigurationServiceValidationTest.php index 4a01f2c4..c70b2b80 100644 --- a/tests/ConfigurationServiceValidationTest.php +++ b/tests/ConfigurationServiceValidationTest.php @@ -5,12 +5,10 @@ use Phabalicious\Configuration\ConfigurationService; use Phabalicious\Method\GitMethod; use Phabalicious\Method\MethodFactory; -use PHPUnit\Framework\TestCase; use Psr\Log\LoggerInterface; -use Psr\Log\Test\LoggerInterfaceTest; use Symfony\Component\Console\Application; -class ConfigurationServiceValidationTest extends TestCase +class ConfigurationServiceValidationTest extends PhabTestCase { /** @@ -35,7 +33,7 @@ public function setUp() $method_factory->addMethod(new GitMethod($this->logger)); $this->config->setMethodFactory($method_factory); - $this->config->readConfiguration(getcwd() . '/assets/validation-tests'); + $this->config->readConfiguration($this->getcwd() . '/assets/validation-tests'); } diff --git a/tests/DeployCommandTest.php b/tests/DeployCommandTest.php index 3c4fa65e..97a869ca 100644 --- a/tests/DeployCommandTest.php +++ b/tests/DeployCommandTest.php @@ -14,7 +14,7 @@ use Symfony\Component\Console\Application; use Symfony\Component\Console\Tester\CommandTester; -class DeployCommandTest extends TestCase +class DeployCommandTest extends PhabTestCase { /** @var Application */ protected $application; @@ -37,7 +37,7 @@ public function setup() $method_factory->addMethod($method); $method_factory->addMethod(new LocalMethod($logger)); - $configuration->readConfiguration(getcwd() . '/assets/script-tests/fabfile.yaml'); + $configuration->readConfiguration($this->getcwd() . '/assets/script-tests/fabfile.yaml'); $this->application->add(new DeployCommand($configuration, $method_factory)); } diff --git a/tests/DockerExecShellProviderTest.php b/tests/DockerExecShellProviderTest.php index 7ad97cee..7a93db7f 100644 --- a/tests/DockerExecShellProviderTest.php +++ b/tests/DockerExecShellProviderTest.php @@ -18,7 +18,7 @@ use Symfony\Component\Process\InputStream; use Symfony\Component\Process\Process; -class DockerExecShellProviderTest extends TestCase +class DockerExecShellProviderTest extends PhabTestCase { /** @var ConfigurationService */ diff --git a/tests/DrushMethodTest.php b/tests/DrushMethodTest.php index f738e96c..539daded 100644 --- a/tests/DrushMethodTest.php +++ b/tests/DrushMethodTest.php @@ -3,11 +3,12 @@ namespace Phabalicious\Method; use Phabalicious\Configuration\ConfigurationService; +use Phabalicious\Tests\PhabTestCase; use Phabalicious\Validation\ValidationErrorBag; use PHPUnit\Framework\TestCase; use Psr\Log\AbstractLogger; -class DrushMethodTest extends TestCase +class DrushMethodTest extends PhabTestCase { /** @var DrushMethod */ private $method; @@ -26,7 +27,7 @@ public function setup() $method_factory->addMethod(new ScriptMethod($logger)); $method_factory->addMethod($this->method); - $this->configurationService->readConfiguration(getcwd() . '/assets/drush-tests/fabfile.yaml'); + $this->configurationService->readConfiguration($this->getcwd() . '/assets/drush-tests/fabfile.yaml'); } public function testGetDefaultConfig() diff --git a/tests/GetPropertyCommandTest.php b/tests/GetPropertyCommandTest.php index 4fef7d8f..dac251ce 100644 --- a/tests/GetPropertyCommandTest.php +++ b/tests/GetPropertyCommandTest.php @@ -17,7 +17,7 @@ use Symfony\Component\Console\Application; use Symfony\Component\Console\Tester\CommandTester; -class GetPropertyCommandTest extends TestCase +class GetPropertyCommandTest extends PhabTestCase { /** @var Application */ protected $application; @@ -32,7 +32,7 @@ public function setup() $method_factory = new MethodFactory($configuration, $logger); $method_factory->addMethod(new ScriptMethod($logger)); - $configuration->readConfiguration(getcwd() . '/assets/getproperty-tests/fabfile.yaml'); + $configuration->readConfiguration($this->getcwd() . '/assets/getproperty-tests/fabfile.yaml'); $this->application->add(new GetPropertyCommand($configuration, $method_factory)); } @@ -84,5 +84,4 @@ public function testGetPropertyFromBluePrint() $output = $commandTester->getDisplay(); $this->assertContains('getproperty-test-valuefromblueprint', $output); } - } diff --git a/tests/GitMethodTest.php b/tests/GitMethodTest.php index c612f8ec..dae9effa 100644 --- a/tests/GitMethodTest.php +++ b/tests/GitMethodTest.php @@ -22,7 +22,7 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -class GitMethodTest extends TestCase +class GitMethodTest extends PhabTestCase { /** @var GitMethod */ private $method; @@ -52,7 +52,7 @@ public function setUp() $method_factory->addMethod(new ScriptMethod($logger)); $method_factory->addMethod($this->method); - $this->configurationService->readConfiguration(getcwd() . '/assets/git-tests/fabfile.yaml'); + $this->configurationService->readConfiguration($this->getcwd() . '/assets/git-tests/fabfile.yaml'); $this->context = new TaskContext( $this->getMockBuilder(BaseCommand::class)->disableOriginalConstructor()->getMock(), diff --git a/tests/InstallCommandTest.php b/tests/InstallCommandTest.php index 1a9d628d..24fb3592 100644 --- a/tests/InstallCommandTest.php +++ b/tests/InstallCommandTest.php @@ -13,7 +13,7 @@ use Symfony\Component\Console\Application; use Symfony\Component\Console\Tester\CommandTester; -class InstallCommandTest extends TestCase +class InstallCommandTest extends PhabTestCase { /** @var Application */ protected $application; @@ -29,7 +29,7 @@ public function setup() $method_factory->addMethod(new FilesMethod($logger)); $method_factory->addMethod(new ScriptMethod($logger)); - $configuration->readConfiguration(getcwd() . '/assets/install-command/fabfile.yaml'); + $configuration->readConfiguration($this->getcwd() . '/assets/install-command/fabfile.yaml'); $this->application->add(new InstallCommand($configuration, $method_factory)); } diff --git a/tests/LocalShellProviderTest.php b/tests/LocalShellProviderTest.php index 01b23704..af8c93f5 100644 --- a/tests/LocalShellProviderTest.php +++ b/tests/LocalShellProviderTest.php @@ -9,7 +9,7 @@ use PHPUnit\Framework\TestCase; use Psr\Log\AbstractLogger; -class LocalShellProviderTest extends TestCase +class LocalShellProviderTest extends PhabTestCase { /** @var \Phabalicious\ShellProvider\ShellProviderInterface */ private $shellProvider; diff --git a/tests/MethodFactoryTest.php b/tests/MethodFactoryTest.php index d48ca9af..be70934f 100644 --- a/tests/MethodFactoryTest.php +++ b/tests/MethodFactoryTest.php @@ -10,7 +10,7 @@ use Psr\Log\AbstractLogger; use Symfony\Component\Console\Application; -class MethodFactoryTest extends TestCase +class MethodFactoryTest extends PhabTestCase { /** @@ -18,7 +18,8 @@ class MethodFactoryTest extends TestCase */ private $methods; - public function setUp() { + public function setUp() + { parent::setUp(); // TODO: Change the autogenerated stub $application = $this->getMockBuilder(Application::class)->getMock(); @@ -50,5 +51,4 @@ public function testGetMethod() $this->assertEquals($found_method->getName(), $method->getName()); } - } diff --git a/tests/PhabTestCase.php b/tests/PhabTestCase.php new file mode 100644 index 00000000..e93f013e --- /dev/null +++ b/tests/PhabTestCase.php @@ -0,0 +1,14 @@ +addMethod(new LocalMethod($logger)); $method_factory->addMethod(new ScriptMethod($logger)); - $this->configurationService->readConfiguration(getcwd() . '/assets/script-tests/fabfile.yaml'); + $this->configurationService->readConfiguration($this->getcwd() . '/assets/script-tests/fabfile.yaml'); $this->context = new TaskContext( $this->getMockBuilder(BaseCommand::class)->disableOriginalConstructor()->getMock(), @@ -206,7 +206,10 @@ public function testExpandedEnvironmentVariablesFromHostConfig() $this->method->runScript($host_config, $this->context); $this->assertNotNull($this->context->getCommandResult()); - $this->assertEquals([getcwd() . '/assets/script-tests'], $this->context->getCommandResult()->getOutput()); + $this->assertEquals( + [$this->getcwd() . '/assets/script-tests'], + $this->context->getCommandResult()->getOutput() + ); } diff --git a/tests/SshMethodTest.php b/tests/SshMethodTest.php index fdecbe74..849a6276 100644 --- a/tests/SshMethodTest.php +++ b/tests/SshMethodTest.php @@ -8,7 +8,7 @@ use PHPUnit\Framework\TestCase; use Psr\Log\AbstractLogger; -class SshMethodTest extends TestCase +class SshMethodTest extends PhabTestCase { /** diff --git a/tests/UtilitiesTest.php b/tests/UtilitiesTest.php index 2ab8b145..ab7a40c3 100644 --- a/tests/UtilitiesTest.php +++ b/tests/UtilitiesTest.php @@ -11,7 +11,7 @@ use Phabalicious\Utilities\Utilities; use PHPUnit\Framework\TestCase; -class UtilitiesTest extends TestCase +class UtilitiesTest extends PhabTestCase { public function testExpandCommands() @@ -33,7 +33,6 @@ public function testExpandCommands() 'Second Example 1 Example 1 example', 'This Example 1 Example 2 example' ], $result); - } public function testExpandVariables() @@ -87,5 +86,4 @@ public function testSlugify() $this->assertEquals('asentencewithoutwords', Utilities::slugify('A sentence without Words')); $this->assertEquals('a-sentence-without-words', Utilities::slugify('A sentence without Words', '-')); } - } diff --git a/tests/VariantBaseCommandTest.php b/tests/VariantBaseCommandTest.php index 0db52ced..b3913ab8 100644 --- a/tests/VariantBaseCommandTest.php +++ b/tests/VariantBaseCommandTest.php @@ -20,7 +20,7 @@ use Symfony\Component\Console\Application; use Symfony\Component\Console\Tester\CommandTester; -class VariantBaseCommandTest extends TestCase +class VariantBaseCommandTest extends PhabTestCase { /** @var Application */ protected $application; @@ -36,7 +36,7 @@ public function setup() $method_factory->addMethod(new FilesMethod($logger)); $method_factory->addMethod(new ScriptMethod($logger)); - $configuration->readConfiguration(getcwd() . '/assets/variants-base-command-tests/fabfile.yaml'); + $configuration->readConfiguration($this->getcwd() . '/assets/variants-base-command-tests/fabfile.yaml'); $this->application->add(new ScriptCommand($configuration, $method_factory)); } @@ -76,7 +76,7 @@ public function testUnavailableVariants() */ private function runScript($script_name) { - $executable = realpath(getcwd() . '/../bin/phab'); + $executable = realpath($this->getcwd() . '/../bin/phab'); putenv('PHABALICIOUS_EXECUTABLE=' . $executable); $command = $this->application->find('script'); diff --git a/tests/phpunit.xml b/tests/phpunit.xml deleted file mode 100644 index 1bbcf681..00000000 --- a/tests/phpunit.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - . - - - - - ../src - - -