diff --git a/.github/workflows/php-workshop.yml b/.github/workflows/php-workshop.yml new file mode 100644 index 00000000..2c17e0af --- /dev/null +++ b/.github/workflows/php-workshop.yml @@ -0,0 +1,44 @@ +name: PhpWorkshop + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + build: + runs-on: ubuntu-latest + strategy: + matrix: + php: [7.2, 7.3, 7.4] + + name: PHP ${{ matrix.php }} + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + tools: composer:v2 + + - name: Install Dependencies + run: composer update --prefer-dist + + - name: Run phpunit tests + run: | + mkdir -p build/logs + vendor/bin/simple-phpunit --coverage-clover ./build/logs/clover.xml + + - name: Run phpcs + run: composer cs + +# - name: Run phpstan +# run: composer static + + - name: Coverage upload + if: matrix.php == '7.4' + run: bash <(curl -s https://codecov.io/bash) + diff --git a/.gitignore b/.gitignore index c38f66e8..2fce655d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ /vendor /.idea -program.php \ No newline at end of file +program.php +.phpunit.result.cache +/build diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 6d16aaed..00000000 --- a/.travis.yml +++ /dev/null @@ -1,25 +0,0 @@ -language: php - -matrix: - include: - - php: 7.1 - - php: 7.2 - - php: 7.3 - -before_install: - - composer self-update - -install: - - composer update $COMPOSER_FLAGS --prefer-dist --optimize-autoloader - -before_script: - - mkdir -p build/logs - -script: - - ./vendor/bin/phpunit --coverage-clover ./build/logs/clover.xml - - composer cs - -after_script: - - bash <(curl -s https://codecov.io/bash) - - wget https://scrutinizer-ci.com/ocular.phar - - php ocular.phar code-coverage:upload --format=php-clover ./build/logs/clover.xml diff --git a/composer.json b/composer.json index 5b93457a..045f58e7 100644 --- a/composer.json +++ b/composer.json @@ -15,7 +15,7 @@ } ], "require" : { - "php" : ">=7.1", + "php" : ">=7.2", "ext-pdo_sqlite": "*", "php-di/php-di": "^6.0", "container-interop/container-interop": "^1.0", @@ -33,8 +33,8 @@ }, "require-dev": { "composer/composer": "^1.2", - "phpunit/phpunit": "^7", - "squizlabs/php_codesniffer": "^3.4" + "squizlabs/php_codesniffer": "^3.4", + "symfony/phpunit-bridge": "^5.1" }, "autoload" : { "psr-4" : { diff --git a/composer.lock b/composer.lock index 54b9c04d..b65444ed 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": "decd000c63fb363104b8f2a003c04ec0", + "content-hash": "0ea09ae1f35bb06e5b04906b19e16b78", "packages": [ { "name": "aydin-hassan/cli-md-renderer", @@ -1591,1455 +1591,117 @@ "time": "2020-08-19T10:27:58+00:00" }, { - "name": "doctrine/instantiator", - "version": "1.3.1", - "source": { - "type": "git", - "url": "https://github.com/doctrine/instantiator.git", - "reference": "f350df0268e904597e3bd9c4685c53e0e333feea" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/f350df0268e904597e3bd9c4685c53e0e333feea", - "reference": "f350df0268e904597e3bd9c4685c53e0e333feea", - "shasum": "" - }, - "require": { - "php": "^7.1 || ^8.0" - }, - "require-dev": { - "doctrine/coding-standard": "^6.0", - "ext-pdo": "*", - "ext-phar": "*", - "phpbench/phpbench": "^0.13", - "phpstan/phpstan-phpunit": "^0.11", - "phpstan/phpstan-shim": "^0.11", - "phpunit/phpunit": "^7.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.2.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://www.doctrine-project.org/projects/instantiator.html", - "keywords": [ - "constructor", - "instantiate" - ], - "funding": [ - { - "url": "https://www.doctrine-project.org/sponsorship.html", - "type": "custom" - }, - { - "url": "https://www.patreon.com/phpdoctrine", - "type": "patreon" - }, - { - "url": "https://tidelift.com/funding/github/packagist/doctrine%2Finstantiator", - "type": "tidelift" - } - ], - "time": "2020-05-29T17:27:14+00:00" - }, - { - "name": "justinrainbow/json-schema", - "version": "5.2.10", - "source": { - "type": "git", - "url": "https://github.com/justinrainbow/json-schema.git", - "reference": "2ba9c8c862ecd5510ed16c6340aa9f6eadb4f31b" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/justinrainbow/json-schema/zipball/2ba9c8c862ecd5510ed16c6340aa9f6eadb4f31b", - "reference": "2ba9c8c862ecd5510ed16c6340aa9f6eadb4f31b", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "require-dev": { - "friendsofphp/php-cs-fixer": "~2.2.20||~2.15.1", - "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": "2020-05-27T16:41:55+00:00" - }, - { - "name": "myclabs/deep-copy", - "version": "1.10.1", - "source": { - "type": "git", - "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "969b211f9a51aa1f6c01d1d2aef56d3bd91598e5" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/969b211f9a51aa1f6c01d1d2aef56d3bd91598e5", - "reference": "969b211f9a51aa1f6c01d1d2aef56d3bd91598e5", - "shasum": "" - }, - "require": { - "php": "^7.1 || ^8.0" - }, - "replace": { - "myclabs/deep-copy": "self.version" - }, - "require-dev": { - "doctrine/collections": "^1.0", - "doctrine/common": "^2.6", - "phpunit/phpunit": "^7.1" - }, - "type": "library", - "autoload": { - "psr-4": { - "DeepCopy\\": "src/DeepCopy/" - }, - "files": [ - "src/DeepCopy/deep_copy.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "Create deep copies (clones) of your objects", - "keywords": [ - "clone", - "copy", - "duplicate", - "object", - "object graph" - ], - "funding": [ - { - "url": "https://tidelift.com/funding/github/packagist/myclabs/deep-copy", - "type": "tidelift" - } - ], - "time": "2020-06-29T13:22:24+00:00" - }, - { - "name": "phar-io/manifest", - "version": "1.0.3", - "source": { - "type": "git", - "url": "https://github.com/phar-io/manifest.git", - "reference": "7761fcacf03b4d4f16e7ccb606d4879ca431fcf4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phar-io/manifest/zipball/7761fcacf03b4d4f16e7ccb606d4879ca431fcf4", - "reference": "7761fcacf03b4d4f16e7ccb606d4879ca431fcf4", - "shasum": "" - }, - "require": { - "ext-dom": "*", - "ext-phar": "*", - "phar-io/version": "^2.0", - "php": "^5.6 || ^7.0" - }, - "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": "Arne Blankerts", - "email": "arne@blankerts.de", - "role": "Developer" - }, - { - "name": "Sebastian Heuer", - "email": "sebastian@phpeople.de", - "role": "Developer" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "Developer" - } - ], - "description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)", - "time": "2018-07-08T19:23:20+00:00" - }, - { - "name": "phar-io/version", - "version": "2.0.1", - "source": { - "type": "git", - "url": "https://github.com/phar-io/version.git", - "reference": "45a2ec53a73c70ce41d55cedef9063630abaf1b6" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phar-io/version/zipball/45a2ec53a73c70ce41d55cedef9063630abaf1b6", - "reference": "45a2ec53a73c70ce41d55cedef9063630abaf1b6", - "shasum": "" - }, - "require": { - "php": "^5.6 || ^7.0" - }, - "type": "library", - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Arne Blankerts", - "email": "arne@blankerts.de", - "role": "Developer" - }, - { - "name": "Sebastian Heuer", - "email": "sebastian@phpeople.de", - "role": "Developer" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "Developer" - } - ], - "description": "Library for handling version information and constraints", - "time": "2018-07-08T19:19:57+00:00" - }, - { - "name": "phpdocumentor/reflection-common", - "version": "2.2.0", - "source": { - "type": "git", - "url": "https://github.com/phpDocumentor/ReflectionCommon.git", - "reference": "1d01c49d4ed62f25aa84a747ad35d5a16924662b" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/1d01c49d4ed62f25aa84a747ad35d5a16924662b", - "reference": "1d01c49d4ed62f25aa84a747ad35d5a16924662b", - "shasum": "" - }, - "require": { - "php": "^7.2 || ^8.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-2.x": "2.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": "2020-06-27T09:03:43+00:00" - }, - { - "name": "phpdocumentor/reflection-docblock", - "version": "5.2.2", - "source": { - "type": "git", - "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "069a785b2141f5bcf49f3e353548dc1cce6df556" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/069a785b2141f5bcf49f3e353548dc1cce6df556", - "reference": "069a785b2141f5bcf49f3e353548dc1cce6df556", - "shasum": "" - }, - "require": { - "ext-filter": "*", - "php": "^7.2 || ^8.0", - "phpdocumentor/reflection-common": "^2.2", - "phpdocumentor/type-resolver": "^1.3", - "webmozart/assert": "^1.9.1" - }, - "require-dev": { - "mockery/mockery": "~1.3.2" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "5.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" - }, - { - "name": "Jaap van Otterdijk", - "email": "account@ijaap.nl" - } - ], - "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", - "time": "2020-09-03T19:13:55+00:00" - }, - { - "name": "phpdocumentor/type-resolver", - "version": "1.4.0", - "source": { - "type": "git", - "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "6a467b8989322d92aa1c8bf2bebcc6e5c2ba55c0" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/6a467b8989322d92aa1c8bf2bebcc6e5c2ba55c0", - "reference": "6a467b8989322d92aa1c8bf2bebcc6e5c2ba55c0", - "shasum": "" - }, - "require": { - "php": "^7.2 || ^8.0", - "phpdocumentor/reflection-common": "^2.0" - }, - "require-dev": { - "ext-tokenizer": "*" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-1.x": "1.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" - } - ], - "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names", - "time": "2020-09-17T18:55:26+00:00" - }, - { - "name": "phpspec/prophecy", - "version": "1.12.1", - "source": { - "type": "git", - "url": "https://github.com/phpspec/prophecy.git", - "reference": "8ce87516be71aae9b956f81906aaf0338e0d8a2d" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/8ce87516be71aae9b956f81906aaf0338e0d8a2d", - "reference": "8ce87516be71aae9b956f81906aaf0338e0d8a2d", - "shasum": "" - }, - "require": { - "doctrine/instantiator": "^1.2", - "php": "^7.2 || ~8.0, <8.1", - "phpdocumentor/reflection-docblock": "^5.2", - "sebastian/comparator": "^3.0 || ^4.0", - "sebastian/recursion-context": "^3.0 || ^4.0" - }, - "require-dev": { - "phpspec/phpspec": "^6.0", - "phpunit/phpunit": "^8.0 || ^9.0 <9.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.11.x-dev" - } - }, - "autoload": { - "psr-4": { - "Prophecy\\": "src/Prophecy" - } - }, - "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": "2020-09-29T09:10:42+00:00" - }, - { - "name": "phpunit/php-code-coverage", - "version": "6.1.4", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "807e6013b00af69b6c5d9ceb4282d0393dbb9d8d" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/807e6013b00af69b6c5d9ceb4282d0393dbb9d8d", - "reference": "807e6013b00af69b6c5d9ceb4282d0393dbb9d8d", - "shasum": "" - }, - "require": { - "ext-dom": "*", - "ext-xmlwriter": "*", - "php": "^7.1", - "phpunit/php-file-iterator": "^2.0", - "phpunit/php-text-template": "^1.2.1", - "phpunit/php-token-stream": "^3.0", - "sebastian/code-unit-reverse-lookup": "^1.0.1", - "sebastian/environment": "^3.1 || ^4.0", - "sebastian/version": "^2.0.1", - "theseer/tokenizer": "^1.1" - }, - "require-dev": { - "phpunit/phpunit": "^7.0" - }, - "suggest": { - "ext-xdebug": "^2.6.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "6.1-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": "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": "2018-10-31T16:06:48+00:00" - }, - { - "name": "phpunit/php-file-iterator", - "version": "2.0.2", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "050bedf145a257b1ff02746c31894800e5122946" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/050bedf145a257b1ff02746c31894800e5122946", - "reference": "050bedf145a257b1ff02746c31894800e5122946", - "shasum": "" - }, - "require": { - "php": "^7.1" - }, - "require-dev": { - "phpunit/phpunit": "^7.1" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0.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": "FilterIterator implementation that filters files based on a list of suffixes.", - "homepage": "https://github.com/sebastianbergmann/php-file-iterator/", - "keywords": [ - "filesystem", - "iterator" - ], - "time": "2018-09-13T20:33:42+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": "2.1.2", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-timer.git", - "reference": "1038454804406b0b5f5f520358e78c1c2f71501e" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/1038454804406b0b5f5f520358e78c1c2f71501e", - "reference": "1038454804406b0b5f5f520358e78c1c2f71501e", - "shasum": "" - }, - "require": { - "php": "^7.1" - }, - "require-dev": { - "phpunit/phpunit": "^7.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.1-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": "Utility class for timing", - "homepage": "https://github.com/sebastianbergmann/php-timer/", - "keywords": [ - "timer" - ], - "time": "2019-06-07T04:22:29+00:00" - }, - { - "name": "phpunit/php-token-stream", - "version": "3.1.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-token-stream.git", - "reference": "995192df77f63a59e47f025390d2d1fdf8f425ff" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/995192df77f63a59e47f025390d2d1fdf8f425ff", - "reference": "995192df77f63a59e47f025390d2d1fdf8f425ff", - "shasum": "" - }, - "require": { - "ext-tokenizer": "*", - "php": "^7.1" - }, - "require-dev": { - "phpunit/phpunit": "^7.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.1-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" - ], - "abandoned": true, - "time": "2019-09-17T06:23:10+00:00" - }, - { - "name": "phpunit/phpunit", - "version": "7.5.20", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "9467db479d1b0487c99733bb1e7944d32deded2c" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/9467db479d1b0487c99733bb1e7944d32deded2c", - "reference": "9467db479d1b0487c99733bb1e7944d32deded2c", - "shasum": "" - }, - "require": { - "doctrine/instantiator": "^1.1", - "ext-dom": "*", - "ext-json": "*", - "ext-libxml": "*", - "ext-mbstring": "*", - "ext-xml": "*", - "myclabs/deep-copy": "^1.7", - "phar-io/manifest": "^1.0.2", - "phar-io/version": "^2.0", - "php": "^7.1", - "phpspec/prophecy": "^1.7", - "phpunit/php-code-coverage": "^6.0.7", - "phpunit/php-file-iterator": "^2.0.1", - "phpunit/php-text-template": "^1.2.1", - "phpunit/php-timer": "^2.1", - "sebastian/comparator": "^3.0", - "sebastian/diff": "^3.0", - "sebastian/environment": "^4.0", - "sebastian/exporter": "^3.1", - "sebastian/global-state": "^2.0", - "sebastian/object-enumerator": "^3.0.3", - "sebastian/resource-operations": "^2.0", - "sebastian/version": "^2.0.1" - }, - "conflict": { - "phpunit/phpunit-mock-objects": "*" - }, - "require-dev": { - "ext-pdo": "*" - }, - "suggest": { - "ext-soap": "*", - "ext-xdebug": "*", - "phpunit/php-invoker": "^2.0" - }, - "bin": [ - "phpunit" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "7.5-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": "2020-01-08T08:45:45+00:00" - }, - { - "name": "psr/log", - "version": "1.1.3", - "source": { - "type": "git", - "url": "https://github.com/php-fig/log.git", - "reference": "0f73288fd15629204f9d42b7055f72dacbe811fc" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-fig/log/zipball/0f73288fd15629204f9d42b7055f72dacbe811fc", - "reference": "0f73288fd15629204f9d42b7055f72dacbe811fc", - "shasum": "" - }, - "require": { - "php": ">=5.3.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.1.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": "2020-03-23T09:12:05+00:00" - }, - { - "name": "sebastian/code-unit-reverse-lookup", - "version": "1.0.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", - "reference": "4419fcdb5eabb9caa61a27c7a1db532a6b55dd18" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/4419fcdb5eabb9caa61a27c7a1db532a6b55dd18", - "reference": "4419fcdb5eabb9caa61a27c7a1db532a6b55dd18", - "shasum": "" - }, - "require": { - "php": "^5.6 || ^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^5.7 || ^6.0" - }, - "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": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Looks up which function or method a line of code belongs to", - "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", - "time": "2017-03-04T06:30:41+00:00" - }, - { - "name": "sebastian/comparator", - "version": "3.0.2", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "5de4fc177adf9bce8df98d8d141a7559d7ccf6da" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/5de4fc177adf9bce8df98d8d141a7559d7ccf6da", - "reference": "5de4fc177adf9bce8df98d8d141a7559d7ccf6da", - "shasum": "" - }, - "require": { - "php": "^7.1", - "sebastian/diff": "^3.0", - "sebastian/exporter": "^3.1" - }, - "require-dev": { - "phpunit/phpunit": "^7.1" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.0-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": "https://github.com/sebastianbergmann/comparator", - "keywords": [ - "comparator", - "compare", - "equality" - ], - "time": "2018-07-12T15:12:46+00:00" - }, - { - "name": "sebastian/diff", - "version": "3.0.2", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "720fcc7e9b5cf384ea68d9d930d480907a0c1a29" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/720fcc7e9b5cf384ea68d9d930d480907a0c1a29", - "reference": "720fcc7e9b5cf384ea68d9d930d480907a0c1a29", - "shasum": "" - }, - "require": { - "php": "^7.1" - }, - "require-dev": { - "phpunit/phpunit": "^7.5 || ^8.0", - "symfony/process": "^2 || ^3.3 || ^4" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.0-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", - "udiff", - "unidiff", - "unified diff" - ], - "time": "2019-02-04T06:01:07+00:00" - }, - { - "name": "sebastian/environment", - "version": "4.2.3", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "464c90d7bdf5ad4e8a6aea15c091fec0603d4368" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/464c90d7bdf5ad4e8a6aea15c091fec0603d4368", - "reference": "464c90d7bdf5ad4e8a6aea15c091fec0603d4368", - "shasum": "" - }, - "require": { - "php": "^7.1" - }, - "require-dev": { - "phpunit/phpunit": "^7.5" - }, - "suggest": { - "ext-posix": "*" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.2-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": "2019-11-20T08:46:58+00:00" - }, - { - "name": "sebastian/exporter", - "version": "3.1.2", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "68609e1261d215ea5b21b7987539cbfbe156ec3e" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/68609e1261d215ea5b21b7987539cbfbe156ec3e", - "reference": "68609e1261d215ea5b21b7987539cbfbe156ec3e", - "shasum": "" - }, - "require": { - "php": "^7.0", - "sebastian/recursion-context": "^3.0" - }, - "require-dev": { - "ext-mbstring": "*", - "phpunit/phpunit": "^6.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.1.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - }, - { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, - { - "name": "Volker Dusch", - "email": "github@wallbash.com" - }, - { - "name": "Adam Harvey", - "email": "aharvey@php.net" - }, - { - "name": "Bernhard Schussek", - "email": "bschussek@gmail.com" - } - ], - "description": "Provides the functionality to export PHP variables for visualization", - "homepage": "http://www.github.com/sebastianbergmann/exporter", - "keywords": [ - "export", - "exporter" - ], - "time": "2019-09-14T09:02:43+00:00" - }, - { - "name": "sebastian/global-state", - "version": "2.0.0", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4", - "reference": "e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4", - "shasum": "" - }, - "require": { - "php": "^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^6.0" - }, - "suggest": { - "ext-uopz": "*" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.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": "2017-04-27T15:39:26+00:00" - }, - { - "name": "sebastian/object-enumerator", - "version": "3.0.3", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/object-enumerator.git", - "reference": "7cfd9e65d11ffb5af41198476395774d4c8a84c5" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/7cfd9e65d11ffb5af41198476395774d4c8a84c5", - "reference": "7cfd9e65d11ffb5af41198476395774d4c8a84c5", - "shasum": "" - }, - "require": { - "php": "^7.0", - "sebastian/object-reflector": "^1.1.1", - "sebastian/recursion-context": "^3.0" - }, - "require-dev": { - "phpunit/phpunit": "^6.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.0.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Traverses array structures and object graphs to enumerate all referenced objects", - "homepage": "https://github.com/sebastianbergmann/object-enumerator/", - "time": "2017-08-03T12:35:26+00:00" - }, - { - "name": "sebastian/object-reflector", - "version": "1.1.1", + "name": "justinrainbow/json-schema", + "version": "5.2.10", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/object-reflector.git", - "reference": "773f97c67f28de00d397be301821b06708fca0be" + "url": "https://github.com/justinrainbow/json-schema.git", + "reference": "2ba9c8c862ecd5510ed16c6340aa9f6eadb4f31b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/773f97c67f28de00d397be301821b06708fca0be", - "reference": "773f97c67f28de00d397be301821b06708fca0be", + "url": "https://api.github.com/repos/justinrainbow/json-schema/zipball/2ba9c8c862ecd5510ed16c6340aa9f6eadb4f31b", + "reference": "2ba9c8c862ecd5510ed16c6340aa9f6eadb4f31b", "shasum": "" }, "require": { - "php": "^7.0" + "php": ">=5.3.3" }, "require-dev": { - "phpunit/phpunit": "^6.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.1-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] + "friendsofphp/php-cs-fixer": "~2.2.20||~2.15.1", + "json-schema/json-schema-test-suite": "1.2.0", + "phpunit/phpunit": "^4.8.35" }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } + "bin": [ + "bin/validate-json" ], - "description": "Allows reflection of object attributes, including inherited and non-public ones", - "homepage": "https://github.com/sebastianbergmann/object-reflector/", - "time": "2017-03-29T09:07:27+00:00" - }, - { - "name": "sebastian/recursion-context", - "version": "3.0.0", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/recursion-context.git", - "reference": "5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8", - "reference": "5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8", - "shasum": "" - }, - "require": { - "php": "^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^6.0" - }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0.x-dev" + "dev-master": "5.0.x-dev" } }, "autoload": { - "classmap": [ - "src/" - ] + "psr-4": { + "JsonSchema\\": "src/JsonSchema/" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ - "BSD-3-Clause" + "MIT" ], "authors": [ { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" + "name": "Bruno Prieto Reis", + "email": "bruno.p.reis@gmail.com" }, { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" + "name": "Justin Rainbow", + "email": "justin.rainbow@gmail.com" }, { - "name": "Adam Harvey", - "email": "aharvey@php.net" - } - ], - "description": "Provides functionality to recursively process PHP variables", - "homepage": "http://www.github.com/sebastianbergmann/recursion-context", - "time": "2017-03-03T06:23:57+00:00" - }, - { - "name": "sebastian/resource-operations", - "version": "2.0.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/resource-operations.git", - "reference": "4d7a795d35b889bf80a0cc04e08d77cedfa917a9" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/4d7a795d35b889bf80a0cc04e08d77cedfa917a9", - "reference": "4d7a795d35b889bf80a0cc04e08d77cedfa917a9", - "shasum": "" - }, - "require": { - "php": "^7.1" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ + "name": "Igor Wiedler", + "email": "igor@wiedler.ch" + }, { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" + "name": "Robert Schönthal", + "email": "seroscho@googlemail.com" } ], - "description": "Provides a list of PHP built-in functions that operate on resources", - "homepage": "https://www.github.com/sebastianbergmann/resource-operations", - "time": "2018-10-04T04:07:39+00:00" + "description": "A library to validate a json schema.", + "homepage": "https://github.com/justinrainbow/json-schema", + "keywords": [ + "json", + "schema" + ], + "time": "2020-05-27T16:41:55+00:00" }, { - "name": "sebastian/version", - "version": "2.0.1", + "name": "psr/log", + "version": "1.1.3", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/version.git", - "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019" + "url": "https://github.com/php-fig/log.git", + "reference": "0f73288fd15629204f9d42b7055f72dacbe811fc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/99732be0ddb3361e16ad77b68ba41efc8e979019", - "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019", + "url": "https://api.github.com/repos/php-fig/log/zipball/0f73288fd15629204f9d42b7055f72dacbe811fc", + "reference": "0f73288fd15629204f9d42b7055f72dacbe811fc", "shasum": "" }, "require": { - "php": ">=5.6" + "php": ">=5.3.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0.x-dev" + "dev-master": "1.1.x-dev" } }, "autoload": { - "classmap": [ - "src/" - ] + "psr-4": { + "Psr\\Log\\": "Psr/Log/" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ - "BSD-3-Clause" + "MIT" ], "authors": [ { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" } ], - "description": "Library that helps with managing the version number of Git-hosted PHP projects", - "homepage": "https://github.com/sebastianbergmann/version", - "time": "2016-10-03T07:35:21+00:00" + "description": "Common interface for logging libraries", + "homepage": "https://github.com/php-fig/log", + "keywords": [ + "log", + "psr", + "psr-3" + ], + "time": "2020-03-23T09:12:05+00:00" }, { "name": "seld/jsonlint", @@ -3351,6 +2013,88 @@ ], "time": "2020-09-02T16:23:27+00:00" }, + { + "name": "symfony/phpunit-bridge", + "version": "v5.1.7", + "source": { + "type": "git", + "url": "https://github.com/symfony/phpunit-bridge.git", + "reference": "150aeb91dd9dafe13ec8416abd62e435330ca12d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/phpunit-bridge/zipball/150aeb91dd9dafe13ec8416abd62e435330ca12d", + "reference": "150aeb91dd9dafe13ec8416abd62e435330ca12d", + "shasum": "" + }, + "require": { + "php": ">=5.5.9" + }, + "conflict": { + "phpunit/phpunit": "<4.8.35|<5.4.3,>=5.0|<6.4,>=6.0|9.1.2" + }, + "require-dev": { + "symfony/deprecation-contracts": "^2.1" + }, + "suggest": { + "symfony/error-handler": "For tracking deprecated interfaces usages at runtime with DebugClassLoader" + }, + "bin": [ + "bin/simple-phpunit" + ], + "type": "symfony-bridge", + "extra": { + "branch-alias": { + "dev-master": "5.1-dev" + }, + "thanks": { + "name": "phpunit/phpunit", + "url": "https://github.com/sebastianbergmann/phpunit" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Bridge\\PhpUnit\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "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 PHPUnit Bridge", + "homepage": "https://symfony.com", + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2020-10-02T12:57:56+00:00" + }, { "name": "symfony/polyfill-intl-grapheme", "version": "v1.18.1", @@ -3903,101 +2647,6 @@ } ], "time": "2020-09-15T12:23:47+00:00" - }, - { - "name": "theseer/tokenizer", - "version": "1.2.0", - "source": { - "type": "git", - "url": "https://github.com/theseer/tokenizer.git", - "reference": "75a63c33a8577608444246075ea0af0d052e452a" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/theseer/tokenizer/zipball/75a63c33a8577608444246075ea0af0d052e452a", - "reference": "75a63c33a8577608444246075ea0af0d052e452a", - "shasum": "" - }, - "require": { - "ext-dom": "*", - "ext-tokenizer": "*", - "ext-xmlwriter": "*", - "php": "^7.2 || ^8.0" - }, - "type": "library", - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Arne Blankerts", - "email": "arne@blankerts.de", - "role": "Developer" - } - ], - "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", - "funding": [ - { - "url": "https://github.com/theseer", - "type": "github" - } - ], - "time": "2020-07-12T23:59:07+00:00" - }, - { - "name": "webmozart/assert", - "version": "1.9.1", - "source": { - "type": "git", - "url": "https://github.com/webmozart/assert.git", - "reference": "bafc69caeb4d49c39fd0779086c03a3738cbb389" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/webmozart/assert/zipball/bafc69caeb4d49c39fd0779086c03a3738cbb389", - "reference": "bafc69caeb4d49c39fd0779086c03a3738cbb389", - "shasum": "" - }, - "require": { - "php": "^5.3.3 || ^7.0 || ^8.0", - "symfony/polyfill-ctype": "^1.8" - }, - "conflict": { - "phpstan/phpstan": "<0.12.20", - "vimeo/psalm": "<3.9.1" - }, - "require-dev": { - "phpunit/phpunit": "^4.8.36 || ^7.5.13" - }, - "type": "library", - "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": "2020-07-08T17:02:28+00:00" } ], "aliases": [], @@ -4008,7 +2657,7 @@ "prefer-stable": false, "prefer-lowest": false, "platform": { - "php": ">=7.1", + "php": ">=7.2", "ext-pdo_sqlite": "*" }, "platform-dev": [], diff --git a/phpunit.xml b/phpunit.xml index b2a23584..700f6fe2 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -1,12 +1,16 @@ - - - - ./test - - - - ./src - - + + + ./test + + + + ./src + + + + + diff --git a/src/Check/PhpLintCheck.php b/src/Check/PhpLintCheck.php index a2cfe06c..1a6788ca 100644 --- a/src/Check/PhpLintCheck.php +++ b/src/Check/PhpLintCheck.php @@ -34,14 +34,14 @@ public function getName() : string */ public function check(ExerciseInterface $exercise, Input $input) : ResultInterface { - $process = new Process(sprintf('%s -l %s', PHP_BINARY, $input->getArgument('program'))); + $process = new Process([PHP_BINARY, '-l', $input->getArgument('program')]); $process->run(); if ($process->isSuccessful()) { return Success::fromCheck($this); } - return Failure::fromCheckAndReason($this, trim($process->getOutput())); + return Failure::fromCheckAndReason($this, trim($process->getErrorOutput())); } /** diff --git a/src/Event/EventDispatcher.php b/src/Event/EventDispatcher.php index f338bba8..88fd80f5 100644 --- a/src/Event/EventDispatcher.php +++ b/src/Event/EventDispatcher.php @@ -34,7 +34,7 @@ public function __construct(ResultAggregator $resultAggregator) * @param EventInterface $event * @return EventInterface */ - public function dispatch(EventInterface $event) + public function dispatch(EventInterface $event): EventInterface { if (array_key_exists($event->getName(), $this->listeners)) { foreach ($this->listeners[$event->getName()] as $listener) { @@ -52,7 +52,7 @@ public function dispatch(EventInterface $event) * @param string|array $eventNames * @param callable $callback */ - public function listen($eventNames, callable $callback) + public function listen($eventNames, callable $callback): void { if (!is_array($eventNames)) { $eventNames = [$eventNames]; @@ -67,7 +67,7 @@ public function listen($eventNames, callable $callback) * @param string|array $eventName * @param callable $callback */ - private function attachListener($eventName, callable $callback) + private function attachListener($eventName, callable $callback): void { if (!array_key_exists($eventName, $this->listeners)) { $this->listeners[$eventName] = [$callback]; @@ -84,7 +84,7 @@ private function attachListener($eventName, callable $callback) * @param string|array $eventName * @param callable $verifier */ - public function insertVerifier($eventName, callable $verifier) + public function insertVerifier($eventName, callable $verifier): void { $this->attachListener($eventName, function (EventInterface $event) use ($verifier) { $result = $verifier($event); @@ -97,4 +97,12 @@ public function insertVerifier($eventName, callable $verifier) } }); } + + /** + * @return array + */ + public function getListeners(): array + { + return $this->listeners; + } } diff --git a/src/Exercise/TemporaryDirectoryTrait.php b/src/Exercise/TemporaryDirectoryTrait.php index 30834b03..61ee5790 100644 --- a/src/Exercise/TemporaryDirectoryTrait.php +++ b/src/Exercise/TemporaryDirectoryTrait.php @@ -14,7 +14,7 @@ trait TemporaryDirectoryTrait * * @return string The absolute path to the temporary directory. */ - public function getTemporaryPath() + public function getTemporaryPath(): string { return sprintf( '%s/%s', diff --git a/src/ExerciseDispatcher.php b/src/ExerciseDispatcher.php index 8ace34ff..3606ba12 100644 --- a/src/ExerciseDispatcher.php +++ b/src/ExerciseDispatcher.php @@ -221,4 +221,20 @@ public function getEventDispatcher() { return $this->eventDispatcher; } + + /** + * @return SimpleCheckInterface[] + */ + public function getChecksToRunBefore(): array + { + return $this->checksToRunBefore; + } + + /** + * @return SimpleCheckInterface[] + */ + public function getChecksToRunAfter(): array + { + return $this->checksToRunAfter; + } } diff --git a/src/ExerciseRunner/CgiRunner.php b/src/ExerciseRunner/CgiRunner.php index 5f60914d..83bdc687 100644 --- a/src/ExerciseRunner/CgiRunner.php +++ b/src/ExerciseRunner/CgiRunner.php @@ -215,7 +215,7 @@ private function getProcess($fileName, RequestInterface $request) ]; $cgi = sprintf('php-cgi%s', DIRECTORY_SEPARATOR === '\\' ? '.exe' : ''); - $cgiBinary = sprintf( + $cgiBinary = sprintf( '%s -dalways_populate_raw_post_data=-1 -dhtml_errors=0 -dexpose_php=0', realpath(sprintf('%s/%s', str_replace('\\', '/', dirname(PHP_BINARY)), $cgi)) ); @@ -229,7 +229,7 @@ private function getProcess($fileName, RequestInterface $request) $env[sprintf('HTTP_%s', strtoupper($name))] = implode(", ", $values); } - return new Process($cmd, null, $env, null, 10); + return Process::fromShellCommandline($cmd, null, $env, null, 10); } /** diff --git a/src/ExerciseRunner/CliRunner.php b/src/ExerciseRunner/CliRunner.php index cc4b8cd3..42ff9de2 100644 --- a/src/ExerciseRunner/CliRunner.php +++ b/src/ExerciseRunner/CliRunner.php @@ -112,8 +112,13 @@ private function executePhpFile($fileName, ArrayObject $args, $type) */ private function getPhpProcess($fileName, ArrayObject $args) { - $cmd = sprintf('%s %s %s', PHP_BINARY, $fileName, $args->map('escapeshellarg')->implode(' ')); - return new Process($cmd, dirname($fileName), null, null, 10); + return new Process( + $args->prepend($fileName)->prepend(PHP_BINARY)->getArrayCopy(), + dirname($fileName), + null, + null, + 10 + ); } /** diff --git a/src/Factory/MenuFactory.php b/src/Factory/MenuFactory.php index 07e89b7e..4b221538 100644 --- a/src/Factory/MenuFactory.php +++ b/src/Factory/MenuFactory.php @@ -3,6 +3,7 @@ namespace PhpSchool\PhpWorkshop\Factory; use PhpSchool\CliMenu\Style\SelectableStyle; +use PhpSchool\Terminal\Terminal; use Psr\Container\ContainerInterface; use PhpSchool\CliMenu\CliMenu; use PhpSchool\CliMenu\Builder\CliMenuBuilder; @@ -40,7 +41,7 @@ public function __invoke(ContainerInterface $c) $workshopType = $c->get(WorkshopType::class); $eventDispatcher = $c->get(EventDispatcher::class); - $builder = (new CliMenuBuilder) + $builder = (new CliMenuBuilder($c->get(Terminal::class))) ->addLineBreak(); if (null !== $c->get('workshopLogo')) { diff --git a/src/Listener/PrepareSolutionListener.php b/src/Listener/PrepareSolutionListener.php index f8f777ad..58a4aff3 100644 --- a/src/Listener/PrepareSolutionListener.php +++ b/src/Listener/PrepareSolutionListener.php @@ -38,7 +38,7 @@ public function __invoke(ExerciseRunnerEvent $event) if (!file_exists(sprintf('%s/vendor', $solution->getBaseDirectory()))) { $process = new Process( - sprintf('%s install --no-interaction', $this->locateComposer()), + [$this->locateComposer(), 'install', '--no-interaction'], $solution->getBaseDirectory() ); $process->run(); diff --git a/src/Solution/SingleFileSolution.php b/src/Solution/SingleFileSolution.php index eb074cc9..1e01f4c7 100644 --- a/src/Solution/SingleFileSolution.php +++ b/src/Solution/SingleFileSolution.php @@ -54,7 +54,7 @@ public function getEntryPoint() * * @return SolutionFile[] */ - public function getFiles() + public function getFiles(): array { return [$this->file]; } diff --git a/test/Check/CodeParseCheckTest.php b/test/Check/CodeParseCheckTest.php index a995f632..329764fb 100644 --- a/test/Check/CodeParseCheckTest.php +++ b/test/Check/CodeParseCheckTest.php @@ -3,7 +3,6 @@ namespace PhpSchool\PhpWorkshopTest\Check; use PhpParser\ParserFactory; -use PhpSchool\PhpWorkshop\Check\CheckInterface; use PhpSchool\PhpWorkshop\Check\CodeParseCheck; use PhpSchool\PhpWorkshop\Check\SimpleCheckInterface; use PhpSchool\PhpWorkshop\Exercise\ExerciseInterface; @@ -13,11 +12,6 @@ use PhpSchool\PhpWorkshop\Result\Success; use PHPUnit\Framework\TestCase; -/** - * Class CodeParseCheckTest - * @package PhpSchool\PhpWorkshopTest\Check - * @author Aydin Hassan - */ class CodeParseCheckTest extends TestCase { /** @@ -56,7 +50,7 @@ public function testUnParseableCodeReturnsFailure() : void $this->assertInstanceOf(Failure::class, $result); $this->assertEquals('Code Parse Check', $result->getCheckName()); - $this->assertRegExp( + $this->assertMatchesRegularExpression( sprintf('|^File: "%s" could not be parsed\. Error: "|', preg_quote($this->file)), $result->getReason() ); @@ -75,7 +69,7 @@ public function testParseableCodeReturnsSuccess() : void $this->assertEquals('Code Parse Check', $result->getCheckName()); } - public function tearDown() + public function tearDown(): void { unlink($this->file); rmdir(dirname($this->file)); diff --git a/test/Check/PhpLintCheckTest.php b/test/Check/PhpLintCheckTest.php index 737be726..52b255ef 100644 --- a/test/Check/PhpLintCheckTest.php +++ b/test/Check/PhpLintCheckTest.php @@ -11,14 +11,8 @@ use PhpSchool\PhpWorkshop\Result\Failure; use PhpSchool\PhpWorkshop\Result\Success; -/** - * Class PhpLintCheckTest - * @package PhpSchool\PhpWorkshopTest - * @author Aydin Hassan - */ class PhpLintCheckTest extends TestCase { - /** * @var PhpLintCheck */ @@ -29,7 +23,7 @@ class PhpLintCheckTest extends TestCase */ private $exercise; - public function setUp() + public function setUp(): void { $this->check = new PhpLintCheck; $this->exercise = $this->createMock(ExerciseInterface::class); @@ -56,8 +50,8 @@ public function testFailure() : void new Input('app', ['program' => __DIR__ . '/../res/lint/fail.php']) ); $this->assertInstanceOf(Failure::class, $failure); - $this->assertRegExp( - "/^Parse error: syntax error, unexpected end of file, expecting ',' or ';'/", + $this->assertMatchesRegularExpression( + "/(PHP )?Parse error:\W+syntax error, unexpected end of file, expecting '[,;]' or '[;,]'/", $failure->getReason() ); } diff --git a/test/CommandRouterTest.php b/test/CommandRouterTest.php index a05dec68..1b2876bf 100644 --- a/test/CommandRouterTest.php +++ b/test/CommandRouterTest.php @@ -338,22 +338,32 @@ public function testRouteCommandWithOptionalArgument() : void ->setMethods(['__invoke']) ->getMock(); - $mock->expects($this->at(0)) + $mock->expects($this->exactly(3)) ->method('__invoke') - ->with($this->callback(function (Input $input) { - return $input->getAppName() === 'app' - && $input->getArgument('exercise') === 'some-exercise'; - })) - ->willReturn(true); - - $mock->expects($this->at(1)) - ->method('__invoke') - ->with($this->callback(function (Input $input) { - return $input->getAppName() === 'app' - && $input->getArgument('exercise') === 'some-exercise' - && $input->getArgument('program') === 'program.php'; - })) - ->willReturn(true); + ->withConsecutive( + [ + $this->callback(function (Input $input) { + return $input->getAppName() === 'app' + && $input->getArgument('exercise') === 'some-exercise'; + }) + ], + [ + $this->callback(function (Input $input) { + return $input->getAppName() === 'app' + && $input->getArgument('exercise') === 'some-exercise' + && $input->getArgument('program') === 'program.php'; + }) + ], + [ + $this->callback(function (Input $input) { + return $input->getAppName() === 'app' + && $input->getArgument('exercise') === 'some-exercise' + && $input->getArgument('program') === 'program.php' + && $input->getArgument('some-other-arg') === 'some-other-arg-value'; + }) + ] + ) + ->willReturnOnConsecutiveCalls(true, true); $c = $this->createMock(ContainerInterface::class); $eventDispatcher = $this->createMock(EventDispatcher::class); diff --git a/test/Exercise/TemporaryDirectoryTraitTest.php b/test/Exercise/TemporaryDirectoryTraitTest.php index df107465..6c45076c 100644 --- a/test/Exercise/TemporaryDirectoryTraitTest.php +++ b/test/Exercise/TemporaryDirectoryTraitTest.php @@ -16,8 +16,7 @@ public function testGetTemporaryPath() : void { $impl = new TemporaryDirectoryTraitImpl; $path = $impl->getTemporaryPath(); - $this->assertInternalType('string', $path); - + mkdir($path, 0775, true); $this->assertFileExists($path); rmdir($path); diff --git a/test/ExerciseDispatcherTest.php b/test/ExerciseDispatcherTest.php index dcd9c709..7743cbc3 100644 --- a/test/ExerciseDispatcherTest.php +++ b/test/ExerciseDispatcherTest.php @@ -26,11 +26,6 @@ use RuntimeException; use Symfony\Component\Filesystem\Filesystem; -/** - * Class ExerciseDispatcherTest - * @package PhpSchool\PhpWorkshopTest - * @author Aydin Hassan - */ class ExerciseDispatcherTest extends TestCase { /** @@ -73,7 +68,7 @@ public function testRequireCheckThrowsExceptionIfCheckDoesNotExist() : void $exerciseDispatcher = new ExerciseDispatcher( $this->prophesize(RunnerManager::class)->reveal(), new ResultAggregator, - $this->prophesize(EventDispatcher::class)->reveal(), + new EventDispatcher(new ResultAggregator()), new CheckRepository ); $exerciseDispatcher->requireCheck('NotACheck'); @@ -90,7 +85,7 @@ public function testRequireCheckThrowsExceptionIfPositionNotValid() : void $exerciseDispatcher = new ExerciseDispatcher( $this->prophesize(RunnerManager::class)->reveal(), new ResultAggregator, - $this->prophesize(EventDispatcher::class)->reveal(), + new EventDispatcher(new ResultAggregator()), new CheckRepository([$check]) ); @@ -110,13 +105,12 @@ public function testRequireBeforeCheckIsCorrectlyRegistered() : void $exerciseDispatcher = new ExerciseDispatcher( $this->prophesize(RunnerManager::class)->reveal(), new ResultAggregator, - $this->prophesize(EventDispatcher::class)->reveal(), + new EventDispatcher(new ResultAggregator()), new CheckRepository([$check]) ); $exerciseDispatcher->requireCheck(get_class($check)); - $checksToRunBefore = $this->readAttribute($exerciseDispatcher, 'checksToRunBefore'); - $this->assertEquals([$check], $checksToRunBefore); + $this->assertEquals([$check], $exerciseDispatcher->getChecksToRunBefore()); } public function testRequireAfterCheckIsCorrectlyRegistered() : void @@ -130,13 +124,12 @@ public function testRequireAfterCheckIsCorrectlyRegistered() : void $exerciseDispatcher = new ExerciseDispatcher( $this->prophesize(RunnerManager::class)->reveal(), new ResultAggregator, - $this->prophesize(EventDispatcher::class)->reveal(), + new EventDispatcher(new ResultAggregator()), new CheckRepository([$check]) ); $exerciseDispatcher->requireCheck(get_class($check)); - $checksToRunBefore = $this->readAttribute($exerciseDispatcher, 'checksToRunAfter'); - $this->assertEquals([$check], $checksToRunBefore); + $this->assertEquals([$check], $exerciseDispatcher->getChecksToRunAfter()); } public function testRequireCheckThrowsExceptionIfCheckIsNotSimpleOrListenable() : void @@ -149,7 +142,7 @@ public function testRequireCheckThrowsExceptionIfCheckIsNotSimpleOrListenable() $exerciseDispatcher = new ExerciseDispatcher( $this->prophesize(RunnerManager::class)->reveal(), new ResultAggregator, - $this->prophesize(EventDispatcher::class)->reveal(), + new EventDispatcher(new ResultAggregator()), new CheckRepository([$check]) ); @@ -194,7 +187,7 @@ public function testVerifyThrowsExceptionIfCheckDoesNotSupportExerciseType() : v $exerciseDispatcher = new ExerciseDispatcher( $runnerManager->reveal(), new ResultAggregator, - $this->prophesize(EventDispatcher::class)->reveal(), + new EventDispatcher(new ResultAggregator()), new CheckRepository([$check]) ); @@ -224,7 +217,7 @@ public function testVerifyThrowsExceptionIfExerciseDoesNotImplementCorrectInterf $exerciseDispatcher = new ExerciseDispatcher( $runnerManager->reveal(), new ResultAggregator, - $this->prophesize(EventDispatcher::class)->reveal(), + new EventDispatcher(new ResultAggregator()), new CheckRepository([$check]) ); @@ -257,7 +250,7 @@ public function testVerify() : void $exerciseDispatcher = new ExerciseDispatcher( $runnerManager->reveal(), new ResultAggregator, - $this->prophesize(EventDispatcher::class)->reveal(), + new EventDispatcher(new ResultAggregator()), new CheckRepository([$check]) ); @@ -361,7 +354,7 @@ public function testVerifyWithBeforeAndAfterRequiredChecks() : void $exerciseDispatcher = new ExerciseDispatcher( $runnerManager->reveal(), new ResultAggregator, - $this->prophesize(EventDispatcher::class)->reveal(), + new EventDispatcher(new ResultAggregator()), new CheckRepository([$check1, $check2]) ); @@ -555,14 +548,14 @@ public function testRun() : void $exerciseDispatcher = new ExerciseDispatcher( $runnerManager->reveal(), new ResultAggregator, - $this->prophesize(EventDispatcher::class)->reveal(), + new EventDispatcher(new ResultAggregator()), new CheckRepository() ); $this->assertTrue($exerciseDispatcher->run($exercise, $input, $output)); } - public function tearDown() + public function tearDown(): void { $this->filesystem->remove(dirname($this->file)); } diff --git a/test/ExerciseRunner/CgiRunnerTest.php b/test/ExerciseRunner/CgiRunnerTest.php index 770c5b09..4985184e 100644 --- a/test/ExerciseRunner/CgiRunnerTest.php +++ b/test/ExerciseRunner/CgiRunnerTest.php @@ -80,7 +80,7 @@ public function testVerifyThrowsExceptionIfSolutionFailsExecution() : void $regex = "/^PHP Code failed to execute\. Error: \"PHP Parse error: syntax error, unexpected end of file in/"; $this->expectException(SolutionExecutionException::class); - $this->expectExceptionMessageRegExp($regex); + $this->expectExceptionMessageMatches($regex); $this->runner->verify(new Input('app', ['program' => ''])); } @@ -193,7 +193,7 @@ public function testVerifyReturnsFailureIfUserSolutionFailsToExecute() : void $failureMsg = '/^PHP Code failed to execute. Error: "PHP Parse error: syntax error, unexpected end of file'; $failureMsg .= ' in/'; - $this->assertRegExp($failureMsg, $result->getReason()); + $this->assertMatchesRegularExpression($failureMsg, $result->getReason()); } public function testVerifyReturnsFailureIfSolutionOutputDoesNotMatchUserOutput() : void diff --git a/test/ExerciseRunner/CliRunnerTest.php b/test/ExerciseRunner/CliRunnerTest.php index cc9eb356..ca35d4f9 100644 --- a/test/ExerciseRunner/CliRunnerTest.php +++ b/test/ExerciseRunner/CliRunnerTest.php @@ -79,9 +79,9 @@ public function testVerifyThrowsExceptionIfSolutionFailsExecution() : void ->willReturn([[]]); $regex = "/^PHP Code failed to execute\\. Error: \"PHP Parse error: syntax error, unexpected end of file"; - $regex .= ", expecting ',' or ';'/"; + $regex .= ", expecting '[,;]' or '[;,]'/"; $this->expectException(SolutionExecutionException::class); - $this->expectExceptionMessageRegExp($regex); + $this->expectExceptionMessageMatches($regex); $this->runner->verify(new Input('app', ['program' => ''])); } @@ -143,14 +143,14 @@ public function testVerifyReturnsFailureIfUserSolutionFailsToExecute() : void $failure = $this->runner->verify(new Input('app', ['program' => __DIR__ . '/../res/cli/user-error.php'])); $failureMsg = '/^PHP Code failed to execute. Error: "PHP Parse error: syntax error, '; - $failureMsg .= "unexpected end of file, expecting ',' or ';'/"; + $failureMsg .= "unexpected end of file, expecting '[,;]' or '[;,]'/"; $this->assertInstanceOf(CliResult::class, $failure); $this->assertCount(1, $failure); $result = iterator_to_array($failure)[0]; $this->assertInstanceOf(GenericFailure::class, $result); - $this->assertRegExp($failureMsg, $result->getReason()); + $this->assertMatchesRegularExpression($failureMsg, $result->getReason()); } public function testVerifyReturnsFailureIfSolutionOutputDoesNotMatchUserOutput() : void @@ -215,7 +215,9 @@ public function testRunPassesOutputAndReturnsFailureIfScriptFails() : void ->method('getArgs') ->willReturn([[1, 2, 3]]); - $this->expectOutputRegex('/Parse error: syntax error, unexpected end of file, expecting \',\' or \';\' /'); + $this->expectOutputRegex( + '/(PHP )?Parse error:\W+syntax error, unexpected end of file, expecting \'[,;]\' or \'[;,]\' /' + ); $success = $this->runner->run(new Input('app', ['program' => __DIR__ . '/../res/cli/user-error.php']), $output); $this->assertFalse($success); diff --git a/test/ExerciseRunner/Factory/CgiRunnerFactoryTest.php b/test/ExerciseRunner/Factory/CgiRunnerFactoryTest.php index bb0811ee..fe9c156c 100644 --- a/test/ExerciseRunner/Factory/CgiRunnerFactoryTest.php +++ b/test/ExerciseRunner/Factory/CgiRunnerFactoryTest.php @@ -12,9 +12,6 @@ use PhpSchool\PhpWorkshopTest\Asset\CgiExerciseImpl; use PHPUnit\Framework\TestCase; -/** - * @author Aydin Hassan - */ class CgiRunnerFactoryTest extends TestCase { /** @@ -27,7 +24,7 @@ class CgiRunnerFactoryTest extends TestCase */ private $factory; - public function setUp() + public function setUp(): void { $this->eventDispatcher = $this->createMock(EventDispatcher::class); $this->factory = new CgiRunnerFactory($this->eventDispatcher, new RequestRenderer); diff --git a/test/ExerciseRunner/Factory/CliRunnerFactoryTest.php b/test/ExerciseRunner/Factory/CliRunnerFactoryTest.php index 178d49d8..1455d164 100644 --- a/test/ExerciseRunner/Factory/CliRunnerFactoryTest.php +++ b/test/ExerciseRunner/Factory/CliRunnerFactoryTest.php @@ -11,9 +11,6 @@ use PhpSchool\PhpWorkshopTest\Asset\CliExerciseImpl; use PHPUnit\Framework\TestCase; -/** - * @author Aydin Hassan - */ class CliRunnerFactoryTest extends TestCase { /** @@ -26,7 +23,7 @@ class CliRunnerFactoryTest extends TestCase */ private $factory; - public function setUp() + public function setUp(): void { $this->eventDispatcher = $this->createMock(EventDispatcher::class); $this->factory = new CliRunnerFactory($this->eventDispatcher); diff --git a/test/ExerciseRunner/Factory/CustomVerifyingRunnerFactoryTest.php b/test/ExerciseRunner/Factory/CustomVerifyingRunnerFactoryTest.php index 5b91c3ea..7cc935c4 100644 --- a/test/ExerciseRunner/Factory/CustomVerifyingRunnerFactoryTest.php +++ b/test/ExerciseRunner/Factory/CustomVerifyingRunnerFactoryTest.php @@ -10,9 +10,6 @@ use PhpSchool\PhpWorkshopTest\Asset\CustomVerifyingExerciseImpl; use PHPUnit\Framework\TestCase; -/** - * @author Aydin Hassan - */ class CustomVerifyingRunnerFactoryTest extends TestCase { /** @@ -20,7 +17,7 @@ class CustomVerifyingRunnerFactoryTest extends TestCase */ private $factory; - public function setUp() + public function setUp(): void { $this->factory = new CustomVerifyingRunnerFactory; } diff --git a/test/Factory/EventDispatcherFactoryTest.php b/test/Factory/EventDispatcherFactoryTest.php index beed25a2..d261b501 100644 --- a/test/Factory/EventDispatcherFactoryTest.php +++ b/test/Factory/EventDispatcherFactoryTest.php @@ -19,7 +19,6 @@ */ class EventDispatcherFactoryTest extends TestCase { - public function testCreateWithNoConfig() : void { $c = $this->prophesize(ContainerInterface::class); @@ -28,7 +27,7 @@ public function testCreateWithNoConfig() : void $dispatcher = (new EventDispatcherFactory)->__invoke($c->reveal()); $this->assertInstanceOf(EventDispatcher::class, $dispatcher); - $this->assertSame([], $this->readAttribute($dispatcher, 'listeners')); + $this->assertSame([], $dispatcher->getListeners()); } public function testExceptionIsThrownIfEventListenerGroupsNotArray() : void @@ -140,7 +139,7 @@ public function testConfigEventListenersWithAnonymousFunction() : void $callback ] ], - $this->readAttribute($dispatcher, 'listeners') + $dispatcher->getListeners() ); } @@ -162,7 +161,7 @@ public function testListenerFromContainerIsNotFetchedDuringAttaching() : void $dispatcher = (new EventDispatcherFactory)->__invoke($c->reveal()); $this->assertInstanceOf(EventDispatcher::class, $dispatcher); - $this->assertArrayHasKey('someEvent', $this->readAttribute($dispatcher, 'listeners')); + $this->assertArrayHasKey('someEvent', $dispatcher->getListeners()); $c->get('containerEntry')->shouldNotHaveBeenCalled(); } @@ -186,7 +185,7 @@ public function testListenerFromContainerIsFetchedWhenEventDispatched() : void $dispatcher = (new EventDispatcherFactory)->__invoke($c->reveal()); $this->assertInstanceOf(EventDispatcher::class, $dispatcher); - $this->assertArrayHasKey('someEvent', $this->readAttribute($dispatcher, 'listeners')); + $this->assertArrayHasKey('someEvent', $dispatcher->getListeners()); $dispatcher->dispatch(new Event('someEvent')); } @@ -225,7 +224,7 @@ public function testDefaultListenersAreRegisteredFromConfig() : void $dispatcher = (new EventDispatcherFactory)->__invoke($container); - $listeners = $this->readAttribute($dispatcher, 'listeners'); + $listeners = $dispatcher->getListeners(); $this->assertArrayHasKey('cli.verify.start', $listeners); $this->assertArrayHasKey('cli.run.start', $listeners); diff --git a/test/Factory/MenuFactoryTest.php b/test/Factory/MenuFactoryTest.php index a1359f18..01d7bf9b 100644 --- a/test/Factory/MenuFactoryTest.php +++ b/test/Factory/MenuFactoryTest.php @@ -15,6 +15,7 @@ use PhpSchool\PhpWorkshop\UserState; use PhpSchool\PhpWorkshop\UserStateSerializer; use PhpSchool\PhpWorkshop\WorkshopType; +use PhpSchool\Terminal\Terminal; use PHPUnit\Framework\TestCase; /** @@ -42,6 +43,11 @@ public function testFactoryReturnsInstance() : void ->expects($this->once()) ->method('findAll') ->willReturn([$exercise]); + + $terminal = $this->createMock(Terminal::class); + $terminal + ->method('getWidth') + ->willReturn(70); $services = [ UserStateSerializer::class => $userStateSerializer, @@ -56,6 +62,7 @@ public function testFactoryReturnsInstance() : void 'workshopTitle' => 'TITLE', WorkshopType::class => WorkshopType::STANDARD(), EventDispatcher::class => $this->createMock(EventDispatcher::class), + Terminal::class => $terminal ]; $container diff --git a/test/Factory/ResultRendererFactoryTest.php b/test/Factory/ResultRendererFactoryTest.php index 5b8ab2e5..9a6ef4a0 100644 --- a/test/Factory/ResultRendererFactoryTest.php +++ b/test/Factory/ResultRendererFactoryTest.php @@ -16,11 +16,10 @@ */ class ResultRendererFactoryTest extends TestCase { - /** - * @expectedException InvalidArgumentException - */ public function testRegisterRendererRequiresResultInterface() : void { + $this->expectException(InvalidArgumentException::class); + $resultClass = get_class($this->createMock(TestCase::class)); $rendererClass = get_class($this->createMock(ResultRendererInterface::class)); $factory = new ResultRendererFactory(); @@ -28,11 +27,10 @@ public function testRegisterRendererRequiresResultInterface() : void $factory->registerRenderer($resultClass, $rendererClass); } - /** - * @expectedException InvalidArgumentException - */ public function testRegisterRendererRequiresResultRendererInterface() : void { + $this->expectException(InvalidArgumentException::class); + $resultClass = get_class($this->createMock(ResultInterface::class)); $rendererClass = get_class($this->createMock(TestCase::class)); $factory = new ResultRendererFactory(); @@ -40,11 +38,10 @@ public function testRegisterRendererRequiresResultRendererInterface() : void $factory->registerRenderer($resultClass, $rendererClass); } - /** - * @expectedException InvalidArgumentException - */ public function testRegisterRendererRequiresResultClassToBeString() : void { + $this->expectException(InvalidArgumentException::class); + $resultClass = $this->createMock(ResultInterface::class); $rendererClass = get_class($this->createMock(ResultRendererInterface::class)); $factory = new ResultRendererFactory(); @@ -52,11 +49,10 @@ public function testRegisterRendererRequiresResultClassToBeString() : void $factory->registerRenderer($resultClass, $rendererClass); } - /** - * @expectedException InvalidArgumentException - */ public function testRegisterRendererRequiresRendererClassToBeString() : void { + $this->expectException(InvalidArgumentException::class); + $resultClass = get_class($this->createMock(ResultInterface::class)); $rendererClass = $this->createMock(ResultRendererInterface::class); $factory = new ResultRendererFactory(); @@ -64,11 +60,10 @@ public function testRegisterRendererRequiresRendererClassToBeString() : void $factory->registerRenderer($resultClass, $rendererClass); } - /** - * @expectedException RuntimeException - */ public function testCreateRequiresMappingToClassName() : void { + $this->expectException(RuntimeException::class); + $resultClass = $this->createMock(ResultInterface::class); $factory = new ResultRendererFactory(); diff --git a/test/FunctionsTest.php b/test/FunctionsTest.php index b62f9202..a9ded71d 100644 --- a/test/FunctionsTest.php +++ b/test/FunctionsTest.php @@ -12,7 +12,7 @@ class FunctionsTest extends TestCase /** * @dataProvider mbStrPadProvider */ - public function testMbStrPad(string $string, string $pad, string $expected) : void + public function testMbStrPad(string $string, int $pad, string $expected) : void { self::assertSame(mb_str_pad($string, $pad), $expected); } diff --git a/test/Listener/PrepareSolutionListenerTest.php b/test/Listener/PrepareSolutionListenerTest.php index 4e954b80..9cf23e16 100644 --- a/test/Listener/PrepareSolutionListenerTest.php +++ b/test/Listener/PrepareSolutionListenerTest.php @@ -8,6 +8,7 @@ use PhpSchool\PhpWorkshop\Input\Input; use PhpSchool\PhpWorkshop\Listener\PrepareSolutionListener; use PhpSchool\PhpWorkshop\Solution\SolutionInterface; +use PhpSchool\PhpWorkshopTest\Asset\CliExerciseInterface; use PHPUnit\Framework\TestCase; use ReflectionProperty; use RuntimeException; @@ -52,7 +53,7 @@ public function testIfSolutionRequiresComposerButComposerCannotBeLocatedExceptio $refProp->setValue($this->listener, []); $solution = $this->createMock(SolutionInterface::class); - $exercise = $this->createMock([ExerciseInterface::class, CliExercise::class]); + $exercise = $this->createMock(CliExerciseInterface::class); $exercise ->method('getSolution') ->willReturn($solution); @@ -74,7 +75,7 @@ public function testIfSolutionRequiresComposerButVendorDirExistsNothingIsDone() $this->assertFileExists(sprintf('%s/vendor', dirname($this->file))); $solution = $this->createMock(SolutionInterface::class); - $exercise = $this->createMock([ExerciseInterface::class, CliExercise::class]); + $exercise = $this->createMock(CliExerciseInterface::class); $exercise ->method('getSolution') ->willReturn($solution); @@ -93,12 +94,12 @@ public function testIfSolutionRequiresComposerButVendorDirExistsNothingIsDone() $this->assertFileExists(sprintf('%s/vendor', dirname($this->file))); //check for non existence of lock file, composer generates this when updating if it doesn't exist - $this->assertFileNotExists(sprintf('%s/composer.lock', dirname($this->file))); + $this->assertFileDoesNotExist(sprintf('%s/composer.lock', dirname($this->file))); } public function testIfSolutionRequiresComposerComposerInstallIsExecuted() : void { - $this->assertFileNotExists(sprintf('%s/vendor', dirname($this->file))); + $this->assertFileDoesNotExist(sprintf('%s/vendor', dirname($this->file))); file_put_contents(sprintf('%s/composer.json', dirname($this->file)), json_encode([ 'requires' => [ 'phpunit/phpunit' => '~5.0' @@ -106,7 +107,7 @@ public function testIfSolutionRequiresComposerComposerInstallIsExecuted() : void ])); $solution = $this->createMock(SolutionInterface::class); - $exercise = $this->createMock([ExerciseInterface::class, CliExercise::class]); + $exercise = $this->createMock(CliExerciseInterface::class); $exercise ->method('getSolution') ->willReturn($solution); diff --git a/test/Output/StdOutputTest.php b/test/Output/StdOutputTest.php index 22105b0e..55a70e56 100644 --- a/test/Output/StdOutputTest.php +++ b/test/Output/StdOutputTest.php @@ -7,11 +7,6 @@ use PHPUnit\Framework\TestCase; use PhpSchool\PhpWorkshop\Output\StdOutput; -/** - * Class StdOutputTest - * @package PhpSchool\PhpWorkshopTest - * @author Aydin Hassan - */ class StdOutputTest extends TestCase { /** @@ -24,7 +19,7 @@ class StdOutputTest extends TestCase */ private $output; - public function setUp() + public function setUp(): void { $this->color = new Color(); $this->color->setForceStyle(true); diff --git a/test/ResultRenderer/FailureRendererTest.php b/test/ResultRenderer/FailureRendererTest.php index 9b1c8b99..3721a79b 100644 --- a/test/ResultRenderer/FailureRendererTest.php +++ b/test/ResultRenderer/FailureRendererTest.php @@ -2,11 +2,8 @@ namespace PhpSchool\PhpWorkshopTest\ResultRenderer; -use Colors\Color; -use InvalidArgumentException; use PhpSchool\PhpWorkshop\Check\CheckInterface; use PhpSchool\PhpWorkshop\Result\Failure; -use PhpSchool\PhpWorkshop\Result\ResultInterface; use PhpSchool\PhpWorkshop\ResultRenderer\FailureRenderer; /** diff --git a/test/ResultRenderer/ResultsRendererTest.php b/test/ResultRenderer/ResultsRendererTest.php index dc4011da..ef341190 100644 --- a/test/ResultRenderer/ResultsRendererTest.php +++ b/test/ResultRenderer/ResultsRendererTest.php @@ -29,7 +29,6 @@ */ class ResultsRendererTest extends TestCase { - public function testRenderIndividualResult() : void { $color = new Color; diff --git a/test/Solution/SingleFileSolutionTest.php b/test/Solution/SingleFileSolutionTest.php index 94006e94..0049f2bc 100644 --- a/test/Solution/SingleFileSolutionTest.php +++ b/test/Solution/SingleFileSolutionTest.php @@ -25,7 +25,6 @@ public function testGetters() : void $this->assertSame($filePath, $solution->getEntryPoint()); $this->assertSame($tempPath, $solution->getBaseDirectory()); $this->assertFalse($solution->hasComposerFile()); - $this->assertInternalType('array', $solution->getFiles()); $this->assertCount(1, $solution->getFiles()); $this->assertSame($filePath, $solution->getFiles()[0]->__toString()); unlink($filePath); diff --git a/test/UserStateSerializerTest.php b/test/UserStateSerializerTest.php index 864be92a..36dcf436 100644 --- a/test/UserStateSerializerTest.php +++ b/test/UserStateSerializerTest.php @@ -45,7 +45,7 @@ public function setUp() : void public function testIfDirNotExistsItIsCreated() : void { - $this->assertFileNotExists($this->tmpDir); + $this->assertFileDoesNotExist($this->tmpDir); new UserStateSerializer($this->tmpDir, $this->workshopName, $this->exerciseRepository); $this->assertFileExists($this->tmpDir); } @@ -226,7 +226,7 @@ public function testOldDataWillBeMigratedWhenInCorrectWorkshop() : void ], ]; - $this->assertFileNotExists($oldSave); + $this->assertFileDoesNotExist($oldSave); $this->assertFileExists($newSave); $this->assertEquals($expected, json_decode(file_get_contents($newSave), true)); } @@ -265,7 +265,7 @@ public function testOldDataWillNotBeMigratedWhenNotInCorrectWorkshop() : void $this->assertFileExists($oldSave); $this->assertEquals($oldData, json_decode(file_get_contents($oldSave), true)); - $this->assertFileNotExists($newSave); + $this->assertFileDoesNotExist($newSave); unlink($oldSave); } diff --git a/test/bootstrap.php b/test/bootstrap.php new file mode 100644 index 00000000..6c8c4f51 --- /dev/null +++ b/test/bootstrap.php @@ -0,0 +1,3 @@ +