diff --git a/.travis.yml b/.travis.yml index dbae49d6..6d16aaed 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,12 +2,9 @@ language: php matrix: include: - - php: 5.6 - env: COMPOSER_FLAGS="--prefer-lowest" - - php: 5.6 - - php: 7.0 - php: 7.1 - php: 7.2 + - php: 7.3 before_install: - composer self-update diff --git a/app/config.php b/app/config.php index 080f5de7..2c5fb252 100644 --- a/app/config.php +++ b/app/config.php @@ -1,16 +1,16 @@ get(CheckRepository::class) ); }, - ResultAggregator::class => object(ResultAggregator::class), + ResultAggregator::class => create(ResultAggregator::class), CheckRepository::class => function (ContainerInterface $c) { return new CheckRepository([ $c->get(FileExistsCheck::class), @@ -123,7 +123,7 @@ return $colors; }, OutputInterface::class => function (ContainerInterface $c) { - return new StdOutput($c->get(Color::class), $c->get(TerminalInterface::class)); + return new StdOutput($c->get(Color::class), $c->get(Terminal::class)); }, ExerciseRepository::class => function (ContainerInterface $c) { @@ -135,7 +135,7 @@ }, EventDispatcher::class => factory(EventDispatcherFactory::class), - EventDispatcherFactory::class => object(), + EventDispatcherFactory::class => create(), //Exercise Runners RunnerManager::class => function (ContainerInterface $c) { @@ -199,7 +199,7 @@ }, //Listeners - PrepareSolutionListener::class => object(), + PrepareSolutionListener::class => create(), CodePatchListener::class => function (ContainerInterface $c) { return new CodePatchListener($c->get(CodePatcher::class)); }, @@ -216,22 +216,22 @@ $c->get(RunnerManager::class) ); }, - RealPathListener::class => object(), + RealPathListener::class => create(), //checks - FileExistsCheck::class => object(), - PhpLintCheck::class => object(), + FileExistsCheck::class => create(), + PhpLintCheck::class => create(), CodeParseCheck::class => function (ContainerInterface $c) { return new CodeParseCheck($c->get(Parser::class)); }, FunctionRequirementsCheck::class => function (ContainerInterface $c) { return new FunctionRequirementsCheck($c->get(Parser::class)); }, - DatabaseCheck::class => object(), - ComposerCheck::class => object(), + DatabaseCheck::class => create(), + ComposerCheck::class => create(), //Utils - Filesystem::class => object(), + Filesystem::class => create(), Parser::class => function () { $parserFactory = new ParserFactory; return $parserFactory->create(ParserFactory::PREFER_PHP7); @@ -247,11 +247,11 @@ FakerGenerator::class => function () { return FakerFactory::create(); }, - RequestRenderer::class => object(), + RequestRenderer::class => create(), - TerminalInterface::class => factory([TerminalFactory::class, 'fromSystem']), + Terminal::class => factory([TerminalFactory::class, 'fromSystem']), 'menu' => factory(MenuFactory::class), - MenuFactory::class => object(), + MenuFactory::class => create(), ExerciseRenderer::class => function (ContainerInterface $c) { return new ExerciseRenderer( $c->get('appName'), @@ -307,7 +307,7 @@ function (CgiResult $result) use ($c) { return new ResultsRenderer( $c->get('appName'), $c->get(Color::class), - $c->get(TerminalInterface::class), + $c->get(Terminal::class), $c->get(ExerciseRepository::class), $c->get(KeyLighter::class), $c->get(ResultRendererFactory::class) diff --git a/composer.json b/composer.json index b99a5e6d..5b93457a 100644 --- a/composer.json +++ b/composer.json @@ -15,27 +15,26 @@ } ], "require" : { - "php" : ">=5.6", + "php" : ">=7.1", "ext-pdo_sqlite": "*", - "php-di/php-di": "^5.0", + "php-di/php-di": "^6.0", "container-interop/container-interop": "^1.0", - "symfony/process": "^3.0", - "symfony/filesystem": "^3.0", + "symfony/process": "^3.0 | ^4.0", + "symfony/filesystem": "^3.0 | ^4.0", "fzaninotto/faker": "^1.5", "aydin-hassan/cli-md-renderer": "^2.3", - "php-school/cli-menu": "^2.0", - "beberlei/assert": "^2.4", + "php-school/cli-menu": "dev-master", + "beberlei/assert": "^3.2", "psr/http-message": "^1.0", - "zendframework/zend-diactoros": "^1.3.6", + "zendframework/zend-diactoros": "^2.1", "myclabs/php-enum": "^1.4", "kadet/keylighter": "^0.8.3", - "nikic/php-parser": "^3.0" + "nikic/php-parser": "^4.0" }, "require-dev": { "composer/composer": "^1.2", - "phpunit/phpunit": "^5.7.2", - "phpunit/phpunit-mock-objects": "^3.3", - "squizlabs/php_codesniffer": "^2.4" + "phpunit/phpunit": "^7", + "squizlabs/php_codesniffer": "^3.4" }, "autoload" : { "psr-4" : { diff --git a/composer.lock b/composer.lock index 14f0b055..54b9c04d 100644 --- a/composer.lock +++ b/composer.lock @@ -1,10 +1,10 @@ { "_readme": [ "This file locks the dependencies of your project to a known state", - "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "c0214403d501d53a934831a0cb42e721", + "content-hash": "decd000c63fb363104b8f2a003c04ec0", "packages": [ { "name": "aydin-hassan/cli-md-renderer", @@ -51,25 +51,32 @@ }, { "name": "beberlei/assert", - "version": "v2.9.2", + "version": "v3.2.7", "source": { "type": "git", "url": "https://github.com/beberlei/assert.git", - "reference": "2d555f72f3f4ff9e72a7bc17cb8a53c86737c8a0" + "reference": "d63a6943fc4fd1a2aedb65994e3548715105abcf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/beberlei/assert/zipball/2d555f72f3f4ff9e72a7bc17cb8a53c86737c8a0", - "reference": "2d555f72f3f4ff9e72a7bc17cb8a53c86737c8a0", + "url": "https://api.github.com/repos/beberlei/assert/zipball/d63a6943fc4fd1a2aedb65994e3548715105abcf", + "reference": "d63a6943fc4fd1a2aedb65994e3548715105abcf", "shasum": "" }, "require": { + "ext-ctype": "*", + "ext-json": "*", "ext-mbstring": "*", - "php": ">=5.3" + "ext-simplexml": "*", + "php": "^7" }, "require-dev": { - "friendsofphp/php-cs-fixer": "^2.1.1", - "phpunit/phpunit": "^4.8.35|^5.7" + "friendsofphp/php-cs-fixer": "*", + "phpstan/phpstan-shim": "*", + "phpunit/phpunit": ">=6.0.0 <8" + }, + "suggest": { + "ext-intl": "Needed to allow Assertion::count(), Assertion::isCountable(), Assertion::minCount(), and Assertion::maxCount() to operate on ResourceBundles" }, "type": "library", "autoload": { @@ -102,7 +109,7 @@ "assertion", "validation" ], - "time": "2018-01-25T13:33:16+00:00" + "time": "2019-12-19T17:51:41+00:00" }, { "name": "container-interop/container-interop", @@ -133,20 +140,21 @@ ], "description": "Promoting the interoperability of container objects (DIC, SL, etc.)", "homepage": "https://github.com/container-interop/container-interop", + "abandoned": "psr/container", "time": "2017-02-14T19:40:03+00:00" }, { "name": "fzaninotto/faker", - "version": "v1.7.1", + "version": "v1.9.1", "source": { "type": "git", "url": "https://github.com/fzaninotto/Faker.git", - "reference": "d3ed4cc37051c1ca52d22d76b437d14809fc7e0d" + "reference": "fc10d778e4b84d5bd315dad194661e091d307c6f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/fzaninotto/Faker/zipball/d3ed4cc37051c1ca52d22d76b437d14809fc7e0d", - "reference": "d3ed4cc37051c1ca52d22d76b437d14809fc7e0d", + "url": "https://api.github.com/repos/fzaninotto/Faker/zipball/fc10d778e4b84d5bd315dad194661e091d307c6f", + "reference": "fc10d778e4b84d5bd315dad194661e091d307c6f", "shasum": "" }, "require": { @@ -154,13 +162,13 @@ }, "require-dev": { "ext-intl": "*", - "phpunit/phpunit": "^4.0 || ^5.0", - "squizlabs/php_codesniffer": "^1.5" + "phpunit/phpunit": "^4.8.35 || ^5.7", + "squizlabs/php_codesniffer": "^2.9.2" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.8-dev" + "dev-master": "1.9-dev" } }, "autoload": { @@ -183,7 +191,7 @@ "faker", "fixtures" ], - "time": "2017-08-15T16:48:10+00:00" + "time": "2019-12-12T13:22:17+00:00" }, { "name": "kadet/keylighter", @@ -236,16 +244,16 @@ }, { "name": "kevinlebrun/colors.php", - "version": "1.0.2", + "version": "1.0.3", "source": { "type": "git", "url": "https://github.com/kevinlebrun/colors.php.git", - "reference": "6d7140aeedef46c97c2324f09b752c599ef17dac" + "reference": "cdda5eee41314b87cd5a8bb91b1ffc7c0210e673" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/kevinlebrun/colors.php/zipball/6d7140aeedef46c97c2324f09b752c599ef17dac", - "reference": "6d7140aeedef46c97c2324f09b752c599ef17dac", + "url": "https://api.github.com/repos/kevinlebrun/colors.php/zipball/cdda5eee41314b87cd5a8bb91b1ffc7c0210e673", + "reference": "cdda5eee41314b87cd5a8bb91b1ffc7c0210e673", "shasum": "" }, "require": { @@ -283,7 +291,7 @@ "console", "shell" ], - "time": "2016-04-12T20:58:34+00:00" + "time": "2018-05-30T08:34:23+00:00" }, { "name": "league/commonmark", @@ -356,24 +364,26 @@ }, { "name": "myclabs/php-enum", - "version": "1.5.2", + "version": "1.7.6", "source": { "type": "git", "url": "https://github.com/myclabs/php-enum.git", - "reference": "3ed7088cfd0a0e06534b7f8b0eee82acea574fac" + "reference": "5f36467c7a87e20fbdc51e524fd8f9d1de80187c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/myclabs/php-enum/zipball/3ed7088cfd0a0e06534b7f8b0eee82acea574fac", - "reference": "3ed7088cfd0a0e06534b7f8b0eee82acea574fac", + "url": "https://api.github.com/repos/myclabs/php-enum/zipball/5f36467c7a87e20fbdc51e524fd8f9d1de80187c", + "reference": "5f36467c7a87e20fbdc51e524fd8f9d1de80187c", "shasum": "" }, "require": { - "php": ">=5.3" + "ext-json": "*", + "php": ">=7.1" }, "require-dev": { - "phpunit/phpunit": "^4.8.35|^5.7|^6.0", - "squizlabs/php_codesniffer": "1.*" + "phpunit/phpunit": "^7", + "squizlabs/php_codesniffer": "1.*", + "vimeo/psalm": "^3.8" }, "type": "library", "autoload": { @@ -396,28 +406,29 @@ "keywords": [ "enum" ], - "time": "2017-06-28T16:24:08+00:00" + "time": "2020-02-14T08:15:52+00:00" }, { "name": "nikic/php-parser", - "version": "v3.1.4", + "version": "v4.10.2", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "e57b3a09784f846411aa7ed664eedb73e3399078" + "reference": "658f1be311a230e0907f5dfe0213742aff0596de" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/e57b3a09784f846411aa7ed664eedb73e3399078", - "reference": "e57b3a09784f846411aa7ed664eedb73e3399078", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/658f1be311a230e0907f5dfe0213742aff0596de", + "reference": "658f1be311a230e0907f5dfe0213742aff0596de", "shasum": "" }, "require": { "ext-tokenizer": "*", - "php": ">=5.5" + "php": ">=7.0" }, "require-dev": { - "phpunit/phpunit": "~4.0|~5.0" + "ircmaxell/php-yacc": "^0.0.7", + "phpunit/phpunit": "^6.5 || ^7.0 || ^8.0 || ^9.0" }, "bin": [ "bin/php-parse" @@ -425,7 +436,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0-dev" + "dev-master": "4.9-dev" } }, "autoload": { @@ -447,28 +458,91 @@ "parser", "php" ], - "time": "2018-01-25T21:31:33+00:00" + "time": "2020-09-26T10:30:38+00:00" + }, + { + "name": "opis/closure", + "version": "3.6.0", + "source": { + "type": "git", + "url": "https://github.com/opis/closure.git", + "reference": "c547f8262a5fa9ff507bd06cc394067b83a75085" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/opis/closure/zipball/c547f8262a5fa9ff507bd06cc394067b83a75085", + "reference": "c547f8262a5fa9ff507bd06cc394067b83a75085", + "shasum": "" + }, + "require": { + "php": "^5.4 || ^7.0 || ^8.0" + }, + "require-dev": { + "jeremeamia/superclosure": "^2.0", + "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0 || ^8.0 || ^9.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.6.x-dev" + } + }, + "autoload": { + "psr-4": { + "Opis\\Closure\\": "src/" + }, + "files": [ + "functions.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Marius Sarca", + "email": "marius.sarca@gmail.com" + }, + { + "name": "Sorin Sarca", + "email": "sarca_sorin@hotmail.com" + } + ], + "description": "A library that can be used to serialize closures (anonymous functions) and arbitrary objects.", + "homepage": "https://opis.io/closure", + "keywords": [ + "anonymous functions", + "closure", + "function", + "serializable", + "serialization", + "serialize" + ], + "time": "2020-10-11T21:42:15+00:00" }, { "name": "php-di/invoker", - "version": "1.3.3", + "version": "2.2.0", "source": { "type": "git", "url": "https://github.com/PHP-DI/Invoker.git", - "reference": "1f4ca63b9abc66109e53b255e465d0ddb5c2e3f7" + "reference": "e08a7c87068daeaeef464b95d81643ea530bc535" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHP-DI/Invoker/zipball/1f4ca63b9abc66109e53b255e465d0ddb5c2e3f7", - "reference": "1f4ca63b9abc66109e53b255e465d0ddb5c2e3f7", + "url": "https://api.github.com/repos/PHP-DI/Invoker/zipball/e08a7c87068daeaeef464b95d81643ea530bc535", + "reference": "e08a7c87068daeaeef464b95d81643ea530bc535", "shasum": "" }, "require": { - "container-interop/container-interop": "~1.1" + "php": ">=7.3", + "psr/container": "~1.0" }, "require-dev": { "athletic/athletic": "~0.1.8", - "phpunit/phpunit": "~4.5" + "mnapoli/hard-mode": "~0.3.0", + "phpunit/phpunit": "^9.0" }, "type": "library", "autoload": { @@ -490,56 +564,57 @@ "invoke", "invoker" ], - "time": "2016-07-14T13:09:58+00:00" + "funding": [ + { + "url": "https://github.com/mnapoli", + "type": "github" + } + ], + "time": "2020-10-12T12:15:50+00:00" }, { "name": "php-di/php-di", - "version": "5.4.6", + "version": "6.3.0", "source": { "type": "git", "url": "https://github.com/PHP-DI/PHP-DI.git", - "reference": "3f9255659595f3e289f473778bb6c51aa72abbbd" + "reference": "955cacea6b0beaba07e8c11b8367f5b3d5abe89f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHP-DI/PHP-DI/zipball/3f9255659595f3e289f473778bb6c51aa72abbbd", - "reference": "3f9255659595f3e289f473778bb6c51aa72abbbd", + "url": "https://api.github.com/repos/PHP-DI/PHP-DI/zipball/955cacea6b0beaba07e8c11b8367f5b3d5abe89f", + "reference": "955cacea6b0beaba07e8c11b8367f5b3d5abe89f", "shasum": "" }, "require": { - "container-interop/container-interop": "~1.2", - "php": ">=5.5.0", - "php-di/invoker": "^1.3.2", + "opis/closure": "^3.5.5", + "php": ">=7.2.0", + "php-di/invoker": "^2.0", "php-di/phpdoc-reader": "^2.0.1", - "psr/container": "~1.0" + "psr/container": "^1.0" }, "provide": { - "container-interop/container-interop-implementation": "^1.0", "psr/container-implementation": "^1.0" }, - "replace": { - "mnapoli/php-di": "*" - }, "require-dev": { "doctrine/annotations": "~1.2", - "doctrine/cache": "~1.4", - "mnapoli/phpunit-easymock": "~0.2.0", - "ocramius/proxy-manager": "~1.0|~2.0", - "phpbench/phpbench": "@dev", - "phpunit/phpunit": "~4.5" + "friendsofphp/php-cs-fixer": "^2.4", + "mnapoli/phpunit-easymock": "^1.2", + "ocramius/proxy-manager": "~2.0.2", + "phpstan/phpstan": "^0.12", + "phpunit/phpunit": "^8.5|^9.0" }, "suggest": { "doctrine/annotations": "Install it if you want to use annotations (version ~1.2)", - "doctrine/cache": "Install it if you want to use the cache (version ~1.4)", - "ocramius/proxy-manager": "Install it if you want to use lazy injection (version ~1.0 or ~2.0)" + "ocramius/proxy-manager": "Install it if you want to use lazy injection (version ~2.0)" }, "type": "library", "autoload": { "psr-4": { - "DI\\": "src/DI/" + "DI\\": "src/" }, "files": [ - "src/DI/functions.php" + "src/functions.php" ] }, "notification-url": "https://packagist.org/downloads/", @@ -547,33 +622,48 @@ "MIT" ], "description": "The dependency injection container for humans", - "homepage": "http://php-di.org/", + "homepage": "https://php-di.org/", "keywords": [ + "PSR-11", "container", + "container-interop", "dependency injection", - "di" + "di", + "ioc", + "psr11" ], - "time": "2017-12-03T08:20:27+00:00" + "funding": [ + { + "url": "https://github.com/mnapoli", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/php-di/php-di", + "type": "tidelift" + } + ], + "time": "2020-10-12T14:39:15+00:00" }, { "name": "php-di/phpdoc-reader", - "version": "2.1.0", + "version": "2.2.1", "source": { "type": "git", "url": "https://github.com/PHP-DI/PhpDocReader.git", - "reference": "7d0de60b9341933c8afd172a6255cd7557601e0e" + "reference": "66daff34cbd2627740ffec9469ffbac9f8c8185c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHP-DI/PhpDocReader/zipball/7d0de60b9341933c8afd172a6255cd7557601e0e", - "reference": "7d0de60b9341933c8afd172a6255cd7557601e0e", + "url": "https://api.github.com/repos/PHP-DI/PhpDocReader/zipball/66daff34cbd2627740ffec9469ffbac9f8c8185c", + "reference": "66daff34cbd2627740ffec9469ffbac9f8c8185c", "shasum": "" }, "require": { - "php": ">=5.4.0" + "php": ">=7.2.0" }, "require-dev": { - "phpunit/phpunit": "~4.6" + "mnapoli/hard-mode": "~0.3.0", + "phpunit/phpunit": "^8.5|^9.0" }, "type": "library", "autoload": { @@ -590,36 +680,42 @@ "phpdoc", "reflection" ], - "time": "2018-02-18T17:39:01+00:00" + "time": "2020-10-12T12:39:22+00:00" }, { "name": "php-school/cli-menu", - "version": "2.1.0", + "version": "dev-master", "source": { "type": "git", "url": "https://github.com/php-school/cli-menu.git", - "reference": "62d3f44a68774d42ecae3adaacdf4811b0fbff9c" + "reference": "277ba7a8931ee51b0ec3c07e92c61ec01cbb95f7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-school/cli-menu/zipball/62d3f44a68774d42ecae3adaacdf4811b0fbff9c", - "reference": "62d3f44a68774d42ecae3adaacdf4811b0fbff9c", + "url": "https://api.github.com/repos/php-school/cli-menu/zipball/277ba7a8931ee51b0ec3c07e92c61ec01cbb95f7", + "reference": "277ba7a8931ee51b0ec3c07e92c61ec01cbb95f7", "shasum": "" }, "require": { - "beberlei/assert": "^2.4", + "beberlei/assert": "^2.4 | ^3", + "ext-mbstring": "*", "ext-posix": "*", - "php": ">=5.6" + "php": ">=7.1", + "php-school/terminal": "^0.2.1" }, "require-dev": { - "phpunit/phpunit": "~5.0", - "squizlabs/php_codesniffer": "~2.0" + "phpstan/phpstan": "^0.12", + "phpunit/phpunit": "^8.0 | ^9.0", + "squizlabs/php_codesniffer": "^3.2" }, "type": "library", "autoload": { "psr-4": { "PhpSchool\\CliMenu\\": "src" - } + }, + "files": [ + "src/Util/ArrayUtils.php" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -644,7 +740,60 @@ "phpschool", "terminal" ], - "time": "2017-12-11T19:36:16+00:00" + "time": "2020-10-20T11:12:56+00:00" + }, + { + "name": "php-school/terminal", + "version": "0.2.1", + "source": { + "type": "git", + "url": "https://github.com/php-school/terminal.git", + "reference": "725f86c7db996a4cf65648022f17e22391e97320" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-school/terminal/zipball/725f86c7db996a4cf65648022f17e22391e97320", + "reference": "725f86c7db996a4cf65648022f17e22391e97320", + "shasum": "" + }, + "require": { + "ext-posix": "*", + "php": ">=7.1" + }, + "require-dev": { + "phpstan/phpstan": "^0.9.2", + "phpunit/phpunit": "^7.1", + "squizlabs/php_codesniffer": "^3.2" + }, + "type": "library", + "autoload": { + "psr-4": { + "PhpSchool\\Terminal\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Woodward", + "email": "mikeymike.mw@gmail.com" + }, + { + "name": "Aydin Hassan", + "email": "aydin@hotmail.com" + } + ], + "description": "A command line terminal utility in PHP", + "keywords": [ + "cli", + "console", + "php-school", + "phpschool", + "terminal" + ], + "time": "2019-12-17T21:56:06+00:00" }, { "name": "psr/container", @@ -695,6 +844,58 @@ ], "time": "2017-02-14T16:28:37+00:00" }, + { + "name": "psr/http-factory", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/php-fig/http-factory.git", + "reference": "12ac7fcd07e5b077433f5f2bee95b3a771bf61be" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/http-factory/zipball/12ac7fcd07e5b077433f5f2bee95b3a771bf61be", + "reference": "12ac7fcd07e5b077433f5f2bee95b3a771bf61be", + "shasum": "" + }, + "require": { + "php": ">=7.0.0", + "psr/http-message": "^1.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Http\\Message\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interfaces for PSR-7 HTTP message factories", + "keywords": [ + "factory", + "http", + "message", + "psr", + "psr-17", + "psr-7", + "request", + "response" + ], + "time": "2019-04-30T12:38:16+00:00" + }, { "name": "psr/http-message", "version": "1.0.1", @@ -747,25 +948,26 @@ }, { "name": "symfony/filesystem", - "version": "v3.4.4", + "version": "v4.4.15", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "e078773ad6354af38169faf31c21df0f18ace03d" + "reference": "ebc51494739d3b081ea543ed7c462fa73a4f74db" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/e078773ad6354af38169faf31c21df0f18ace03d", - "reference": "e078773ad6354af38169faf31c21df0f18ace03d", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/ebc51494739d3b081ea543ed7c462fa73a4f74db", + "reference": "ebc51494739d3b081ea543ed7c462fa73a4f74db", "shasum": "" }, "require": { - "php": "^5.5.9|>=7.0.8" + "php": ">=7.1.3", + "symfony/polyfill-ctype": "~1.8" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.4-dev" + "dev-master": "4.4-dev" } }, "autoload": { @@ -792,29 +994,119 @@ ], "description": "Symfony Filesystem Component", "homepage": "https://symfony.com", - "time": "2018-01-03T07:37:34+00:00" + "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-09-27T13:54:16+00:00" + }, + { + "name": "symfony/polyfill-ctype", + "version": "v1.18.1", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-ctype.git", + "reference": "1c302646f6efc070cd46856e600e5e0684d6b454" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/1c302646f6efc070cd46856e600e5e0684d6b454", + "reference": "1c302646f6efc070cd46856e600e5e0684d6b454", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "suggest": { + "ext-ctype": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.18-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Ctype\\": "" + }, + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Gert de Pagter", + "email": "BackEndTea@gmail.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for ctype functions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "ctype", + "polyfill", + "portable" + ], + "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-07-14T12:35:20+00:00" }, { "name": "symfony/process", - "version": "v3.4.4", + "version": "v4.4.15", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "09a5172057be8fc677840e591b17f385e58c7c0d" + "reference": "9b887acc522935f77555ae8813495958c7771ba7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/09a5172057be8fc677840e591b17f385e58c7c0d", - "reference": "09a5172057be8fc677840e591b17f385e58c7c0d", + "url": "https://api.github.com/repos/symfony/process/zipball/9b887acc522935f77555ae8813495958c7771ba7", + "reference": "9b887acc522935f77555ae8813495958c7771ba7", "shasum": "" }, "require": { - "php": "^5.5.9|>=7.0.8" + "php": ">=7.1.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.4-dev" + "dev-master": "4.4-dev" } }, "autoload": { @@ -841,85 +1133,115 @@ ], "description": "Symfony Process Component", "homepage": "https://symfony.com", - "time": "2018-01-29T09:03:43+00:00" + "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-09-02T16:08:58+00:00" }, { "name": "zendframework/zend-diactoros", - "version": "1.7.1", + "version": "2.2.1", "source": { "type": "git", "url": "https://github.com/zendframework/zend-diactoros.git", - "reference": "bf26aff803a11c5cc8eb7c4878a702c403ec67f1" + "reference": "de5847b068362a88684a55b0dbb40d85986cfa52" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/zendframework/zend-diactoros/zipball/bf26aff803a11c5cc8eb7c4878a702c403ec67f1", - "reference": "bf26aff803a11c5cc8eb7c4878a702c403ec67f1", + "url": "https://api.github.com/repos/zendframework/zend-diactoros/zipball/de5847b068362a88684a55b0dbb40d85986cfa52", + "reference": "de5847b068362a88684a55b0dbb40d85986cfa52", "shasum": "" }, "require": { - "php": "^5.6 || ^7.0", + "php": "^7.1", + "psr/http-factory": "^1.0", "psr/http-message": "^1.0" }, "provide": { + "psr/http-factory-implementation": "1.0", "psr/http-message-implementation": "1.0" }, "require-dev": { + "ext-curl": "*", "ext-dom": "*", "ext-libxml": "*", - "phpunit/phpunit": "^5.7.16 || ^6.0.8", - "zendframework/zend-coding-standard": "~1.0" + "http-interop/http-factory-tests": "^0.5.0", + "php-http/psr7-integration-tests": "dev-master", + "phpunit/phpunit": "^7.0.2", + "zendframework/zend-coding-standard": "~1.0.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.7.x-dev", - "dev-develop": "1.8.x-dev" + "dev-master": "2.1.x-dev", + "dev-develop": "2.2.x-dev", + "dev-release-1.8": "1.8.x-dev" } }, "autoload": { + "files": [ + "src/functions/create_uploaded_file.php", + "src/functions/marshal_headers_from_sapi.php", + "src/functions/marshal_method_from_sapi.php", + "src/functions/marshal_protocol_version_from_sapi.php", + "src/functions/marshal_uri_from_sapi.php", + "src/functions/normalize_server.php", + "src/functions/normalize_uploaded_files.php", + "src/functions/parse_cookie_header.php" + ], "psr-4": { "Zend\\Diactoros\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", "license": [ - "BSD-2-Clause" + "BSD-3-Clause" ], "description": "PSR HTTP Message implementations", - "homepage": "https://github.com/zendframework/zend-diactoros", "keywords": [ "http", "psr", "psr-7" ], - "time": "2018-02-26T15:44:50+00:00" + "abandoned": "laminas/laminas-diactoros", + "time": "2019-11-13T19:16:13+00:00" } ], "packages-dev": [ { "name": "composer/ca-bundle", - "version": "1.1.0", + "version": "1.2.8", "source": { "type": "git", "url": "https://github.com/composer/ca-bundle.git", - "reference": "943b2c4fcad1ef178d16a713c2468bf7e579c288" + "reference": "8a7ecad675253e4654ea05505233285377405215" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/ca-bundle/zipball/943b2c4fcad1ef178d16a713c2468bf7e579c288", - "reference": "943b2c4fcad1ef178d16a713c2468bf7e579c288", + "url": "https://api.github.com/repos/composer/ca-bundle/zipball/8a7ecad675253e4654ea05505233285377405215", + "reference": "8a7ecad675253e4654ea05505233285377405215", "shasum": "" }, "require": { "ext-openssl": "*", "ext-pcre": "*", - "php": "^5.3.2 || ^7.0" + "php": "^5.3.2 || ^7.0 || ^8.0" }, "require-dev": { - "phpunit/phpunit": "^4.8.35", + "phpunit/phpunit": "^4.8.35 || ^5.7 || 6.5 - 8", "psr/log": "^1.0", - "symfony/process": "^2.5 || ^3.0 || ^4.0" + "symfony/process": "^2.5 || ^3.0 || ^4.0 || ^5.0" }, "type": "library", "extra": { @@ -951,40 +1273,57 @@ "ssl", "tls" ], - "time": "2017-11-29T09:37:33+00:00" + "funding": [ + { + "url": "https://packagist.com", + "type": "custom" + }, + { + "url": "https://github.com/composer", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/composer/composer", + "type": "tidelift" + } + ], + "time": "2020-08-23T12:54:47+00:00" }, { "name": "composer/composer", - "version": "1.6.3", + "version": "1.10.15", "source": { "type": "git", "url": "https://github.com/composer/composer.git", - "reference": "88a69fda0f2187ad8714cedffd7a8872dceaa4c2" + "reference": "547c9ee73fe26c77af09a0ea16419176b1cdbd12" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/composer/zipball/88a69fda0f2187ad8714cedffd7a8872dceaa4c2", - "reference": "88a69fda0f2187ad8714cedffd7a8872dceaa4c2", + "url": "https://api.github.com/repos/composer/composer/zipball/547c9ee73fe26c77af09a0ea16419176b1cdbd12", + "reference": "547c9ee73fe26c77af09a0ea16419176b1cdbd12", "shasum": "" }, "require": { "composer/ca-bundle": "^1.0", "composer/semver": "^1.0", "composer/spdx-licenses": "^1.2", - "justinrainbow/json-schema": "^3.0 || ^4.0 || ^5.0", + "composer/xdebug-handler": "^1.1", + "justinrainbow/json-schema": "^5.2.10", "php": "^5.3.2 || ^7.0", "psr/log": "^1.0", - "seld/cli-prompt": "^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" + "symfony/console": "^2.7 || ^3.0 || ^4.0 || ^5.0", + "symfony/filesystem": "^2.7 || ^3.0 || ^4.0 || ^5.0", + "symfony/finder": "^2.7 || ^3.0 || ^4.0 || ^5.0", + "symfony/process": "^2.7 || ^3.0 || ^4.0 || ^5.0" + }, + "conflict": { + "symfony/console": "2.8.38" }, "require-dev": { - "phpunit/phpunit": "^4.8.35 || ^5.7", - "phpunit/phpunit-mock-objects": "^2.3 || ^3.0" + "phpspec/prophecy": "^1.10", + "symfony/phpunit-bridge": "^4.2" }, "suggest": { "ext-openssl": "Enabling the openssl extension allows you to access https URLs for repositories and packages", @@ -997,7 +1336,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.6-dev" + "dev-master": "1.10-dev" } }, "autoload": { @@ -1021,35 +1360,48 @@ "homepage": "http://seld.be" } ], - "description": "Composer helps you declare, manage and install dependencies of PHP projects, ensuring you have the right stack everywhere.", + "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": "2018-01-31T15:28:18+00:00" + "funding": [ + { + "url": "https://packagist.com", + "type": "custom" + }, + { + "url": "https://github.com/composer", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/composer/composer", + "type": "tidelift" + } + ], + "time": "2020-10-13T13:59:09+00:00" }, { "name": "composer/semver", - "version": "1.4.2", + "version": "1.7.1", "source": { "type": "git", "url": "https://github.com/composer/semver.git", - "reference": "c7cb9a2095a074d131b65a8a0cd294479d785573" + "reference": "38276325bd896f90dfcfe30029aa5db40df387a7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/semver/zipball/c7cb9a2095a074d131b65a8a0cd294479d785573", - "reference": "c7cb9a2095a074d131b65a8a0cd294479d785573", + "url": "https://api.github.com/repos/composer/semver/zipball/38276325bd896f90dfcfe30029aa5db40df387a7", + "reference": "38276325bd896f90dfcfe30029aa5db40df387a7", "shasum": "" }, "require": { "php": "^5.3.2 || ^7.0" }, "require-dev": { - "phpunit/phpunit": "^4.5 || ^5.0.5", - "phpunit/phpunit-mock-objects": "2.3.0 || ^3.0" + "phpunit/phpunit": "^4.5 || ^5.0.5" }, "type": "library", "extra": { @@ -1090,28 +1442,41 @@ "validation", "versioning" ], - "time": "2016-08-30T16:08:34+00:00" + "funding": [ + { + "url": "https://packagist.com", + "type": "custom" + }, + { + "url": "https://github.com/composer", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/composer/composer", + "type": "tidelift" + } + ], + "time": "2020-09-27T13:13:07+00:00" }, { "name": "composer/spdx-licenses", - "version": "1.3.0", + "version": "1.5.4", "source": { "type": "git", "url": "https://github.com/composer/spdx-licenses.git", - "reference": "7e111c50db92fa2ced140f5ba23b4e261bc77a30" + "reference": "6946f785871e2314c60b4524851f3702ea4f2223" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/spdx-licenses/zipball/7e111c50db92fa2ced140f5ba23b4e261bc77a30", - "reference": "7e111c50db92fa2ced140f5ba23b4e261bc77a30", + "url": "https://api.github.com/repos/composer/spdx-licenses/zipball/6946f785871e2314c60b4524851f3702ea4f2223", + "reference": "6946f785871e2314c60b4524851f3702ea4f2223", "shasum": "" }, "require": { - "php": "^5.3.2 || ^7.0" + "php": "^5.3.2 || ^7.0 || ^8.0" }, "require-dev": { - "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.5", - "phpunit/phpunit-mock-objects": "2.3.0 || ^3.0" + "phpunit/phpunit": "^4.8.35 || ^5.7 || 6.5 - 7" }, "type": "library", "extra": { @@ -1151,31 +1516,105 @@ "spdx", "validator" ], - "time": "2018-01-31T13:17:27+00:00" + "funding": [ + { + "url": "https://packagist.com", + "type": "custom" + }, + { + "url": "https://github.com/composer", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/composer/composer", + "type": "tidelift" + } + ], + "time": "2020-07-15T15:35:07+00:00" }, { - "name": "doctrine/instantiator", - "version": "1.1.0", + "name": "composer/xdebug-handler", + "version": "1.4.3", "source": { "type": "git", - "url": "https://github.com/doctrine/instantiator.git", - "reference": "185b8868aa9bf7159f5f953ed5afb2d7fcdc3bda" + "url": "https://github.com/composer/xdebug-handler.git", + "reference": "ebd27a9866ae8254e873866f795491f02418c5a5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/185b8868aa9bf7159f5f953ed5afb2d7fcdc3bda", - "reference": "185b8868aa9bf7159f5f953ed5afb2d7fcdc3bda", + "url": "https://api.github.com/repos/composer/xdebug-handler/zipball/ebd27a9866ae8254e873866f795491f02418c5a5", + "reference": "ebd27a9866ae8254e873866f795491f02418c5a5", "shasum": "" }, "require": { - "php": "^7.1" + "php": "^5.3.2 || ^7.0 || ^8.0", + "psr/log": "^1.0" }, "require-dev": { - "athletic/athletic": "~0.1.8", + "phpunit/phpunit": "^4.8.35 || ^5.7 || 6.5 - 8" + }, + "type": "library", + "autoload": { + "psr-4": { + "Composer\\XdebugHandler\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "John Stevenson", + "email": "john-stevenson@blueyonder.co.uk" + } + ], + "description": "Restarts a process without Xdebug.", + "keywords": [ + "Xdebug", + "performance" + ], + "funding": [ + { + "url": "https://packagist.com", + "type": "custom" + }, + { + "url": "https://github.com/composer", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/composer/composer", + "type": "tidelift" + } + ], + "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": "*", - "phpunit/phpunit": "^6.2.3", - "squizlabs/php_codesniffer": "^3.0.2" + "phpbench/phpbench": "^0.13", + "phpstan/phpstan-phpunit": "^0.11", + "phpstan/phpstan-shim": "^0.11", + "phpunit/phpunit": "^7.0" }, "type": "library", "extra": { @@ -1200,32 +1639,46 @@ } ], "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", - "homepage": "https://github.com/doctrine/instantiator", + "homepage": "https://www.doctrine-project.org/projects/instantiator.html", "keywords": [ "constructor", "instantiate" ], - "time": "2017-07-22T11:58:36+00:00" + "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.7", + "version": "5.2.10", "source": { "type": "git", "url": "https://github.com/justinrainbow/json-schema.git", - "reference": "8560d4314577199ba51bf2032f02cd1315587c23" + "reference": "2ba9c8c862ecd5510ed16c6340aa9f6eadb4f31b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/justinrainbow/json-schema/zipball/8560d4314577199ba51bf2032f02cd1315587c23", - "reference": "8560d4314577199ba51bf2032f02cd1315587c23", + "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.1", + "friendsofphp/php-cs-fixer": "~2.2.20||~2.15.1", "json-schema/json-schema-test-suite": "1.2.0", "phpunit/phpunit": "^4.8.35" }, @@ -1271,29 +1724,32 @@ "json", "schema" ], - "time": "2018-02-14T22:26:30+00:00" + "time": "2020-05-27T16:41:55+00:00" }, { "name": "myclabs/deep-copy", - "version": "1.7.0", + "version": "1.10.1", "source": { "type": "git", "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "3b8a3a99ba1f6a3952ac2747d989303cbd6b7a3e" + "reference": "969b211f9a51aa1f6c01d1d2aef56d3bd91598e5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/3b8a3a99ba1f6a3952ac2747d989303cbd6b7a3e", - "reference": "3b8a3a99ba1f6a3952ac2747d989303cbd6b7a3e", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/969b211f9a51aa1f6c01d1d2aef56d3bd91598e5", + "reference": "969b211f9a51aa1f6c01d1d2aef56d3bd91598e5", "shasum": "" }, "require": { - "php": "^5.6 || ^7.0" + "php": "^7.1 || ^8.0" + }, + "replace": { + "myclabs/deep-copy": "self.version" }, "require-dev": { "doctrine/collections": "^1.0", "doctrine/common": "^2.6", - "phpunit/phpunit": "^4.1" + "phpunit/phpunit": "^7.1" }, "type": "library", "autoload": { @@ -1316,39 +1772,142 @@ "object", "object graph" ], - "time": "2017-10-19T19:58:43+00:00" + "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": "1.0.1", + "version": "2.2.0", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionCommon.git", - "reference": "21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6" + "reference": "1d01c49d4ed62f25aa84a747ad35d5a16924662b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6", - "reference": "21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/1d01c49d4ed62f25aa84a747ad35d5a16924662b", + "reference": "1d01c49d4ed62f25aa84a747ad35d5a16924662b", "shasum": "" }, "require": { - "php": ">=5.5" - }, - "require-dev": { - "phpunit/phpunit": "^4.6" + "php": "^7.2 || ^8.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-2.x": "2.x-dev" } }, "autoload": { "psr-4": { - "phpDocumentor\\Reflection\\": [ - "src" - ] + "phpDocumentor\\Reflection\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -1370,44 +1929,41 @@ "reflection", "static analysis" ], - "time": "2017-09-11T18:02:19+00:00" + "time": "2020-06-27T09:03:43+00:00" }, { "name": "phpdocumentor/reflection-docblock", - "version": "4.3.0", + "version": "5.2.2", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "94fd0001232e47129dd3504189fa1c7225010d08" + "reference": "069a785b2141f5bcf49f3e353548dc1cce6df556" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/94fd0001232e47129dd3504189fa1c7225010d08", - "reference": "94fd0001232e47129dd3504189fa1c7225010d08", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/069a785b2141f5bcf49f3e353548dc1cce6df556", + "reference": "069a785b2141f5bcf49f3e353548dc1cce6df556", "shasum": "" }, "require": { - "php": "^7.0", - "phpdocumentor/reflection-common": "^1.0.0", - "phpdocumentor/type-resolver": "^0.4.0", - "webmozart/assert": "^1.0" + "ext-filter": "*", + "php": "^7.2 || ^8.0", + "phpdocumentor/reflection-common": "^2.2", + "phpdocumentor/type-resolver": "^1.3", + "webmozart/assert": "^1.9.1" }, "require-dev": { - "doctrine/instantiator": "~1.0.5", - "mockery/mockery": "^1.0", - "phpunit/phpunit": "^6.4" + "mockery/mockery": "~1.3.2" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.x-dev" + "dev-master": "5.x-dev" } }, "autoload": { "psr-4": { - "phpDocumentor\\Reflection\\": [ - "src/" - ] + "phpDocumentor\\Reflection\\": "src" } }, "notification-url": "https://packagist.org/downloads/", @@ -1418,44 +1974,45 @@ { "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": "2017-11-30T07:14:17+00:00" + "time": "2020-09-03T19:13:55+00:00" }, { "name": "phpdocumentor/type-resolver", - "version": "0.4.0", + "version": "1.4.0", "source": { "type": "git", "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "9c977708995954784726e25d0cd1dddf4e65b0f7" + "reference": "6a467b8989322d92aa1c8bf2bebcc6e5c2ba55c0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/9c977708995954784726e25d0cd1dddf4e65b0f7", - "reference": "9c977708995954784726e25d0cd1dddf4e65b0f7", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/6a467b8989322d92aa1c8bf2bebcc6e5c2ba55c0", + "reference": "6a467b8989322d92aa1c8bf2bebcc6e5c2ba55c0", "shasum": "" }, "require": { - "php": "^5.5 || ^7.0", - "phpdocumentor/reflection-common": "^1.0" + "php": "^7.2 || ^8.0", + "phpdocumentor/reflection-common": "^2.0" }, "require-dev": { - "mockery/mockery": "^0.9.4", - "phpunit/phpunit": "^5.2||^4.8.24" + "ext-tokenizer": "*" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-1.x": "1.x-dev" } }, "autoload": { "psr-4": { - "phpDocumentor\\Reflection\\": [ - "src/" - ] + "phpDocumentor\\Reflection\\": "src" } }, "notification-url": "https://packagist.org/downloads/", @@ -1468,42 +2025,43 @@ "email": "me@mikevanriel.com" } ], - "time": "2017-07-14T14:27:02+00:00" + "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.7.5", + "version": "1.12.1", "source": { "type": "git", "url": "https://github.com/phpspec/prophecy.git", - "reference": "dfd6be44111a7c41c2e884a336cc4f461b3b2401" + "reference": "8ce87516be71aae9b956f81906aaf0338e0d8a2d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/dfd6be44111a7c41c2e884a336cc4f461b3b2401", - "reference": "dfd6be44111a7c41c2e884a336cc4f461b3b2401", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/8ce87516be71aae9b956f81906aaf0338e0d8a2d", + "reference": "8ce87516be71aae9b956f81906aaf0338e0d8a2d", "shasum": "" }, "require": { - "doctrine/instantiator": "^1.0.2", - "php": "^5.3|^7.0", - "phpdocumentor/reflection-docblock": "^2.0|^3.0.2|^4.0", - "sebastian/comparator": "^1.1|^2.0", - "sebastian/recursion-context": "^1.0|^2.0|^3.0" + "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": "^2.5|^3.2", - "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.5" + "phpspec/phpspec": "^6.0", + "phpunit/phpunit": "^8.0 || ^9.0 <9.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.7.x-dev" + "dev-master": "1.11.x-dev" } }, "autoload": { - "psr-0": { - "Prophecy\\": "src/" + "psr-4": { + "Prophecy\\": "src/Prophecy" } }, "notification-url": "https://packagist.org/downloads/", @@ -1531,44 +2089,44 @@ "spy", "stub" ], - "time": "2018-02-19T10:16:54+00:00" + "time": "2020-09-29T09:10:42+00:00" }, { "name": "phpunit/php-code-coverage", - "version": "4.0.8", + "version": "6.1.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "ef7b2f56815df854e66ceaee8ebe9393ae36a40d" + "reference": "807e6013b00af69b6c5d9ceb4282d0393dbb9d8d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/ef7b2f56815df854e66ceaee8ebe9393ae36a40d", - "reference": "ef7b2f56815df854e66ceaee8ebe9393ae36a40d", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/807e6013b00af69b6c5d9ceb4282d0393dbb9d8d", + "reference": "807e6013b00af69b6c5d9ceb4282d0393dbb9d8d", "shasum": "" }, "require": { "ext-dom": "*", "ext-xmlwriter": "*", - "php": "^5.6 || ^7.0", - "phpunit/php-file-iterator": "^1.3", - "phpunit/php-text-template": "^1.2", - "phpunit/php-token-stream": "^1.4.2 || ^2.0", - "sebastian/code-unit-reverse-lookup": "^1.0", - "sebastian/environment": "^1.3.2 || ^2.0", - "sebastian/version": "^1.0 || ^2.0" + "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": { - "ext-xdebug": "^2.1.4", - "phpunit/phpunit": "^5.7" + "phpunit/phpunit": "^7.0" }, "suggest": { - "ext-xdebug": "^2.5.1" + "ext-xdebug": "^2.6.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.0.x-dev" + "dev-master": "6.1-dev" } }, "autoload": { @@ -1583,7 +2141,7 @@ "authors": [ { "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", + "email": "sebastian@phpunit.de", "role": "lead" } ], @@ -1594,29 +2152,32 @@ "testing", "xunit" ], - "time": "2017-04-02T07:44:40+00:00" + "time": "2018-10-31T16:06:48+00:00" }, { "name": "phpunit/php-file-iterator", - "version": "1.4.5", + "version": "2.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "730b01bc3e867237eaac355e06a36b85dd93a8b4" + "reference": "050bedf145a257b1ff02746c31894800e5122946" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/730b01bc3e867237eaac355e06a36b85dd93a8b4", - "reference": "730b01bc3e867237eaac355e06a36b85dd93a8b4", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/050bedf145a257b1ff02746c31894800e5122946", + "reference": "050bedf145a257b1ff02746c31894800e5122946", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": "^7.1" + }, + "require-dev": { + "phpunit/phpunit": "^7.1" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.4.x-dev" + "dev-master": "2.0.x-dev" } }, "autoload": { @@ -1631,7 +2192,7 @@ "authors": [ { "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", + "email": "sebastian@phpunit.de", "role": "lead" } ], @@ -1641,7 +2202,7 @@ "filesystem", "iterator" ], - "time": "2017-11-27T13:52:08+00:00" + "time": "2018-09-13T20:33:42+00:00" }, { "name": "phpunit/php-text-template", @@ -1686,28 +2247,28 @@ }, { "name": "phpunit/php-timer", - "version": "1.0.9", + "version": "2.1.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-timer.git", - "reference": "3dcf38ca72b158baf0bc245e9184d3fdffa9c46f" + "reference": "1038454804406b0b5f5f520358e78c1c2f71501e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/3dcf38ca72b158baf0bc245e9184d3fdffa9c46f", - "reference": "3dcf38ca72b158baf0bc245e9184d3fdffa9c46f", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/1038454804406b0b5f5f520358e78c1c2f71501e", + "reference": "1038454804406b0b5f5f520358e78c1c2f71501e", "shasum": "" }, "require": { - "php": "^5.3.3 || ^7.0" + "php": "^7.1" }, "require-dev": { - "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0" + "phpunit/phpunit": "^7.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0-dev" + "dev-master": "2.1-dev" } }, "autoload": { @@ -1722,7 +2283,7 @@ "authors": [ { "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", + "email": "sebastian@phpunit.de", "role": "lead" } ], @@ -1731,33 +2292,33 @@ "keywords": [ "timer" ], - "time": "2017-02-26T11:10:40+00:00" + "time": "2019-06-07T04:22:29+00:00" }, { "name": "phpunit/php-token-stream", - "version": "2.0.2", + "version": "3.1.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-token-stream.git", - "reference": "791198a2c6254db10131eecfe8c06670700904db" + "reference": "995192df77f63a59e47f025390d2d1fdf8f425ff" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/791198a2c6254db10131eecfe8c06670700904db", - "reference": "791198a2c6254db10131eecfe8c06670700904db", + "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/995192df77f63a59e47f025390d2d1fdf8f425ff", + "reference": "995192df77f63a59e47f025390d2d1fdf8f425ff", "shasum": "" }, "require": { "ext-tokenizer": "*", - "php": "^7.0" + "php": "^7.1" }, "require-dev": { - "phpunit/phpunit": "^6.2.4" + "phpunit/phpunit": "^7.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0-dev" + "dev-master": "3.1-dev" } }, "autoload": { @@ -1780,55 +2341,58 @@ "keywords": [ "tokenizer" ], - "time": "2017-11-27T05:48:46+00:00" + "abandoned": true, + "time": "2019-09-17T06:23:10+00:00" }, { "name": "phpunit/phpunit", - "version": "5.7.27", + "version": "7.5.20", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "b7803aeca3ccb99ad0a506fa80b64cd6a56bbc0c" + "reference": "9467db479d1b0487c99733bb1e7944d32deded2c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/b7803aeca3ccb99ad0a506fa80b64cd6a56bbc0c", - "reference": "b7803aeca3ccb99ad0a506fa80b64cd6a56bbc0c", + "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.3", - "php": "^5.6 || ^7.0", - "phpspec/prophecy": "^1.6.2", - "phpunit/php-code-coverage": "^4.0.4", - "phpunit/php-file-iterator": "~1.4", - "phpunit/php-text-template": "~1.2", - "phpunit/php-timer": "^1.0.6", - "phpunit/phpunit-mock-objects": "^3.2", - "sebastian/comparator": "^1.2.4", - "sebastian/diff": "^1.4.3", - "sebastian/environment": "^1.3.4 || ^2.0", - "sebastian/exporter": "~2.0", - "sebastian/global-state": "^1.1", - "sebastian/object-enumerator": "~2.0", - "sebastian/resource-operations": "~1.0", - "sebastian/version": "^1.0.6|^2.0.1", - "symfony/yaml": "~2.1|~3.0|~4.0" + "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": { - "phpdocumentor/reflection-docblock": "3.0.2" + "phpunit/phpunit-mock-objects": "*" }, "require-dev": { "ext-pdo": "*" }, "suggest": { + "ext-soap": "*", "ext-xdebug": "*", - "phpunit/php-invoker": "~1.1" + "phpunit/php-invoker": "^2.0" }, "bin": [ "phpunit" @@ -1836,7 +2400,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "5.7.x-dev" + "dev-master": "7.5-dev" } }, "autoload": { @@ -1862,79 +2426,20 @@ "testing", "xunit" ], - "time": "2018-02-01T05:50:59+00:00" - }, - { - "name": "phpunit/phpunit-mock-objects", - "version": "3.4.4", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", - "reference": "a23b761686d50a560cc56233b9ecf49597cc9118" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/a23b761686d50a560cc56233b9ecf49597cc9118", - "reference": "a23b761686d50a560cc56233b9ecf49597cc9118", - "shasum": "" - }, - "require": { - "doctrine/instantiator": "^1.0.2", - "php": "^5.6 || ^7.0", - "phpunit/php-text-template": "^1.2", - "sebastian/exporter": "^1.2 || ^2.0" - }, - "conflict": { - "phpunit/phpunit": "<5.4.0" - }, - "require-dev": { - "phpunit/phpunit": "^5.4" - }, - "suggest": { - "ext-soap": "*" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.2.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", - "role": "lead" - } - ], - "description": "Mock Object library for PHPUnit", - "homepage": "https://github.com/sebastianbergmann/phpunit-mock-objects/", - "keywords": [ - "mock", - "xunit" - ], - "time": "2017-06-30T09:13:00+00:00" + "time": "2020-01-08T08:45:45+00:00" }, { "name": "psr/log", - "version": "1.0.2", + "version": "1.1.3", "source": { "type": "git", "url": "https://github.com/php-fig/log.git", - "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d" + "reference": "0f73288fd15629204f9d42b7055f72dacbe811fc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/log/zipball/4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", - "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", + "url": "https://api.github.com/repos/php-fig/log/zipball/0f73288fd15629204f9d42b7055f72dacbe811fc", + "reference": "0f73288fd15629204f9d42b7055f72dacbe811fc", "shasum": "" }, "require": { @@ -1943,7 +2448,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "1.1.x-dev" } }, "autoload": { @@ -1968,7 +2473,7 @@ "psr", "psr-3" ], - "time": "2016-10-10T12:19:37+00:00" + "time": "2020-03-23T09:12:05+00:00" }, { "name": "sebastian/code-unit-reverse-lookup", @@ -2017,30 +2522,30 @@ }, { "name": "sebastian/comparator", - "version": "1.2.4", + "version": "3.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "2b7424b55f5047b47ac6e5ccb20b2aea4011d9be" + "reference": "5de4fc177adf9bce8df98d8d141a7559d7ccf6da" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/2b7424b55f5047b47ac6e5ccb20b2aea4011d9be", - "reference": "2b7424b55f5047b47ac6e5ccb20b2aea4011d9be", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/5de4fc177adf9bce8df98d8d141a7559d7ccf6da", + "reference": "5de4fc177adf9bce8df98d8d141a7559d7ccf6da", "shasum": "" }, "require": { - "php": ">=5.3.3", - "sebastian/diff": "~1.2", - "sebastian/exporter": "~1.2 || ~2.0" + "php": "^7.1", + "sebastian/diff": "^3.0", + "sebastian/exporter": "^3.1" }, "require-dev": { - "phpunit/phpunit": "~4.4" + "phpunit/phpunit": "^7.1" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.2.x-dev" + "dev-master": "3.0-dev" } }, "autoload": { @@ -2071,38 +2576,39 @@ } ], "description": "Provides the functionality to compare PHP values for equality", - "homepage": "http://www.github.com/sebastianbergmann/comparator", + "homepage": "https://github.com/sebastianbergmann/comparator", "keywords": [ "comparator", "compare", "equality" ], - "time": "2017-01-29T09:50:25+00:00" + "time": "2018-07-12T15:12:46+00:00" }, { "name": "sebastian/diff", - "version": "1.4.3", + "version": "3.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "7f066a26a962dbe58ddea9f72a4e82874a3975a4" + "reference": "720fcc7e9b5cf384ea68d9d930d480907a0c1a29" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/7f066a26a962dbe58ddea9f72a4e82874a3975a4", - "reference": "7f066a26a962dbe58ddea9f72a4e82874a3975a4", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/720fcc7e9b5cf384ea68d9d930d480907a0c1a29", + "reference": "720fcc7e9b5cf384ea68d9d930d480907a0c1a29", "shasum": "" }, "require": { - "php": "^5.3.3 || ^7.0" + "php": "^7.1" }, "require-dev": { - "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0" + "phpunit/phpunit": "^7.5 || ^8.0", + "symfony/process": "^2 || ^3.3 || ^4" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.4-dev" + "dev-master": "3.0-dev" } }, "autoload": { @@ -2127,34 +2633,40 @@ "description": "Diff implementation", "homepage": "https://github.com/sebastianbergmann/diff", "keywords": [ - "diff" + "diff", + "udiff", + "unidiff", + "unified diff" ], - "time": "2017-05-22T07:24:03+00:00" + "time": "2019-02-04T06:01:07+00:00" }, { "name": "sebastian/environment", - "version": "2.0.0", + "version": "4.2.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "5795ffe5dc5b02460c3e34222fee8cbe245d8fac" + "reference": "464c90d7bdf5ad4e8a6aea15c091fec0603d4368" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/5795ffe5dc5b02460c3e34222fee8cbe245d8fac", - "reference": "5795ffe5dc5b02460c3e34222fee8cbe245d8fac", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/464c90d7bdf5ad4e8a6aea15c091fec0603d4368", + "reference": "464c90d7bdf5ad4e8a6aea15c091fec0603d4368", "shasum": "" }, "require": { - "php": "^5.6 || ^7.0" + "php": "^7.1" }, "require-dev": { - "phpunit/phpunit": "^5.0" + "phpunit/phpunit": "^7.5" + }, + "suggest": { + "ext-posix": "*" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0.x-dev" + "dev-master": "4.2-dev" } }, "autoload": { @@ -2179,34 +2691,34 @@ "environment", "hhvm" ], - "time": "2016-11-26T07:53:53+00:00" + "time": "2019-11-20T08:46:58+00:00" }, { "name": "sebastian/exporter", - "version": "2.0.0", + "version": "3.1.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "ce474bdd1a34744d7ac5d6aad3a46d48d9bac4c4" + "reference": "68609e1261d215ea5b21b7987539cbfbe156ec3e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/ce474bdd1a34744d7ac5d6aad3a46d48d9bac4c4", - "reference": "ce474bdd1a34744d7ac5d6aad3a46d48d9bac4c4", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/68609e1261d215ea5b21b7987539cbfbe156ec3e", + "reference": "68609e1261d215ea5b21b7987539cbfbe156ec3e", "shasum": "" }, "require": { - "php": ">=5.3.3", - "sebastian/recursion-context": "~2.0" + "php": "^7.0", + "sebastian/recursion-context": "^3.0" }, "require-dev": { "ext-mbstring": "*", - "phpunit/phpunit": "~4.4" + "phpunit/phpunit": "^6.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0.x-dev" + "dev-master": "3.1.x-dev" } }, "autoload": { @@ -2219,6 +2731,10 @@ "BSD-3-Clause" ], "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, { "name": "Jeff Welch", "email": "whatthejeff@gmail.com" @@ -2227,17 +2743,13 @@ "name": "Volker Dusch", "email": "github@wallbash.com" }, - { - "name": "Bernhard Schussek", - "email": "bschussek@2bepublished.at" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - }, { "name": "Adam Harvey", "email": "aharvey@php.net" + }, + { + "name": "Bernhard Schussek", + "email": "bschussek@gmail.com" } ], "description": "Provides the functionality to export PHP variables for visualization", @@ -2246,27 +2758,27 @@ "export", "exporter" ], - "time": "2016-11-19T08:54:04+00:00" + "time": "2019-09-14T09:02:43+00:00" }, { "name": "sebastian/global-state", - "version": "1.1.1", + "version": "2.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4" + "reference": "e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/bc37d50fea7d017d3d340f230811c9f1d7280af4", - "reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4", + "reference": "e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": "^7.0" }, "require-dev": { - "phpunit/phpunit": "~4.2" + "phpunit/phpunit": "^6.0" }, "suggest": { "ext-uopz": "*" @@ -2274,7 +2786,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0-dev" + "dev-master": "2.0-dev" } }, "autoload": { @@ -2297,33 +2809,34 @@ "keywords": [ "global state" ], - "time": "2015-10-12T03:26:01+00:00" + "time": "2017-04-27T15:39:26+00:00" }, { "name": "sebastian/object-enumerator", - "version": "2.0.1", + "version": "3.0.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/object-enumerator.git", - "reference": "1311872ac850040a79c3c058bea3e22d0f09cbb7" + "reference": "7cfd9e65d11ffb5af41198476395774d4c8a84c5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/1311872ac850040a79c3c058bea3e22d0f09cbb7", - "reference": "1311872ac850040a79c3c058bea3e22d0f09cbb7", + "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/7cfd9e65d11ffb5af41198476395774d4c8a84c5", + "reference": "7cfd9e65d11ffb5af41198476395774d4c8a84c5", "shasum": "" }, "require": { - "php": ">=5.6", - "sebastian/recursion-context": "~2.0" + "php": "^7.0", + "sebastian/object-reflector": "^1.1.1", + "sebastian/recursion-context": "^3.0" }, "require-dev": { - "phpunit/phpunit": "~5" + "phpunit/phpunit": "^6.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0.x-dev" + "dev-master": "3.0.x-dev" } }, "autoload": { @@ -2343,32 +2856,32 @@ ], "description": "Traverses array structures and object graphs to enumerate all referenced objects", "homepage": "https://github.com/sebastianbergmann/object-enumerator/", - "time": "2017-02-18T15:18:39+00:00" + "time": "2017-08-03T12:35:26+00:00" }, { - "name": "sebastian/recursion-context", - "version": "2.0.0", + "name": "sebastian/object-reflector", + "version": "1.1.1", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/recursion-context.git", - "reference": "2c3ba150cbec723aa057506e73a8d33bdb286c9a" + "url": "https://github.com/sebastianbergmann/object-reflector.git", + "reference": "773f97c67f28de00d397be301821b06708fca0be" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/2c3ba150cbec723aa057506e73a8d33bdb286c9a", - "reference": "2c3ba150cbec723aa057506e73a8d33bdb286c9a", + "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/773f97c67f28de00d397be301821b06708fca0be", + "reference": "773f97c67f28de00d397be301821b06708fca0be", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": "^7.0" }, "require-dev": { - "phpunit/phpunit": "~4.4" + "phpunit/phpunit": "^6.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0.x-dev" + "dev-master": "1.1-dev" } }, "autoload": { @@ -2381,44 +2894,39 @@ "BSD-3-Clause" ], "authors": [ - { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, { "name": "Sebastian Bergmann", "email": "sebastian@phpunit.de" - }, - { - "name": "Adam Harvey", - "email": "aharvey@php.net" } ], - "description": "Provides functionality to recursively process PHP variables", - "homepage": "http://www.github.com/sebastianbergmann/recursion-context", - "time": "2016-11-19T07:33:16+00:00" + "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/resource-operations", - "version": "1.0.0", + "name": "sebastian/recursion-context", + "version": "3.0.0", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/resource-operations.git", - "reference": "ce990bb21759f94aeafd30209e8cfcdfa8bc3f52" + "url": "https://github.com/sebastianbergmann/recursion-context.git", + "reference": "5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/ce990bb21759f94aeafd30209e8cfcdfa8bc3f52", - "reference": "ce990bb21759f94aeafd30209e8cfcdfa8bc3f52", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8", + "reference": "5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8", "shasum": "" }, "require": { - "php": ">=5.6.0" + "php": "^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "3.0.x-dev" } }, "autoload": { @@ -2431,36 +2939,44 @@ "BSD-3-Clause" ], "authors": [ + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, { "name": "Sebastian Bergmann", "email": "sebastian@phpunit.de" + }, + { + "name": "Adam Harvey", + "email": "aharvey@php.net" } ], - "description": "Provides a list of PHP built-in functions that operate on resources", - "homepage": "https://www.github.com/sebastianbergmann/resource-operations", - "time": "2015-07-28T20:34:47+00:00" + "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/version", + "name": "sebastian/resource-operations", "version": "2.0.1", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/version.git", - "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019" + "url": "https://github.com/sebastianbergmann/resource-operations.git", + "reference": "4d7a795d35b889bf80a0cc04e08d77cedfa917a9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/99732be0ddb3361e16ad77b68ba41efc8e979019", - "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019", + "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/4d7a795d35b889bf80a0cc04e08d77cedfa917a9", + "reference": "4d7a795d35b889bf80a0cc04e08d77cedfa917a9", "shasum": "" }, "require": { - "php": ">=5.6" + "php": "^7.1" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0.x-dev" + "dev-master": "2.0-dev" } }, "autoload": { @@ -2475,78 +2991,72 @@ "authors": [ { "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" + "email": "sebastian@phpunit.de" } ], - "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": "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" }, { - "name": "seld/cli-prompt", - "version": "1.0.3", + "name": "sebastian/version", + "version": "2.0.1", "source": { "type": "git", - "url": "https://github.com/Seldaek/cli-prompt.git", - "reference": "a19a7376a4689d4d94cab66ab4f3c816019ba8dd" + "url": "https://github.com/sebastianbergmann/version.git", + "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Seldaek/cli-prompt/zipball/a19a7376a4689d4d94cab66ab4f3c816019ba8dd", - "reference": "a19a7376a4689d4d94cab66ab4f3c816019ba8dd", + "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/99732be0ddb3361e16ad77b68ba41efc8e979019", + "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019", "shasum": "" }, "require": { - "php": ">=5.3" + "php": ">=5.6" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.x-dev" + "dev-master": "2.0.x-dev" } }, "autoload": { - "psr-4": { - "Seld\\CliPrompt\\": "src/" - } + "classmap": [ + "src/" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ - "MIT" + "BSD-3-Clause" ], "authors": [ { - "name": "Jordi Boggiano", - "email": "j.boggiano@seld.be" + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" } ], - "description": "Allows you to prompt for user input on the command line, and optionally hide the characters they type", - "keywords": [ - "cli", - "console", - "hidden", - "input", - "prompt" - ], - "time": "2017-03-18T11:32:45+00:00" + "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" }, { "name": "seld/jsonlint", - "version": "1.7.1", + "version": "1.8.2", "source": { "type": "git", "url": "https://github.com/Seldaek/jsonlint.git", - "reference": "d15f59a67ff805a44c50ea0516d2341740f81a38" + "reference": "590cfec960b77fd55e39b7d9246659e95dd6d337" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Seldaek/jsonlint/zipball/d15f59a67ff805a44c50ea0516d2341740f81a38", - "reference": "d15f59a67ff805a44c50ea0516d2341740f81a38", + "url": "https://api.github.com/repos/Seldaek/jsonlint/zipball/590cfec960b77fd55e39b7d9246659e95dd6d337", + "reference": "590cfec960b77fd55e39b7d9246659e95dd6d337", "shasum": "" }, "require": { - "php": "^5.3 || ^7.0" + "php": "^5.3 || ^7.0 || ^8.0" }, "require-dev": { "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0" @@ -2578,20 +3088,30 @@ "parser", "validator" ], - "time": "2018-01-24T12:46:19+00:00" + "funding": [ + { + "url": "https://github.com/Seldaek", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/seld/jsonlint", + "type": "tidelift" + } + ], + "time": "2020-08-25T06:56:57+00:00" }, { "name": "seld/phar-utils", - "version": "1.0.1", + "version": "1.1.1", "source": { "type": "git", "url": "https://github.com/Seldaek/phar-utils.git", - "reference": "7009b5139491975ef6486545a39f3e6dad5ac30a" + "reference": "8674b1d84ffb47cc59a101f5d5a3b61e87d23796" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Seldaek/phar-utils/zipball/7009b5139491975ef6486545a39f3e6dad5ac30a", - "reference": "7009b5139491975ef6486545a39f3e6dad5ac30a", + "url": "https://api.github.com/repos/Seldaek/phar-utils/zipball/8674b1d84ffb47cc59a101f5d5a3b61e87d23796", + "reference": "8674b1d84ffb47cc59a101f5d5a3b61e87d23796", "shasum": "" }, "require": { @@ -2620,70 +3140,43 @@ ], "description": "PHAR file format utilities, for when PHP phars you up", "keywords": [ - "phra" + "phar" ], - "time": "2015-10-13T18:44:15+00:00" + "time": "2020-07-07T18:42:57+00:00" }, { "name": "squizlabs/php_codesniffer", - "version": "2.9.1", + "version": "3.5.6", "source": { "type": "git", "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", - "reference": "dcbed1074f8244661eecddfc2a675430d8d33f62" + "reference": "e97627871a7eab2f70e59166072a6b767d5834e0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/dcbed1074f8244661eecddfc2a675430d8d33f62", - "reference": "dcbed1074f8244661eecddfc2a675430d8d33f62", + "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/e97627871a7eab2f70e59166072a6b767d5834e0", + "reference": "e97627871a7eab2f70e59166072a6b767d5834e0", "shasum": "" }, "require": { "ext-simplexml": "*", "ext-tokenizer": "*", "ext-xmlwriter": "*", - "php": ">=5.1.2" + "php": ">=5.4.0" }, "require-dev": { - "phpunit/phpunit": "~4.0" + "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0" }, "bin": [ - "scripts/phpcs", - "scripts/phpcbf" + "bin/phpcs", + "bin/phpcbf" ], "type": "library", "extra": { "branch-alias": { - "dev-master": "2.x-dev" + "dev-master": "3.x-dev" } }, - "autoload": { - "classmap": [ - "CodeSniffer.php", - "CodeSniffer/CLI.php", - "CodeSniffer/Exception.php", - "CodeSniffer/File.php", - "CodeSniffer/Fixer.php", - "CodeSniffer/Report.php", - "CodeSniffer/Reporting.php", - "CodeSniffer/Sniff.php", - "CodeSniffer/Tokens.php", - "CodeSniffer/Reports/", - "CodeSniffer/Tokenizers/", - "CodeSniffer/DocGenerators/", - "CodeSniffer/Standards/AbstractPatternSniff.php", - "CodeSniffer/Standards/AbstractScopeSniff.php", - "CodeSniffer/Standards/AbstractVariableSniff.php", - "CodeSniffer/Standards/IncorrectPatternException.php", - "CodeSniffer/Standards/Generic/Sniffs/", - "CodeSniffer/Standards/MySource/Sniffs/", - "CodeSniffer/Standards/PEAR/Sniffs/", - "CodeSniffer/Standards/PSR1/Sniffs/", - "CodeSniffer/Standards/PSR2/Sniffs/", - "CodeSniffer/Standards/Squiz/Sniffs/", - "CodeSniffer/Standards/Zend/Sniffs/" - ] - }, "notification-url": "https://packagist.org/downloads/", "license": [ "BSD-3-Clause" @@ -2695,42 +3188,53 @@ } ], "description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.", - "homepage": "http://www.squizlabs.com/php-codesniffer", + "homepage": "https://github.com/squizlabs/PHP_CodeSniffer", "keywords": [ "phpcs", "standards" ], - "time": "2017-05-22T02:43:20+00:00" + "time": "2020-08-10T04:50:15+00:00" }, { "name": "symfony/console", - "version": "v4.0.4", + "version": "v5.1.7", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "36d5b41e7d4e1ccf0370f6babe966c08ef0a1488" + "reference": "ae789a8a2ad189ce7e8216942cdb9b77319f5eb8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/36d5b41e7d4e1ccf0370f6babe966c08ef0a1488", - "reference": "36d5b41e7d4e1ccf0370f6babe966c08ef0a1488", + "url": "https://api.github.com/repos/symfony/console/zipball/ae789a8a2ad189ce7e8216942cdb9b77319f5eb8", + "reference": "ae789a8a2ad189ce7e8216942cdb9b77319f5eb8", "shasum": "" }, "require": { - "php": "^7.1.3", - "symfony/polyfill-mbstring": "~1.0" + "php": ">=7.2.5", + "symfony/polyfill-mbstring": "~1.0", + "symfony/polyfill-php73": "^1.8", + "symfony/polyfill-php80": "^1.15", + "symfony/service-contracts": "^1.1|^2", + "symfony/string": "^5.1" }, "conflict": { - "symfony/dependency-injection": "<3.4", - "symfony/process": "<3.3" + "symfony/dependency-injection": "<4.4", + "symfony/dotenv": "<5.1", + "symfony/event-dispatcher": "<4.4", + "symfony/lock": "<4.4", + "symfony/process": "<4.4" + }, + "provide": { + "psr/log-implementation": "1.0" }, "require-dev": { "psr/log": "~1.0", - "symfony/config": "~3.4|~4.0", - "symfony/dependency-injection": "~3.4|~4.0", - "symfony/event-dispatcher": "~3.4|~4.0", - "symfony/lock": "~3.4|~4.0", - "symfony/process": "~3.4|~4.0" + "symfony/config": "^4.4|^5.0", + "symfony/dependency-injection": "^4.4|^5.0", + "symfony/event-dispatcher": "^4.4|^5.0", + "symfony/lock": "^4.4|^5.0", + "symfony/process": "^4.4|^5.0", + "symfony/var-dumper": "^4.4|^5.0" }, "suggest": { "psr/log": "For using the console logger", @@ -2741,7 +3245,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.0-dev" + "dev-master": "5.1-dev" } }, "autoload": { @@ -2768,29 +3272,43 @@ ], "description": "Symfony Console Component", "homepage": "https://symfony.com", - "time": "2018-01-29T09:06:29+00:00" + "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-07T15:23:00+00:00" }, { "name": "symfony/finder", - "version": "v4.0.4", + "version": "v5.1.7", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "8b08180f2b7ccb41062366b9ad91fbc4f1af8601" + "reference": "2c3ba7ad6884e6c4451ce2340e2dc23f6fa3e0d8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/8b08180f2b7ccb41062366b9ad91fbc4f1af8601", - "reference": "8b08180f2b7ccb41062366b9ad91fbc4f1af8601", + "url": "https://api.github.com/repos/symfony/finder/zipball/2c3ba7ad6884e6c4451ce2340e2dc23f6fa3e0d8", + "reference": "2c3ba7ad6884e6c4451ce2340e2dc23f6fa3e0d8", "shasum": "" }, "require": { - "php": "^7.1.3" + "php": ">=7.2.5" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.0-dev" + "dev-master": "5.1-dev" } }, "autoload": { @@ -2817,20 +3335,193 @@ ], "description": "Symfony Finder Component", "homepage": "https://symfony.com", - "time": "2018-01-03T07:38:00+00:00" + "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-09-02T16:23:27+00:00" + }, + { + "name": "symfony/polyfill-intl-grapheme", + "version": "v1.18.1", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-intl-grapheme.git", + "reference": "b740103edbdcc39602239ee8860f0f45a8eb9aa5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/b740103edbdcc39602239ee8860f0f45a8eb9aa5", + "reference": "b740103edbdcc39602239ee8860f0f45a8eb9aa5", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "suggest": { + "ext-intl": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.18-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Intl\\Grapheme\\": "" + }, + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for intl's grapheme_* functions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "grapheme", + "intl", + "polyfill", + "portable", + "shim" + ], + "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-07-14T12:35:20+00:00" + }, + { + "name": "symfony/polyfill-intl-normalizer", + "version": "v1.18.1", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-intl-normalizer.git", + "reference": "37078a8dd4a2a1e9ab0231af7c6cb671b2ed5a7e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/37078a8dd4a2a1e9ab0231af7c6cb671b2ed5a7e", + "reference": "37078a8dd4a2a1e9ab0231af7c6cb671b2ed5a7e", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "suggest": { + "ext-intl": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.18-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Intl\\Normalizer\\": "" + }, + "files": [ + "bootstrap.php" + ], + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for intl's Normalizer class and related functions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "intl", + "normalizer", + "polyfill", + "portable", + "shim" + ], + "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-07-14T12:35:20+00:00" }, { "name": "symfony/polyfill-mbstring", - "version": "v1.7.0", + "version": "v1.18.1", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "78be803ce01e55d3491c1397cf1c64beb9c1b63b" + "reference": "a6977d63bf9a0ad4c65cd352709e230876f9904a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/78be803ce01e55d3491c1397cf1c64beb9c1b63b", - "reference": "78be803ce01e55d3491c1397cf1c64beb9c1b63b", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/a6977d63bf9a0ad4c65cd352709e230876f9904a", + "reference": "a6977d63bf9a0ad4c65cd352709e230876f9904a", "shasum": "" }, "require": { @@ -2842,7 +3533,11 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.7-dev" + "dev-master": "1.18-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" } }, "autoload": { @@ -2876,44 +3571,295 @@ "portable", "shim" ], - "time": "2018-01-30T19:27:44+00:00" + "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-07-14T12:35:20+00:00" + }, + { + "name": "symfony/polyfill-php73", + "version": "v1.18.1", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php73.git", + "reference": "fffa1a52a023e782cdcc221d781fe1ec8f87fcca" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/fffa1a52a023e782cdcc221d781fe1ec8f87fcca", + "reference": "fffa1a52a023e782cdcc221d781fe1ec8f87fcca", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.18-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Php73\\": "" + }, + "files": [ + "bootstrap.php" + ], + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 7.3+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "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-07-14T12:35:20+00:00" }, { - "name": "symfony/yaml", - "version": "v4.0.4", + "name": "symfony/polyfill-php80", + "version": "v1.18.1", "source": { "type": "git", - "url": "https://github.com/symfony/yaml.git", - "reference": "ffc60bda1d4a00ec0b32eeabf39dc017bf480028" + "url": "https://github.com/symfony/polyfill-php80.git", + "reference": "d87d5766cbf48d72388a9f6b85f280c8ad51f981" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/ffc60bda1d4a00ec0b32eeabf39dc017bf480028", - "reference": "ffc60bda1d4a00ec0b32eeabf39dc017bf480028", + "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/d87d5766cbf48d72388a9f6b85f280c8ad51f981", + "reference": "d87d5766cbf48d72388a9f6b85f280c8ad51f981", "shasum": "" }, "require": { - "php": "^7.1.3" + "php": ">=7.0.8" }, - "conflict": { - "symfony/console": "<3.4" + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.18-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } }, - "require-dev": { - "symfony/console": "~3.4|~4.0" + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Php80\\": "" + }, + "files": [ + "bootstrap.php" + ], + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Ion Bazan", + "email": "ion.bazan@gmail.com" + }, + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "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-07-14T12:35:20+00:00" + }, + { + "name": "symfony/service-contracts", + "version": "v2.2.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/service-contracts.git", + "reference": "d15da7ba4957ffb8f1747218be9e1a121fd298a1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/service-contracts/zipball/d15da7ba4957ffb8f1747218be9e1a121fd298a1", + "reference": "d15da7ba4957ffb8f1747218be9e1a121fd298a1", + "shasum": "" + }, + "require": { + "php": ">=7.2.5", + "psr/container": "^1.0" }, "suggest": { - "symfony/console": "For validating YAML files using the lint command" + "symfony/service-implementation": "" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.0-dev" + "dev-master": "2.2-dev" + }, + "thanks": { + "name": "symfony/contracts", + "url": "https://github.com/symfony/contracts" } }, "autoload": { "psr-4": { - "Symfony\\Component\\Yaml\\": "" + "Symfony\\Contracts\\Service\\": "" + } + }, + "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": "Generic abstractions related to writing services", + "homepage": "https://symfony.com", + "keywords": [ + "abstractions", + "contracts", + "decoupling", + "interfaces", + "interoperability", + "standards" + ], + "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-09-07T11:33:47+00:00" + }, + { + "name": "symfony/string", + "version": "v5.1.7", + "source": { + "type": "git", + "url": "https://github.com/symfony/string.git", + "reference": "4a9afe9d07bac506f75bcee8ed3ce76da5a9343e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/string/zipball/4a9afe9d07bac506f75bcee8ed3ce76da5a9343e", + "reference": "4a9afe9d07bac506f75bcee8ed3ce76da5a9343e", + "shasum": "" + }, + "require": { + "php": ">=7.2.5", + "symfony/polyfill-ctype": "~1.8", + "symfony/polyfill-intl-grapheme": "~1.0", + "symfony/polyfill-intl-normalizer": "~1.0", + "symfony/polyfill-mbstring": "~1.0", + "symfony/polyfill-php80": "~1.15" + }, + "require-dev": { + "symfony/error-handler": "^4.4|^5.0", + "symfony/http-client": "^4.4|^5.0", + "symfony/translation-contracts": "^1.1|^2", + "symfony/var-exporter": "^4.4|^5.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.1-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\String\\": "" + }, + "files": [ + "Resources/functions.php" + ], "exclude-from-classmap": [ "/Tests/" ] @@ -2924,45 +3870,112 @@ ], "authors": [ { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" + "name": "Nicolas Grekas", + "email": "p@tchwork.com" }, { "name": "Symfony Community", "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony Yaml Component", + "description": "Symfony String component", "homepage": "https://symfony.com", - "time": "2018-01-21T19:06:11+00:00" + "keywords": [ + "grapheme", + "i18n", + "string", + "unicode", + "utf-8", + "utf8" + ], + "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-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.3.0", + "version": "1.9.1", "source": { "type": "git", "url": "https://github.com/webmozart/assert.git", - "reference": "0df1908962e7a3071564e857d86874dad1ef204a" + "reference": "bafc69caeb4d49c39fd0779086c03a3738cbb389" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/webmozart/assert/zipball/0df1908962e7a3071564e857d86874dad1ef204a", - "reference": "0df1908962e7a3071564e857d86874dad1ef204a", + "url": "https://api.github.com/repos/webmozart/assert/zipball/bafc69caeb4d49c39fd0779086c03a3738cbb389", + "reference": "bafc69caeb4d49c39fd0779086c03a3738cbb389", "shasum": "" }, "require": { - "php": "^5.3.3 || ^7.0" + "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.6", - "sebastian/version": "^1.0.1" + "phpunit/phpunit": "^4.8.36 || ^7.5.13" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.3-dev" - } - }, "autoload": { "psr-4": { "Webmozart\\Assert\\": "src/" @@ -2984,17 +3997,20 @@ "check", "validate" ], - "time": "2018-01-29T19:49:41+00:00" + "time": "2020-07-08T17:02:28+00:00" } ], "aliases": [], "minimum-stability": "stable", - "stability-flags": [], + "stability-flags": { + "php-school/cli-menu": 20 + }, "prefer-stable": false, "prefer-lowest": false, "platform": { - "php": ">=5.6", + "php": ">=7.1", "ext-pdo_sqlite": "*" }, - "platform-dev": [] + "platform-dev": [], + "plugin-api-version": "1.1.0" } diff --git a/src/Application.php b/src/Application.php index e1a3b0cd..41a74c0d 100644 --- a/src/Application.php +++ b/src/Application.php @@ -13,9 +13,6 @@ /** * This is the main application class, this takes care of bootstrapping, routing and * output. - * - * @package PhpSchool\PhpWorkshop - * @author Aydin Hassan */ final class Application { diff --git a/src/Check/CheckInterface.php b/src/Check/CheckInterface.php index 0c3764a4..c1fc2061 100644 --- a/src/Check/CheckInterface.php +++ b/src/Check/CheckInterface.php @@ -4,24 +4,17 @@ /** * Base Interface for Checks. - * - * @package PhpSchool\PhpWorkshop\Comparator - * @author Aydin Hassan */ interface CheckInterface { /** * Return the check's name - * - * @return string */ - public function getName(); + public function getName() : string; /** * This returns the interface the exercise should implement * when requiring this check. It should be the FQCN of the interface. - * - * @return string */ - public function getExerciseInterface(); + public function getExerciseInterface() : string; } diff --git a/src/Check/CheckRepository.php b/src/Check/CheckRepository.php index 68f431fe..33e30a55 100644 --- a/src/Check/CheckRepository.php +++ b/src/Check/CheckRepository.php @@ -7,9 +7,6 @@ /** * This class is the repository containing all the available checks * for the workshop framework. - * - * @package PhpSchool\PhpWorkshop\Check - * @author Aydin Hassan */ class CheckRepository { @@ -30,10 +27,8 @@ public function __construct(array $checks = []) /** * Add a new check to the repository. - * - * @param CheckInterface $check The check instance to add. */ - public function registerCheck(CheckInterface $check) + public function registerCheck(CheckInterface $check) : void { $this->checks[get_class($check)] = $check; } @@ -43,7 +38,7 @@ public function registerCheck(CheckInterface $check) * * @return array */ - public function getAll() + public function getAll() : array { return array_values($this->checks); } @@ -55,7 +50,7 @@ public function getAll() * @return CheckInterface The instance. * @throws InvalidArgumentException If an instance of the check does not exist. */ - public function getByClass($class) + public function getByClass(string $class) : CheckInterface { if (!isset($this->checks[$class])) { throw new InvalidArgumentException(sprintf('Check: "%s" does not exist', $class)); @@ -66,11 +61,8 @@ public function getByClass($class) /** * Query whether a check instance exists in this repository via its class name. - * - * @param string $class - * @return bool */ - public function has($class) + public function has(string $class) : bool { try { $this->getByClass($class); diff --git a/src/Check/CodeParseCheck.php b/src/Check/CodeParseCheck.php index 4cb96b57..6f557ba6 100644 --- a/src/Check/CodeParseCheck.php +++ b/src/Check/CodeParseCheck.php @@ -16,13 +16,9 @@ /** * This check attempts to parse a student's solution and returns * a success or failure based on the result of the parsing. - * - * @package PhpSchool\PhpWorkshop\Check - * @author Aydin Hassan */ class CodeParseCheck implements SimpleCheckInterface { - /** * @var Parser */ @@ -38,10 +34,8 @@ public function __construct(Parser $parser) /** * Return the check's name - * - * @return string */ - public function getName() + public function getName() : string { return 'Code Parse Check'; } @@ -55,7 +49,7 @@ public function getName() * @param Input $input The command line arguments passed to the command. * @return ResultInterface The result of the check. */ - public function check(ExerciseInterface $exercise, Input $input) + public function check(ExerciseInterface $exercise, Input $input) : ResultInterface { $code = file_get_contents($input->getArgument('program')); @@ -71,19 +65,16 @@ public function check(ExerciseInterface $exercise, Input $input) /** * This check can run on any exercise type. - * - * @param ExerciseType $exerciseType - * @return bool */ - public function canRun(ExerciseType $exerciseType) + public function canRun(ExerciseType $exerciseType) : bool { - return in_array($exerciseType->getValue(), [ExerciseType::CGI, ExerciseType::CLI]); + return in_array($exerciseType->getValue(), [ExerciseType::CGI, ExerciseType::CLI], true); } /** * @return string */ - public function getExerciseInterface() + public function getExerciseInterface() : string { return ExerciseInterface::class; } @@ -91,10 +82,8 @@ public function getExerciseInterface() /** * This check should be run before executing the student's solution, as, if it cannot be parsed * it probably cannot be executed. - * - * @return string */ - public function getPosition() + public function getPosition() : string { return SimpleCheckInterface::CHECK_BEFORE; } diff --git a/src/Check/ComposerCheck.php b/src/Check/ComposerCheck.php index e958f6a3..c5cb9f64 100644 --- a/src/Check/ComposerCheck.php +++ b/src/Check/ComposerCheck.php @@ -14,18 +14,14 @@ /** * This check looks for a set of composer packages specified by the exercise * in the students `composer.lock` file. - * - * @author Aydin Hassan */ class ComposerCheck implements SimpleCheckInterface { /** * Return the check's name - * - * @return string */ - public function getName() + public function getName() : string { return 'Composer Dependency Check'; } @@ -39,7 +35,7 @@ public function getName() * @param Input $input The command line arguments passed to the command. * @return ResultInterface The result of the check. */ - public function check(ExerciseInterface $exercise, Input $input) + public function check(ExerciseInterface $exercise, Input $input) : ResultInterface { if (!$exercise instanceof ComposerExerciseCheck) { throw new \InvalidArgumentException; @@ -77,30 +73,21 @@ public function check(ExerciseInterface $exercise, Input $input) /** * This check can run on any exercise type. - * - * @param ExerciseType $exerciseType - * @return bool */ - public function canRun(ExerciseType $exerciseType) + public function canRun(ExerciseType $exerciseType) : bool { - return in_array($exerciseType->getValue(), [ExerciseType::CGI, ExerciseType::CLI]); + return in_array($exerciseType->getValue(), [ExerciseType::CGI, ExerciseType::CLI], true); } - /** - * - * @return string - */ - public function getExerciseInterface() + public function getExerciseInterface() : string { return ComposerExerciseCheck::class; } /** * This check can run before because if it fails, there is no point executing the solution. - * - * @return string */ - public function getPosition() + public function getPosition() : string { return SimpleCheckInterface::CHECK_BEFORE; } diff --git a/src/Check/DatabaseCheck.php b/src/Check/DatabaseCheck.php index 3b96041f..b9084afc 100644 --- a/src/Check/DatabaseCheck.php +++ b/src/Check/DatabaseCheck.php @@ -3,7 +3,6 @@ namespace PhpSchool\PhpWorkshop\Check; use PDO; -use PhpSchool\PhpWorkshop\Event\CliEvent; use PhpSchool\PhpWorkshop\Event\CliExecuteEvent; use PhpSchool\PhpWorkshop\Event\Event; use PhpSchool\PhpWorkshop\Event\EventDispatcher; @@ -11,15 +10,12 @@ use PhpSchool\PhpWorkshop\ExerciseCheck\DatabaseExerciseCheck; use PhpSchool\PhpWorkshop\Result\Failure; use PhpSchool\PhpWorkshop\Result\Success; -use Symfony\Component\Process\Process; /** * This check sets up a database and a `PDO` object. It prepends the database DSN as a CLI argument to the student's * solution so they can connect to the database. The `PDO` object is passed to the exercise before and after the * student's solution has been executed, allowing you to first seed the database and then verify the contents of the * database. - * - * @author Aydin Hassan */ class DatabaseCheck implements ListenableCheckInterface { @@ -64,18 +60,13 @@ public function __construct() /** * Return the check's name - * - * @return string */ - public function getName() + public function getName() : string { return 'Database Verification Check'; } - /** - * @return string - */ - public function getExerciseInterface() + public function getExerciseInterface() : string { return DatabaseExerciseCheck::class; } @@ -83,10 +74,8 @@ public function getExerciseInterface() /** * Here we attach to various events to seed, verify and inject the DSN's * to the student & reference solution programs's CLI arguments. - * - * @param EventDispatcher $eventDispatcher */ - public function attach(EventDispatcher $eventDispatcher) + public function attach(EventDispatcher $eventDispatcher) : void { if (file_exists($this->databaseDirectory)) { throw new \RuntimeException( diff --git a/src/Check/FileExistsCheck.php b/src/Check/FileExistsCheck.php index 59db5ec8..35b9fc0d 100644 --- a/src/Check/FileExistsCheck.php +++ b/src/Check/FileExistsCheck.php @@ -11,18 +11,13 @@ /** * This check verifies that the student's solution file actually exists. - * - * @package PhpSchool\PhpWorkshop\Check - * @author Aydin Hassan */ class FileExistsCheck implements SimpleCheckInterface { /** * Return the check's name. - * - * @return string */ - public function getName() + public function getName() : string { return 'File Exists Check'; } @@ -34,7 +29,7 @@ public function getName() * @param Input $input The command line arguments passed to the command. * @return ResultInterface The result of the check. */ - public function check(ExerciseInterface $exercise, Input $input) + public function check(ExerciseInterface $exercise, Input $input) : ResultInterface { if (file_exists($input->getArgument('program'))) { return Success::fromCheck($this); @@ -45,30 +40,21 @@ public function check(ExerciseInterface $exercise, Input $input) /** * This check can run on any exercise type. - * - * @param ExerciseType $exerciseType - * @return bool */ - public function canRun(ExerciseType $exerciseType) + public function canRun(ExerciseType $exerciseType) : bool { - return in_array($exerciseType->getValue(), [ExerciseType::CGI, ExerciseType::CLI]); + return in_array($exerciseType->getValue(), [ExerciseType::CGI, ExerciseType::CLI], true); } - /** - * - * @return string - */ - public function getExerciseInterface() + public function getExerciseInterface() : string { return ExerciseInterface::class; } /** * This check must run before executing the solution becuase it may not exist. - * - * @return string */ - public function getPosition() + public function getPosition() : string { return SimpleCheckInterface::CHECK_BEFORE; } diff --git a/src/Check/FunctionRequirementsCheck.php b/src/Check/FunctionRequirementsCheck.php index 066ab2f2..112e6ff0 100644 --- a/src/Check/FunctionRequirementsCheck.php +++ b/src/Check/FunctionRequirementsCheck.php @@ -19,9 +19,6 @@ /** * This check verifies that the student's solution contains usages of some required functions * and also does not use certain functions (specified by the exercise). - * - * @package PhpSchool\PhpWorkshop\Check - * @author Aydin Hassan */ class FunctionRequirementsCheck implements SimpleCheckInterface { @@ -41,10 +38,8 @@ public function __construct(Parser $parser) /** * Return the check's name. - * - * @return string */ - public function getName() + public function getName() : string { return 'Function Requirements Check'; } @@ -58,7 +53,7 @@ public function getName() * @param Input $input The command line arguments passed to the command. * @return ResultInterface The result of the check. */ - public function check(ExerciseInterface $exercise, Input $input) + public function check(ExerciseInterface $exercise, Input $input) : ResultInterface { if (!$exercise instanceof FunctionRequirementsExerciseCheck) { throw new \InvalidArgumentException; @@ -102,19 +97,13 @@ public function check(ExerciseInterface $exercise, Input $input) /** * This check can run on any exercise type. - * - * @param ExerciseType $exerciseType - * @return bool */ - public function canRun(ExerciseType $exerciseType) + public function canRun(ExerciseType $exerciseType) : bool { - return in_array($exerciseType->getValue(), [ExerciseType::CGI, ExerciseType::CLI]); + return in_array($exerciseType->getValue(), [ExerciseType::CGI, ExerciseType::CLI], true); } - /** - * @return string - */ - public function getExerciseInterface() + public function getExerciseInterface() : string { return FunctionRequirementsExerciseCheck::class; } @@ -123,10 +112,8 @@ public function getExerciseInterface() * This is performed after executing the student's solution because the solution may produce the correct * output, but do it in a way that was not correct for the task. This way the student can see the program works * but missed some requirements. - * - * @return string */ - public function getPosition() + public function getPosition() : string { return SimpleCheckInterface::CHECK_AFTER; } diff --git a/src/Check/ListenableCheckInterface.php b/src/Check/ListenableCheckInterface.php index 64aa12dc..53835d21 100644 --- a/src/Check/ListenableCheckInterface.php +++ b/src/Check/ListenableCheckInterface.php @@ -6,17 +6,12 @@ /** * The interface for advanced listener checks which can execute logic at any dispatched event. - * - * @package PhpSchool\PhpWorkshop\Check - * @author Aydin Hassan */ interface ListenableCheckInterface extends CheckInterface { /** * Attach to events throughout the running/verifying process. Inject verifiers * and listeners. - * - * @param EventDispatcher $eventDispatcher */ - public function attach(EventDispatcher $eventDispatcher); + public function attach(EventDispatcher $eventDispatcher) : void; } diff --git a/src/Check/PhpLintCheck.php b/src/Check/PhpLintCheck.php index 5c7b48a8..a2cfe06c 100644 --- a/src/Check/PhpLintCheck.php +++ b/src/Check/PhpLintCheck.php @@ -13,19 +13,14 @@ /** * This check attempts to lint a student's solution and returns * a success or failure based on the result of the linting. - * - * @package PhpSchool\PhpWorkshop\Check - * @author Aydin Hassan */ class PhpLintCheck implements SimpleCheckInterface { /** * Return the check's name - * - * @return string */ - public function getName() + public function getName() : string { return 'PHP Code Check'; } @@ -37,7 +32,7 @@ public function getName() * @param Input $input The command line arguments passed to the command. * @return ResultInterface The result of the check. */ - public function check(ExerciseInterface $exercise, Input $input) + public function check(ExerciseInterface $exercise, Input $input) : ResultInterface { $process = new Process(sprintf('%s -l %s', PHP_BINARY, $input->getArgument('program'))); $process->run(); @@ -46,24 +41,18 @@ public function check(ExerciseInterface $exercise, Input $input) return Success::fromCheck($this); } - return Failure::fromCheckAndReason($this, $process->getErrorOutput()); + return Failure::fromCheckAndReason($this, trim($process->getOutput())); } /** * This check can run on any exercise type. - * - * @param ExerciseType $exerciseType - * @return bool */ - public function canRun(ExerciseType $exerciseType) + public function canRun(ExerciseType $exerciseType) : bool { - return in_array($exerciseType->getValue(), [ExerciseType::CGI, ExerciseType::CLI]); + return in_array($exerciseType->getValue(), [ExerciseType::CGI, ExerciseType::CLI], true); } - /** - * @return string - */ - public function getExerciseInterface() + public function getExerciseInterface() : string { return ExerciseInterface::class; } @@ -71,10 +60,8 @@ public function getExerciseInterface() /** * This check should be run before executing the student's solution, as, if it cannot be linted * it probably cannot be executed. - * - * @return string */ - public function getPosition() + public function getPosition() : string { return SimpleCheckInterface::CHECK_BEFORE; } diff --git a/src/Check/SimpleCheckInterface.php b/src/Check/SimpleCheckInterface.php index 14e6e29c..21b99be5 100644 --- a/src/Check/SimpleCheckInterface.php +++ b/src/Check/SimpleCheckInterface.php @@ -10,9 +10,6 @@ /** * The interface for simple checks, checks that execute at one defined point, before or after * output verification. - * - * @package PhpSchool\PhpWorkshop\Comparator - * @author Aydin Hassan */ interface SimpleCheckInterface extends CheckInterface { @@ -21,22 +18,19 @@ interface SimpleCheckInterface extends CheckInterface * * @return string */ - const CHECK_BEFORE = 'before'; + public const CHECK_BEFORE = 'before'; /** * Run this check after exercise verifying * * @return string */ - const CHECK_AFTER = 'after'; + public const CHECK_AFTER = 'after'; /** * Can this check run this exercise? - * - * @param ExerciseType $exerciseType - * @return bool */ - public function canRun(ExerciseType $exerciseType); + public function canRun(ExerciseType $exerciseType) : bool; /** * The check is ran against an exercise and a filename which @@ -51,12 +45,12 @@ public function canRun(ExerciseType $exerciseType); * @param Input $input The command line arguments passed to the command. * @return ResultInterface The result of the check. */ - public function check(ExerciseInterface $exercise, Input $input); + public function check(ExerciseInterface $exercise, Input $input) : ResultInterface; /** * Either `static::CHECK_BEFORE` | `static::CHECK_AFTER`. * * @return string */ - public function getPosition(); + public function getPosition() : string; } diff --git a/src/CodeInsertion.php b/src/CodeInsertion.php index 567cf97c..f916ca7e 100644 --- a/src/CodeInsertion.php +++ b/src/CodeInsertion.php @@ -7,9 +7,6 @@ /** * This class is a simple DTO to represent a code insertion which should * be performed on a students solution. - * - * @package PhpSchool\PhpWorkshop - * @author Aydin Hassan */ class CodeInsertion { diff --git a/src/CodePatcher.php b/src/CodePatcher.php index af29e6c7..aabac59f 100644 --- a/src/CodePatcher.php +++ b/src/CodePatcher.php @@ -5,19 +5,13 @@ use PhpParser\Error; use PhpParser\Parser; use PhpParser\PrettyPrinter\Standard; -use PhpSchool\PhpWorkshop\Exercise\AstIntrospectable; use PhpSchool\PhpWorkshop\Exercise\ExerciseInterface; -use PhpSchool\PhpWorkshop\Exercise\PreProcessable; use PhpSchool\PhpWorkshop\Exercise\SubmissionPatchable; -use PhpSchool\PhpWorkshop\Exercise\SubmissionPatcher; /** * Service to apply patches to a student's solution. Accepts a default patch via the constructor. * Patches are pulled from the exercise (if it implements `SubmissionPatchable`) and applied to the * given code. - * - * @package PhpSchool\PhpWorkshop - * @author Aydin Hassan */ class CodePatcher { diff --git a/src/Command/CreditsCommand.php b/src/Command/CreditsCommand.php index 7f6a58cb..c5951225 100644 --- a/src/Command/CreditsCommand.php +++ b/src/Command/CreditsCommand.php @@ -7,10 +7,6 @@ /** * A command to display the framework and workshop credits. - * - * @package PhpSchool\PhpWorkshop\Command - * @author Aydin Hassan - * @author Michael Woodward */ class CreditsCommand { diff --git a/src/Command/MenuCommand.php b/src/Command/MenuCommand.php index 7e22b116..673ed73c 100644 --- a/src/Command/MenuCommand.php +++ b/src/Command/MenuCommand.php @@ -4,11 +4,6 @@ use PhpSchool\CliMenu\CliMenu; -/** - * Class MenuCommand - * @package PhpSchool\PhpWorkshop\Command - * @author Aydin Hassan - */ class MenuCommand { /** diff --git a/src/Command/MenuCommandInvoker.php b/src/Command/MenuCommandInvoker.php index 5aa09eb5..9ea2deb2 100644 --- a/src/Command/MenuCommandInvoker.php +++ b/src/Command/MenuCommandInvoker.php @@ -4,11 +4,6 @@ use PhpSchool\CliMenu\CliMenu; -/** - * Class MenuCommandInvoker - * @package PhpSchool\PhpWorkshop\Command - * @author Aydin Hassan - */ class MenuCommandInvoker { diff --git a/src/Command/RunCommand.php b/src/Command/RunCommand.php index b8a5820f..4684918a 100644 --- a/src/Command/RunCommand.php +++ b/src/Command/RunCommand.php @@ -9,11 +9,6 @@ use PhpSchool\PhpWorkshop\UserState; use PhpSchool\PhpWorkshop\UserStateSerializer; -/** - * Class RunCommand - * @package PhpSchool\PhpWorkshop\Command - * @author Michael Woodward - */ class RunCommand { /** diff --git a/src/Command/VerifyCommand.php b/src/Command/VerifyCommand.php index b98baf1c..9f153b36 100644 --- a/src/Command/VerifyCommand.php +++ b/src/Command/VerifyCommand.php @@ -11,11 +11,6 @@ use PhpSchool\PhpWorkshop\UserState; use PhpSchool\PhpWorkshop\UserStateSerializer; -/** - * Class VerifyCommand - * @package PhpSchool\PhpWorkshop\Command - * @author Aydin Hassan - */ class VerifyCommand { /** diff --git a/src/CommandDefinition.php b/src/CommandDefinition.php index 62851fa7..923bc4b1 100644 --- a/src/CommandDefinition.php +++ b/src/CommandDefinition.php @@ -8,9 +8,6 @@ * Represents a command in the workshop framework. Simply consists of a * command name, required arguments and either a service name or callable to * execute when the command is run. - * - * @package PhpSchool\PhpWorkshop - * @author Aydin Hassan */ class CommandDefinition { diff --git a/src/CommandRouter.php b/src/CommandRouter.php index 3e402df6..f0bcd37b 100644 --- a/src/CommandRouter.php +++ b/src/CommandRouter.php @@ -5,17 +5,13 @@ use PhpSchool\PhpWorkshop\Event\EventDispatcher; use PhpSchool\PhpWorkshop\Exception\CliRouteNotExistsException; use PhpSchool\PhpWorkshop\Exception\MissingArgumentException; -use Interop\Container\ContainerInterface; +use Psr\Container\ContainerInterface; use PhpSchool\PhpWorkshop\Input\Input; -use SebastianBergmann\Environment\Runtime; /** * Parses $argv (or passed array) and attempts to find a command * which is suitable for what was typed on the cli. It then executes the callable * associated with that command definition. - * - * @package PhpSchool\PhpWorkshop - * @author Aydin Hassan */ class CommandRouter { diff --git a/src/Event/CgiExecuteEvent.php b/src/Event/CgiExecuteEvent.php index 821de0c2..0c993f5b 100644 --- a/src/Event/CgiExecuteEvent.php +++ b/src/Event/CgiExecuteEvent.php @@ -8,9 +8,6 @@ /** * An event to represent events which occur throughout the verification and running process in * `\PhpSchool\PhpWorkshop\ExerciseRunner\CgiRunner`. - * - * @package PhpSchool\PhpWorkshop\Event - * @author Aydin Hassan */ class CgiExecuteEvent extends Event { diff --git a/src/Event/CliExecuteEvent.php b/src/Event/CliExecuteEvent.php index 96a33037..8db99dd9 100644 --- a/src/Event/CliExecuteEvent.php +++ b/src/Event/CliExecuteEvent.php @@ -8,9 +8,6 @@ /** * An event to represent events which occur throughout the verification and running process in * `\PhpSchool\PhpWorkshop\ExerciseRunner\CliRunner`. - * - * @package PhpSchool\PhpWorkshop\Event - * @author Aydin Hassan */ class CliExecuteEvent extends Event { diff --git a/src/Event/Event.php b/src/Event/Event.php index 83b14546..4b47fd90 100644 --- a/src/Event/Event.php +++ b/src/Event/Event.php @@ -6,9 +6,6 @@ /** * A generic `PhpSchool\PhpWorkshop\Event\EventInterface` implementation. - * - * @package PhpSchool\PhpWorkshop\Event - * @author Aydin Hassan */ class Event implements EventInterface { diff --git a/src/Event/EventDispatcher.php b/src/Event/EventDispatcher.php index 21bc7c2c..f338bba8 100644 --- a/src/Event/EventDispatcher.php +++ b/src/Event/EventDispatcher.php @@ -7,9 +7,6 @@ /** * An event dispatcher implementation. - * - * @package PhpSchool\PhpWorkshop\EventManager - * @author Aydin Hassan */ class EventDispatcher { diff --git a/src/Event/EventInterface.php b/src/Event/EventInterface.php index 669b9604..2cb20651 100644 --- a/src/Event/EventInterface.php +++ b/src/Event/EventInterface.php @@ -4,9 +4,6 @@ /** * An event representation. - * - * @package PhpSchool\PhpWorkshop\Event - * @author Aydin Hassan */ interface EventInterface { diff --git a/src/Exception/CheckNotApplicableException.php b/src/Exception/CheckNotApplicableException.php index c6b4e985..5f90e0e0 100644 --- a/src/Exception/CheckNotApplicableException.php +++ b/src/Exception/CheckNotApplicableException.php @@ -9,9 +9,6 @@ /** * Represents the situation when a workshop developer tries to use a check in an exercise which has * a type not supported by the check. - * - * @package PhpSchool\PhpWorkshop\Exception - * @author Aydin Hassan */ class CheckNotApplicableException extends RuntimeException { diff --git a/src/Exception/CliRouteNotExistsException.php b/src/Exception/CliRouteNotExistsException.php index 41d1ba86..08e13ddd 100644 --- a/src/Exception/CliRouteNotExistsException.php +++ b/src/Exception/CliRouteNotExistsException.php @@ -6,9 +6,6 @@ /** * Represents the situation where a command is called which does not exist in the framework. - * - * @package PhpSchool\PhpWorkshop\Exception - * @author Aydin Hassan */ class CliRouteNotExistsException extends RuntimeException { diff --git a/src/Exception/CodeExecutionException.php b/src/Exception/CodeExecutionException.php index 94c92ef6..4a23ac5a 100644 --- a/src/Exception/CodeExecutionException.php +++ b/src/Exception/CodeExecutionException.php @@ -7,9 +7,6 @@ /** * Represents the situation where some PHP code could not be executed successfully. - * - * @package PhpSchool\PhpWorkshop\Exception - * @author Aydin Hassan */ class CodeExecutionException extends RuntimeException { @@ -21,8 +18,11 @@ class CodeExecutionException extends RuntimeException */ public static function fromProcess(Process $process) { - $message = 'PHP Code failed to execute. Error: "%s"'; - $processOutput = $process->getErrorOutput() ? $process->getErrorOutput() : $process->getOutput(); - return new static(sprintf($message, $processOutput)); + return new static( + sprintf( + 'PHP Code failed to execute. Error: "%s"', + trim($process->getErrorOutput() ?: $process->getOutput()) + ) + ); } } diff --git a/src/Exception/ExerciseNotConfiguredException.php b/src/Exception/ExerciseNotConfiguredException.php index 7cf7ed12..00cee384 100644 --- a/src/Exception/ExerciseNotConfiguredException.php +++ b/src/Exception/ExerciseNotConfiguredException.php @@ -8,9 +8,6 @@ /** * Represents the situation where an exercise requires a check but does not implement * the correct interface enforced by the check. - * - * @package PhpSchool\PhpWorkshop\Exception - * @author Aydin Hassan */ class ExerciseNotConfiguredException extends RuntimeException { diff --git a/src/Exception/InvalidArgumentException.php b/src/Exception/InvalidArgumentException.php index 3c74628b..8fa6cf31 100644 --- a/src/Exception/InvalidArgumentException.php +++ b/src/Exception/InvalidArgumentException.php @@ -4,9 +4,6 @@ /** * Represents invalid argument exceptions. - * - * @package PhpSchool\PhpWorkshop\Exception - * @author Aydin Hassan */ class InvalidArgumentException extends \InvalidArgumentException { diff --git a/src/Exception/MissingArgumentException.php b/src/Exception/MissingArgumentException.php index 8af5b7d5..aeebbc6e 100644 --- a/src/Exception/MissingArgumentException.php +++ b/src/Exception/MissingArgumentException.php @@ -6,9 +6,6 @@ /** * Represents the situation where a command was called without required parameters. - * - * @package PhpSchool\PhpWorkshop\Exception - * @author Aydin Hassan */ class MissingArgumentException extends RuntimeException { diff --git a/src/Exercise/AbstractExercise.php b/src/Exercise/AbstractExercise.php index 79dc468b..f2ad9360 100644 --- a/src/Exercise/AbstractExercise.php +++ b/src/Exercise/AbstractExercise.php @@ -10,9 +10,6 @@ /** * This abstract class implements many of the methods described in `PhpSchool\PhpWorkshop\Exercise\ExerciseInterface`. * It serves as a good base for an exercise, providing useful defaults for many of the methods. - * - * @package PhpSchool\PhpWorkshop\Exercise - * @author Aydin Hassan */ abstract class AbstractExercise { diff --git a/src/Exercise/CgiExercise.php b/src/Exercise/CgiExercise.php index 2c307a79..44ac2438 100644 --- a/src/Exercise/CgiExercise.php +++ b/src/Exercise/CgiExercise.php @@ -6,8 +6,6 @@ /** * This interface describes the additional methods a CGI type exercise should implement. - * - * @package PhpSchool\PhpWorkshop\Exercise */ interface CgiExercise extends ProvidesSolution { diff --git a/src/Exercise/CliExercise.php b/src/Exercise/CliExercise.php index 4757f36c..1391f2d3 100644 --- a/src/Exercise/CliExercise.php +++ b/src/Exercise/CliExercise.php @@ -4,8 +4,6 @@ /** * This interface describes the additional methods a CLI type exercise should implement. - * - * @package PhpSchool\PhpWorkshop\Exercise */ interface CliExercise extends ProvidesSolution { diff --git a/src/Exercise/ExerciseInterface.php b/src/Exercise/ExerciseInterface.php index 25a639d5..9f049e00 100644 --- a/src/Exercise/ExerciseInterface.php +++ b/src/Exercise/ExerciseInterface.php @@ -8,9 +8,6 @@ /** * This interface describes all of the methods an exercise * should implement. - * - * @package PhpSchool\PhpWorkshop\Exercise - * @author Aydin Hassan */ interface ExerciseInterface { diff --git a/src/Exercise/ExerciseType.php b/src/Exercise/ExerciseType.php index d01575f6..73975640 100644 --- a/src/Exercise/ExerciseType.php +++ b/src/Exercise/ExerciseType.php @@ -12,9 +12,6 @@ * $typeCgi = ExerciseType::CGI(); * $typeCustom = ExerciseType::CUSTOM(); * ``` - * - * @package PhpSchool\PhpWorkshop\Exercise - * @author Aydin Hassan */ class ExerciseType extends Enum { diff --git a/src/Exercise/SubmissionPatchable.php b/src/Exercise/SubmissionPatchable.php index e3fe30e3..50833043 100644 --- a/src/Exercise/SubmissionPatchable.php +++ b/src/Exercise/SubmissionPatchable.php @@ -10,9 +10,6 @@ * injecting variables. The exercise should implement the `getPatch()` method and it should return a `Patch`. * See [Patching Exercise Submissions](https://www.phpschool.io/docs/reference/patching-exercise-solutions) for * more details. - * - * @package PhpSchool\PhpWorkshop\Exercise - * @author Aydin Hassan */ interface SubmissionPatchable { diff --git a/src/Exercise/TemporaryDirectoryTrait.php b/src/Exercise/TemporaryDirectoryTrait.php index 39d92915..30834b03 100644 --- a/src/Exercise/TemporaryDirectoryTrait.php +++ b/src/Exercise/TemporaryDirectoryTrait.php @@ -5,9 +5,6 @@ /** * Helper trait to use in exercises to get a temporary path * for IO stuff. - * - * @package PhpSchool\PhpWorkshop\Exercise - * @author Aydin Hassan */ trait TemporaryDirectoryTrait { diff --git a/src/ExerciseCheck/ComposerExerciseCheck.php b/src/ExerciseCheck/ComposerExerciseCheck.php index 63ff97f1..cba2efaf 100644 --- a/src/ExerciseCheck/ComposerExerciseCheck.php +++ b/src/ExerciseCheck/ComposerExerciseCheck.php @@ -5,8 +5,6 @@ /** * This interface should be implemented when you require the check `PhpSchool\PhpWorkshop\Check\ComposerCheck` in your * exercise. - * - * @package PhpSchool\PhpWorkshop\ExerciseCheck */ interface ComposerExerciseCheck { diff --git a/src/ExerciseCheck/DatabaseExerciseCheck.php b/src/ExerciseCheck/DatabaseExerciseCheck.php index 18423983..0ab25e7b 100644 --- a/src/ExerciseCheck/DatabaseExerciseCheck.php +++ b/src/ExerciseCheck/DatabaseExerciseCheck.php @@ -7,8 +7,6 @@ /** * This interface should be implemented when you require the check `PhpSchool\PhpWorkshop\Check\DatabaseCheck` in your * exercise. - * - * @package PhpSchool\PhpWorkshop\ExerciseCheck */ interface DatabaseExerciseCheck { diff --git a/src/ExerciseCheck/FunctionRequirementsExerciseCheck.php b/src/ExerciseCheck/FunctionRequirementsExerciseCheck.php index 089c8c8a..2641b2f3 100644 --- a/src/ExerciseCheck/FunctionRequirementsExerciseCheck.php +++ b/src/ExerciseCheck/FunctionRequirementsExerciseCheck.php @@ -5,8 +5,6 @@ /** * This interface should be implemented when you require the check * `PhpSchool\PhpWorkshop\Check\FunctionRequirementsCheck` in your exercise. - * - * @package PhpSchool\PhpWorkshop\ExerciseCheck */ interface FunctionRequirementsExerciseCheck { diff --git a/src/ExerciseCheck/SelfCheck.php b/src/ExerciseCheck/SelfCheck.php index b97f1fce..19dc8b14 100644 --- a/src/ExerciseCheck/SelfCheck.php +++ b/src/ExerciseCheck/SelfCheck.php @@ -12,9 +12,6 @@ * information. * * Self checking runs *after* the student's solution has been run/verified. - * - * @package PhpSchool\PhpWorkshop\ExerciseCheck - * @author Aydin Hassan */ interface SelfCheck { diff --git a/src/ExerciseDispatcher.php b/src/ExerciseDispatcher.php index f8a42ae7..8ace34ff 100644 --- a/src/ExerciseDispatcher.php +++ b/src/ExerciseDispatcher.php @@ -20,9 +20,6 @@ /** * This class is used to verify/run a student's solution to an exercise. It routes to the correct * runner based on the exercise type. - * - * @package PhpSchool\PhpWorkshop - * @author Aydin Hassan */ class ExerciseDispatcher { diff --git a/src/ExerciseRenderer.php b/src/ExerciseRenderer.php index 843f03af..622e6555 100644 --- a/src/ExerciseRenderer.php +++ b/src/ExerciseRenderer.php @@ -9,9 +9,6 @@ /** * This class is used to render the exercise problem to the student, it also sets the current exercise * on to the user state object. - * - * @package PhpSchool\PhpWorkshop - * @author Aydin Hassan */ class ExerciseRenderer { diff --git a/src/ExerciseRepository.php b/src/ExerciseRepository.php index 484f4fd4..b9210f84 100644 --- a/src/ExerciseRepository.php +++ b/src/ExerciseRepository.php @@ -10,9 +10,6 @@ /** * Exercise repository, use to locate individual/all exercises by certain criteria. - * - * @package PhpSchool\PhpWorkshop - * @author Aydin Hassan */ class ExerciseRepository implements IteratorAggregate, Countable { diff --git a/src/ExerciseRunner/ExerciseRunnerInterface.php b/src/ExerciseRunner/ExerciseRunnerInterface.php index 4e91c396..27b599ff 100644 --- a/src/ExerciseRunner/ExerciseRunnerInterface.php +++ b/src/ExerciseRunner/ExerciseRunnerInterface.php @@ -11,9 +11,6 @@ /** * This interface describes how an exercise runner should work. Each exercise type * maps to an exercise runner. - * - * @package PhpSchool\PhpWorkshop\ExerciseRunner - * @author Aydin Hassan */ interface ExerciseRunnerInterface { diff --git a/src/ExerciseRunner/RunnerManager.php b/src/ExerciseRunner/RunnerManager.php index 1e7b7479..ccf2a222 100644 --- a/src/ExerciseRunner/RunnerManager.php +++ b/src/ExerciseRunner/RunnerManager.php @@ -2,7 +2,6 @@ namespace PhpSchool\PhpWorkshop\ExerciseRunner; -use Interop\Container\ContainerInterface; use PhpSchool\PhpWorkshop\CommandDefinition; use PhpSchool\PhpWorkshop\Exception\InvalidArgumentException; use PhpSchool\PhpWorkshop\Exercise\ExerciseInterface; diff --git a/src/Factory/EventDispatcherFactory.php b/src/Factory/EventDispatcherFactory.php index 39cec7ef..abbefe0a 100644 --- a/src/Factory/EventDispatcherFactory.php +++ b/src/Factory/EventDispatcherFactory.php @@ -2,18 +2,13 @@ namespace PhpSchool\PhpWorkshop\Factory; -use Interop\Container\ContainerInterface; +use Psr\Container\ContainerInterface; use PhpSchool\PhpWorkshop\Event\EventDispatcher; use PhpSchool\PhpWorkshop\Event\ContainerListenerHelper; use PhpSchool\PhpWorkshop\Exception\InvalidArgumentException; use PhpSchool\PhpWorkshop\ResultAggregator; use PhpSchool\PhpWorkshop\Utils\Collection; -/** - * Class EventDispatcherFactory - * @package PhpSchool\PhpWorkshop\Factory - * @author Aydin Hassan - */ class EventDispatcherFactory { diff --git a/src/Factory/MarkdownCliRendererFactory.php b/src/Factory/MarkdownCliRendererFactory.php index a79225a8..9c746726 100644 --- a/src/Factory/MarkdownCliRendererFactory.php +++ b/src/Factory/MarkdownCliRendererFactory.php @@ -5,12 +5,12 @@ use AydinHassan\CliMdRenderer\Renderer\ListBlockRenderer; use AydinHassan\CliMdRenderer\Renderer\ListItemRenderer; use Colors\Color; -use Interop\Container\ContainerInterface; +use Psr\Container\ContainerInterface; use Kadet\Highlighter\KeyLighter; use League\CommonMark\Block\Element\Heading; use League\CommonMark\Block\Element\ListBlock; use League\CommonMark\Block\Element\ListItem; -use PhpSchool\CliMenu\Terminal\TerminalInterface; +use PhpSchool\Terminal\Terminal; use League\CommonMark\Block\Element\Document; use League\CommonMark\Block\Element\FencedCode; use League\CommonMark\Block\Element\ThematicBreak; @@ -47,7 +47,7 @@ class MarkdownCliRendererFactory */ public function __invoke(ContainerInterface $c) { - $terminal = $c->get(TerminalInterface::class); + $terminal = $c->get(Terminal::class); $codeRender = new FencedCodeRenderer(); $codeRender->addSyntaxHighlighter('php', new PhpHighlighter(new KeyLighter)); diff --git a/src/Factory/MenuFactory.php b/src/Factory/MenuFactory.php index 64abda76..07e89b7e 100644 --- a/src/Factory/MenuFactory.php +++ b/src/Factory/MenuFactory.php @@ -2,9 +2,10 @@ namespace PhpSchool\PhpWorkshop\Factory; -use Interop\Container\ContainerInterface; +use PhpSchool\CliMenu\Style\SelectableStyle; +use Psr\Container\ContainerInterface; use PhpSchool\CliMenu\CliMenu; -use PhpSchool\CliMenu\CliMenuBuilder; +use PhpSchool\CliMenu\Builder\CliMenuBuilder; use PhpSchool\CliMenu\MenuItem\AsciiArtItem; use PhpSchool\PhpWorkshop\Command\CreditsCommand; use PhpSchool\PhpWorkshop\Command\HelpCommand; @@ -74,33 +75,40 @@ function (CliMenu $menu) use ($exerciseRenderer, $eventDispatcher, $exercise) { ->setBackgroundColour($c->get('bgColour')) ->setForegroundColour($c->get('fgColour')) ->setWidth(70) - ->setUnselectedMarker(' ') - ->setSelectedMarker('↳') + ->modifySelectableStyle(function (SelectableStyle $style) { + $style + ->setUnselectedMarker(' ') + ->setSelectedMarker('↳'); + }) ->setItemExtra('[COMPLETED]'); - $subMenu = $builder - ->addSubMenu('OPTIONS') + $builder + ->addSubMenu('OPTIONS', function (CliMenuBuilder $subMenu) use ($c) { + if (null !== $c->get('workshopLogo')) { + $subMenu->addAsciiArt($c->get('workshopLogo'), AsciiArtItem::POSITION_CENTER); + } + + $subMenu + ->addLineBreak('_') + ->addLineBreak() + ->addStaticItem('Options') + ->addStaticItem('-------') + ->addItem('Reset workshop progress', $c->get(ResetProgress::class)) + ->addLineBreak() + ->addLineBreak('-') + ->addLineBreak() + ->setGoBackButtonText('GO BACK') + ->setExitButtonText('EXIT'); + + if (null !== $c->get('workshopTitle')) { + $subMenu->setTitle($c->get('workshopTitle')); + } + }) ->addLineBreak(); - if (null !== $c->get('workshopLogo')) { - $subMenu->addAsciiArt($c->get('workshopLogo'), AsciiArtItem::POSITION_CENTER); - } - - $subMenu - ->addLineBreak('_') - ->addLineBreak() - ->addStaticItem('Options') - ->addStaticItem('-------') - ->addItem('Reset workshop progress', $c->get(ResetProgress::class)) - ->addLineBreak() - ->addLineBreak('-') - ->addLineBreak() - ->setGoBackButtonText('GO BACK') - ->setExitButtonText('EXIT'); if (null !== $c->get('workshopTitle')) { $builder->setTitle($c->get('workshopTitle')); - $subMenu->setTitle($c->get('workshopTitle')); } return $builder->build(); diff --git a/src/Factory/ResultRendererFactory.php b/src/Factory/ResultRendererFactory.php index d1592e48..cc768a9e 100644 --- a/src/Factory/ResultRendererFactory.php +++ b/src/Factory/ResultRendererFactory.php @@ -6,11 +6,6 @@ use PhpSchool\PhpWorkshop\Result\ResultInterface; use PhpSchool\PhpWorkshop\ResultRenderer\ResultRendererInterface; -/** - * Class ResultRendererFactory - * @package PhpSchool\PhpWorkshop\Factory - * @author Aydin Hassan - */ class ResultRendererFactory { /** diff --git a/src/Listener/CodePatchListener.php b/src/Listener/CodePatchListener.php index f0603e54..8de09e38 100644 --- a/src/Listener/CodePatchListener.php +++ b/src/Listener/CodePatchListener.php @@ -8,11 +8,6 @@ use PhpSchool\PhpWorkshop\Input\Input; use RuntimeException; -/** - * Class CodePatchListener - * @package PhpSchool\PhpWorkshop\Listener - * @author Aydin Hassan - */ class CodePatchListener { /** diff --git a/src/Listener/SelfCheckListener.php b/src/Listener/SelfCheckListener.php index c73858b5..6288176c 100644 --- a/src/Listener/SelfCheckListener.php +++ b/src/Listener/SelfCheckListener.php @@ -6,11 +6,6 @@ use PhpSchool\PhpWorkshop\ExerciseCheck\SelfCheck; use PhpSchool\PhpWorkshop\ResultAggregator; -/** - * Class SelfCheckListener - * @package PhpSchool\PhpWorkshopTest\Listener - * @author Aydin Hassan - */ class SelfCheckListener { /** diff --git a/src/MarkdownRenderer.php b/src/MarkdownRenderer.php index e5057e25..238e14c9 100644 --- a/src/MarkdownRenderer.php +++ b/src/MarkdownRenderer.php @@ -8,9 +8,6 @@ /** * Utility to render a markdown string to a string formatted with ANSI escape codes for output * on the console. - * - * @package PhpSchool\PhpWorkshop - * @author Aydin Hassan */ class MarkdownRenderer { diff --git a/src/MenuItem/ResetProgress.php b/src/MenuItem/ResetProgress.php index e5f82703..0de14847 100644 --- a/src/MenuItem/ResetProgress.php +++ b/src/MenuItem/ResetProgress.php @@ -7,11 +7,6 @@ use PhpSchool\PhpWorkshop\UserState; use PhpSchool\PhpWorkshop\UserStateSerializer; -/** - * Class ResetProgress - * @package PhpSchool\PhpWorkshop\MenuItem - * @author Aydin Hassan - */ class ResetProgress { /** diff --git a/src/NodeVisitor/FunctionVisitor.php b/src/NodeVisitor/FunctionVisitor.php index c2be6cf7..300096ab 100644 --- a/src/NodeVisitor/FunctionVisitor.php +++ b/src/NodeVisitor/FunctionVisitor.php @@ -6,11 +6,6 @@ use PhpParser\Node\Expr\FuncCall; use PhpParser\NodeVisitorAbstract; -/** - * Class FunctionVisitor - * @package PhpSchool\PhpWorkshop\NodeVisitor - * @author Aydin Hassan - */ class FunctionVisitor extends NodeVisitorAbstract { /** diff --git a/src/Output/OutputInterface.php b/src/Output/OutputInterface.php index f0074692..6eba64e2 100644 --- a/src/Output/OutputInterface.php +++ b/src/Output/OutputInterface.php @@ -4,11 +4,6 @@ use Psr\Http\Message\RequestInterface; -/** - * Interface StdOutput - * @package PhpSchool\PhpWorkshop - * @author Aydin Hassan - */ interface OutputInterface { /** diff --git a/src/Output/StdOutput.php b/src/Output/StdOutput.php index de3c32ce..a24d9b95 100644 --- a/src/Output/StdOutput.php +++ b/src/Output/StdOutput.php @@ -3,13 +3,8 @@ namespace PhpSchool\PhpWorkshop\Output; use Colors\Color; -use PhpSchool\CliMenu\Terminal\TerminalInterface; +use PhpSchool\Terminal\Terminal; -/** - * Class StdOutput - * @package PhpSchool\PhpWorkshop - * @author Aydin Hassan - */ class StdOutput implements OutputInterface { /** @@ -18,15 +13,11 @@ class StdOutput implements OutputInterface private $color; /** - * @var TerminalInterface + * @var Terminal */ private $terminal; - /** - * @param Color $color - * @param TerminalInterface $terminal - */ - public function __construct(Color $color, TerminalInterface $terminal) + public function __construct(Color $color, Terminal $terminal) { $this->color = $color; $this->terminal = $terminal; diff --git a/src/Patch.php b/src/Patch.php index 55745359..40aa377b 100644 --- a/src/Patch.php +++ b/src/Patch.php @@ -11,9 +11,6 @@ * representation of the student's solution and it should return the modified AST. * An insertion is a block of code that can be inserted at the top or bottom of * the students solution. - * - * @package PhpSchool\PhpWorkshop - * @author Aydin Hassan */ class Patch { diff --git a/src/Result/Cgi/RequestFailure.php b/src/Result/Cgi/RequestFailure.php index 25993c99..c3b20103 100644 --- a/src/Result/Cgi/RequestFailure.php +++ b/src/Result/Cgi/RequestFailure.php @@ -7,9 +7,6 @@ /** * A failure result representing the situation where the output of a student's solution did not match the * expected output in the context of a HTTP request. - * - * @package PhpSchool\PhpWorkshop\Result - * @author Aydin Hassan */ class RequestFailure implements FailureInterface { diff --git a/src/Result/Cli/RequestFailure.php b/src/Result/Cli/RequestFailure.php index 3aa78045..fd549e01 100644 --- a/src/Result/Cli/RequestFailure.php +++ b/src/Result/Cli/RequestFailure.php @@ -7,9 +7,6 @@ /** * A failure result representing the situation where the output of a solution does not match * that of the expected output in the context of a CLI request. - * - * @package PhpSchool\PhpWorkshop\Result - * @author Aydin Hassan */ class RequestFailure implements FailureInterface { diff --git a/src/Result/Failure.php b/src/Result/Failure.php index c0f81c91..b0be16c6 100644 --- a/src/Result/Failure.php +++ b/src/Result/Failure.php @@ -8,9 +8,6 @@ /** * Default implementation of `PhpSchool\PhpWorkshop\Result\FailureInterface`. - * - * @package PhpSchool\PhpWorkshop - * @author Aydin Hassan */ class Failure implements FailureInterface { diff --git a/src/Result/FailureInterface.php b/src/Result/FailureInterface.php index 9c0aefa2..3a1d5e4b 100644 --- a/src/Result/FailureInterface.php +++ b/src/Result/FailureInterface.php @@ -5,9 +5,6 @@ /** * This interface represents a failure. Any result implementing this interface will * be treated as a failure. - * - * @package PhpSchool\PhpWorkshop\Result - * @author Aydin Hassan */ interface FailureInterface extends ResultInterface { diff --git a/src/Result/FunctionRequirementsFailure.php b/src/Result/FunctionRequirementsFailure.php index b5e47380..66944f9a 100644 --- a/src/Result/FunctionRequirementsFailure.php +++ b/src/Result/FunctionRequirementsFailure.php @@ -7,9 +7,6 @@ /** * A failure result representing the situation where there were function usage requirements * and they were not met. - * - * @package PhpSchool\PhpWorkshop\Result - * @author Aydin Hassan */ class FunctionRequirementsFailure implements FailureInterface { diff --git a/src/Result/ResultInterface.php b/src/Result/ResultInterface.php index c8ac6acc..855291f2 100644 --- a/src/Result/ResultInterface.php +++ b/src/Result/ResultInterface.php @@ -6,8 +6,6 @@ * The base result interface, on it's own does not mean much, instead the * interfaces `PhpSchool\PhpWorkshop\Result\SuccessInterface` & `PhpSchool\PhpWorkshop\Result\FailureInterface` * should be used. - * - * @package PhpSchool\PhpWorkshop\Result */ interface ResultInterface { diff --git a/src/Result/ResultTrait.php b/src/Result/ResultTrait.php index 2325544a..ef2de98d 100644 --- a/src/Result/ResultTrait.php +++ b/src/Result/ResultTrait.php @@ -7,9 +7,6 @@ /** * Helper to proxy the `getCheckName()` method through to the `PhpSchool\PhpWorkshop\Check\CheckInterface` * instance. - * - * @package PhpSchool\PhpWorkshop\Result - * @author Aydin Hassan */ trait ResultTrait { diff --git a/src/Result/Success.php b/src/Result/Success.php index a598c210..9c1bfcfb 100644 --- a/src/Result/Success.php +++ b/src/Result/Success.php @@ -6,9 +6,6 @@ /** * Default implementation of `PhpSchool\PhpWorkshop\Result\SuccessInterface`. - * - * @package PhpSchool\PhpWorkshop - * @author Aydin Hassan */ class Success implements SuccessInterface { diff --git a/src/Result/SuccessInterface.php b/src/Result/SuccessInterface.php index ff1a1d2a..3b72ea96 100644 --- a/src/Result/SuccessInterface.php +++ b/src/Result/SuccessInterface.php @@ -5,9 +5,6 @@ /** * This interface represents a success. Any result implementing this interface will * be treated as a success. - * - * @package PhpSchool\PhpWorkshop\Result - * @author Aydin Hassan */ interface SuccessInterface extends ResultInterface { diff --git a/src/ResultAggregator.php b/src/ResultAggregator.php index b310dae6..a3753bb9 100644 --- a/src/ResultAggregator.php +++ b/src/ResultAggregator.php @@ -12,9 +12,6 @@ /** * This class is a container to hold all the results produced * throughout the verification of a students solution. - * - * @package PhpSchool\PhpWorkshop - * @author Aydin Hassan */ class ResultAggregator implements IteratorAggregate { diff --git a/src/ResultRenderer/Cgi/RequestFailureRenderer.php b/src/ResultRenderer/Cgi/RequestFailureRenderer.php index 4d61ac56..d0f4eb29 100644 --- a/src/ResultRenderer/Cgi/RequestFailureRenderer.php +++ b/src/ResultRenderer/Cgi/RequestFailureRenderer.php @@ -8,8 +8,6 @@ /** * Renderer for `PhpSchool\PhpWorkshop\Result\Cli\RequestFailure`. - * - * @package PhpSchool\PhpWorkshop\ResultRenderer */ class RequestFailureRenderer implements ResultRendererInterface { diff --git a/src/ResultRenderer/CgiResultRenderer.php b/src/ResultRenderer/CgiResultRenderer.php index 60bb7abd..82031210 100644 --- a/src/ResultRenderer/CgiResultRenderer.php +++ b/src/ResultRenderer/CgiResultRenderer.php @@ -9,8 +9,6 @@ /** * Renderer for `PhpSchool\PhpWorkshop\Result\Cgi\CgiResult`. - * - * @package PhpSchool\PhpWorkshop\ResultRenderer */ class CgiResultRenderer implements ResultRendererInterface { diff --git a/src/ResultRenderer/Cli/RequestFailureRenderer.php b/src/ResultRenderer/Cli/RequestFailureRenderer.php index 3cf84fa9..71466949 100644 --- a/src/ResultRenderer/Cli/RequestFailureRenderer.php +++ b/src/ResultRenderer/Cli/RequestFailureRenderer.php @@ -8,8 +8,6 @@ /** * Renderer for `PhpSchool\PhpWorkshop\Result\Cli\RequestFailure`. - * - * @package PhpSchool\PhpWorkshop\ResultRenderer */ class RequestFailureRenderer implements ResultRendererInterface { diff --git a/src/ResultRenderer/CliResultRenderer.php b/src/ResultRenderer/CliResultRenderer.php index 576cbee5..21249416 100644 --- a/src/ResultRenderer/CliResultRenderer.php +++ b/src/ResultRenderer/CliResultRenderer.php @@ -11,8 +11,6 @@ /** * Renderer for `PhpSchool\PhpWorkshop\Result\Cli\CliResult`. - * - * @package PhpSchool\PhpWorkshop\ResultRenderer */ class CliResultRenderer implements ResultRendererInterface { diff --git a/src/ResultRenderer/ComparisonFailureRenderer.php b/src/ResultRenderer/ComparisonFailureRenderer.php index 87823174..8c14c16f 100644 --- a/src/ResultRenderer/ComparisonFailureRenderer.php +++ b/src/ResultRenderer/ComparisonFailureRenderer.php @@ -7,8 +7,6 @@ /** * Renderer for `PhpSchool\PhpWorkshop\Result\ComparisonFailure`. - * - * @package PhpSchool\PhpWorkshop\ResultRenderer */ class ComparisonFailureRenderer implements ResultRendererInterface { diff --git a/src/ResultRenderer/FailureRenderer.php b/src/ResultRenderer/FailureRenderer.php index 1604d076..42ea53cd 100644 --- a/src/ResultRenderer/FailureRenderer.php +++ b/src/ResultRenderer/FailureRenderer.php @@ -7,8 +7,6 @@ /** * Renderer for `PhpSchool\PhpWorkshop\Result\Failure`. - * - * @package PhpSchool\PhpWorkshop\ResultRenderer */ class FailureRenderer implements ResultRendererInterface { diff --git a/src/ResultRenderer/FunctionRequirementsFailureRenderer.php b/src/ResultRenderer/FunctionRequirementsFailureRenderer.php index 24a8a3ee..c5584b88 100644 --- a/src/ResultRenderer/FunctionRequirementsFailureRenderer.php +++ b/src/ResultRenderer/FunctionRequirementsFailureRenderer.php @@ -6,9 +6,6 @@ /** * Renderer for `PhpSchool\PhpWorkshop\Result\FunctionRequirementsFailure`. - * - * @package PhpSchool\PhpWorkshop\ResultRenderer - * @author Aydin Hassan */ class FunctionRequirementsFailureRenderer implements ResultRendererInterface { diff --git a/src/ResultRenderer/ResultRendererInterface.php b/src/ResultRenderer/ResultRendererInterface.php index 2ac4b5c7..f652cabb 100644 --- a/src/ResultRenderer/ResultRendererInterface.php +++ b/src/ResultRenderer/ResultRendererInterface.php @@ -4,9 +4,6 @@ /** * The interface, result renderers should adhere to. - * - * @package PhpSchool\PhpWorkshop\ResultRenderer - * @author Aydin Hassan */ interface ResultRendererInterface { diff --git a/src/ResultRenderer/ResultsRenderer.php b/src/ResultRenderer/ResultsRenderer.php index 5593d375..9c847dda 100644 --- a/src/ResultRenderer/ResultsRenderer.php +++ b/src/ResultRenderer/ResultsRenderer.php @@ -5,7 +5,7 @@ use Colors\Color; use Kadet\Highlighter\Formatter\CliFormatter; use Kadet\Highlighter\KeyLighter; -use PhpSchool\CliMenu\Terminal\TerminalInterface; +use PhpSchool\Terminal\Terminal; use PhpSchool\CliMenu\Util\StringUtil; use PhpSchool\PhpWorkshop\Exercise\ProvidesSolution; use PhpSchool\PhpWorkshop\Factory\ResultRendererFactory; @@ -20,8 +20,6 @@ /** * Renderer which renders a `PhpSchool\PhpWorkshop\ResultAggregator` and writes it the output. - * - * @package PhpSchool\PhpWorkshop\ResultRenderer */ class ResultsRenderer { @@ -41,7 +39,7 @@ class ResultsRenderer private $exerciseRepository; /** - * @var TerminalInterface + * @var Terminal */ private $terminal; @@ -58,15 +56,15 @@ class ResultsRenderer /** * @param string $appName The name of the binary to run this workshop. * @param Color $color A instance of `Color` used to colour strings with ANSI escape codes. - * @param TerminalInterface $terminal A helper to get information regarding the current terminal. + * @param Terminal $terminal A helper to get information regarding the current terminal. * @param ExerciseRepository $exerciseRepository The exercise repository. * @param KeyLighter $keyLighter A syntax highlighter * @param ResultRendererFactory $resultRendererFactory */ public function __construct( - $appName, + string $appName, Color $color, - TerminalInterface $terminal, + Terminal $terminal, ExerciseRepository $exerciseRepository, KeyLighter $keyLighter, ResultRendererFactory $resultRendererFactory diff --git a/src/Solution/SolutionFile.php b/src/Solution/SolutionFile.php index a9e0c2e3..b052ab38 100644 --- a/src/Solution/SolutionFile.php +++ b/src/Solution/SolutionFile.php @@ -6,9 +6,6 @@ /** * This class represents a file on the file system which is part of the reference solution. - * - * @package PhpSchool\PhpWorkshop\Solution - * @author Aydin Hassan */ class SolutionFile { diff --git a/src/UserState.php b/src/UserState.php index 39055b5b..ff4543ab 100644 --- a/src/UserState.php +++ b/src/UserState.php @@ -5,9 +5,6 @@ /** * This class represents the current state of the user. Which exercises she/he has completed and * which is the current exercise being attempted. - * - * @package PhpSchool\PhpWorkshop - * @author Aydin Hassan */ class UserState { diff --git a/src/UserStateSerializer.php b/src/UserStateSerializer.php index ea24a222..27d25918 100644 --- a/src/UserStateSerializer.php +++ b/src/UserStateSerializer.php @@ -4,9 +4,6 @@ /** * Reads and persists the `UserState` instance to storage (file based). - * - * @package PhpSchool\PhpWorkshop - * @author Aydin Hassan */ class UserStateSerializer { diff --git a/src/Utils/ArrayObject.php b/src/Utils/ArrayObject.php index 5a4b0e43..b22990e9 100644 --- a/src/Utils/ArrayObject.php +++ b/src/Utils/ArrayObject.php @@ -8,9 +8,6 @@ /** * Utility collection class. - * - * @package PhpSchool\PhpWorkshop\Utils - * @author Aydin Hassan */ class ArrayObject implements IteratorAggregate, Countable { @@ -39,7 +36,7 @@ public function __construct(array $array = []) */ public function map(callable $callback) { - return new static (array_map($callback, $this->array)); + return new static(array_map($callback, $this->array)); } /** diff --git a/test/ApplicationTest.php b/test/ApplicationTest.php index 483e8f6c..89ba67f9 100644 --- a/test/ApplicationTest.php +++ b/test/ApplicationTest.php @@ -1,16 +1,16 @@ - */ -class ApplicationTest extends PHPUnit_Framework_TestCase +class ApplicationTest extends TestCase { - public function testEventListenersFromLocalAndWorkshopConfigAreMerged() + public function testEventListenersFromLocalAndWorkshopConfigAreMerged() : void { $frameworkFileContent = 'name = $name; } - /** - * @return string - */ - public function getName() + public function getName() : string { return $this->name; } diff --git a/test/Asset/CgiExerciseImpl.php b/test/Asset/CgiExerciseImpl.php index 96d919b5..0b8532d5 100644 --- a/test/Asset/CgiExerciseImpl.php +++ b/test/Asset/CgiExerciseImpl.php @@ -20,50 +20,32 @@ class CgiExerciseImpl implements ExerciseInterface, CgiExercise */ private $name; - /** - * @param string $name - */ - public function __construct($name = 'my-exercise') + public function __construct(string $name = 'my-exercise') { $this->name = $name; } - /** - * @return string - */ - public function getName() + public function getName() : string { return $this->name; } - /** - * @return string - */ - public function getDescription() + public function getDescription() : string { return $this->name; } - /** - * @return string - */ - public function getSolution() + public function getSolution() : string { // TODO: Implement getSolution() method. } - /** - * @return string - */ - public function getProblem() + public function getProblem() : string { // TODO: Implement getProblem() method. } - /** - * @return void - */ - public function tearDown() + public function tearDown() : void { // TODO: Implement tearDown() method. } @@ -74,23 +56,17 @@ public function tearDown() * * @return RequestInterface[] An array of PSR-7 requests. */ - public function getRequests() + public function getRequests() : array { - // TODO: Implement getRequests() method. + return []; // TODO: Implement getRequests() method. } - /** - * @return ExerciseType - */ - public function getType() + public function getType() : ExerciseType { return ExerciseType::CGI(); } - /** - * @param ExerciseDispatcher $dispatcher - */ - public function configure(ExerciseDispatcher $dispatcher) + public function configure(ExerciseDispatcher $dispatcher) : void { } } diff --git a/test/Asset/CliExerciseImpl.php b/test/Asset/CliExerciseImpl.php index 564b55ac..681ea1ff 100644 --- a/test/Asset/CliExerciseImpl.php +++ b/test/Asset/CliExerciseImpl.php @@ -19,74 +19,47 @@ class CliExerciseImpl implements ExerciseInterface, CliExercise */ private $name; - /** - * @param string $name - */ - public function __construct($name = 'my-exercise') + public function __construct(string $name = 'my-exercise') { $this->name = $name; } - /** - * @return string - */ - public function getName() + public function getName() : string { return $this->name; } - /** - * @return string - */ - public function getDescription() + public function getDescription() : string { return $this->name; } - /** - * @return string - */ - public function getSolution() + public function getSolution() : string { // TODO: Implement getSolution() method. } - /** - * @return string - */ - public function getProblem() + public function getProblem() : string { // TODO: Implement getProblem() method. } - /** - * @return void - */ - public function tearDown() + public function tearDown() : void { // TODO: Implement tearDown() method. } - /** - * @return array - */ - public function getArgs() + public function getArgs() : array { - // TODO: Implement getArgs() method. + return []; // TODO: Implement getArgs() method. } - /** - * @return ExerciseType - */ - public function getType() + public function getType() : ExerciseType { return ExerciseType::CLI(); } - /** - * @param ExerciseDispatcher $dispatcher - */ - public function configure(ExerciseDispatcher $dispatcher) + public function configure(ExerciseDispatcher $dispatcher) : void { } } diff --git a/test/Asset/CliExerciseMissingInterface.php b/test/Asset/CliExerciseMissingInterface.php index ec0bd565..95ce53a9 100644 --- a/test/Asset/CliExerciseMissingInterface.php +++ b/test/Asset/CliExerciseMissingInterface.php @@ -14,30 +14,24 @@ class CliExerciseMissingInterface extends AbstractExercise implements ExerciseIn /** * Get the name of the exercise, like `Hello World!`. - * - * @return string */ - public function getName() + public function getName() : string { return 'CLI exercise missing interface'; } /** * A short description of the exercise. - * - * @return string */ - public function getDescription() + public function getDescription() : string { return 'CLI exercise missing interface'; } /** * Return the type of exercise. This is an ENUM. See `PhpSchool\PhpWorkshop\Exercise\ExerciseType`. - * - * @return ExerciseType */ - public function getType() + public function getType() : ExerciseType { return ExerciseType::CLI(); } diff --git a/test/Asset/ComposerExercise.php b/test/Asset/ComposerExercise.php index 3fc4b12d..0584c154 100644 --- a/test/Asset/ComposerExercise.php +++ b/test/Asset/ComposerExercise.php @@ -15,59 +15,37 @@ */ class ComposerExercise implements ExerciseInterface, ComposerExerciseCheck { - - /** - * @return string - */ - public function getName() + public function getName() : string { return 'composer-exercise'; } - /** - * @return string - */ - public function getDescription() + public function getDescription() : string { // TODO: Implement getDescription() method. } - /** - * @return string - */ - public function getSolution() + public function getSolution() : string { // TODO: Implement getSolution() method. } - /** - * @return string - */ - public function getProblem() + public function getProblem() : string { // TODO: Implement getProblem() method. } - /** - * @return void - */ - public function tearDown() + public function tearDown() : void { // TODO: Implement tearDown() method. } - /** - * @return array - */ - public function getArgs() + public function getArgs() : array { - // TODO: Implement getArgs() method. + return []; // TODO: Implement getArgs() method. } - /** - * @return array[] - */ - public function getRequiredPackages() + public function getRequiredPackages() : array { return [ 'klein/klein', @@ -75,18 +53,12 @@ public function getRequiredPackages() ]; } - /** - * @return ExerciseType - */ - public function getType() + public function getType() : ExerciseType { return ExerciseType::CLI(); } - /** - * @param ExerciseDispatcher $dispatcher - */ - public function configure(ExerciseDispatcher $dispatcher) + public function configure(ExerciseDispatcher $dispatcher) : void { $dispatcher->requireCheck(ComposerCheck::class); } diff --git a/test/Asset/CustomVerifyingExerciseImpl.php b/test/Asset/CustomVerifyingExerciseImpl.php index a715311b..7d1b1a3f 100644 --- a/test/Asset/CustomVerifyingExerciseImpl.php +++ b/test/Asset/CustomVerifyingExerciseImpl.php @@ -17,38 +17,29 @@ class CustomVerifyingExerciseImpl extends AbstractExercise implements ExerciseIn /** * Get the name of the exercise, like `Hello World!`. - * - * @return string */ - public function getName() + public function getName() : string { return 'Custom Verifying exercise'; } /** * A short description of the exercise. - * - * @return string */ - public function getDescription() + public function getDescription() : string { return 'Custom Verifying exercise'; } /** * Return the type of exercise. This is an ENUM. See `PhpSchool\PhpWorkshop\Exercise\ExerciseType`. - * - * @return ExerciseType */ - public function getType() + public function getType() : ExerciseType { return ExerciseType::CUSTOM(); } - /** - * @return ResultInterface - */ - public function verify() + public function verify() : ResultInterface { return new Success('success'); } diff --git a/test/Asset/FunctionRequirementsExercise.php b/test/Asset/FunctionRequirementsExercise.php index dcda7738..91c38bdd 100644 --- a/test/Asset/FunctionRequirementsExercise.php +++ b/test/Asset/FunctionRequirementsExercise.php @@ -15,59 +15,37 @@ */ class FunctionRequirementsExercise implements ExerciseInterface, FunctionRequirementsExerciseCheck { - - /** - * @return string - */ - public function getName() + public function getName() : string { // TODO: Implement getName() method. } - /** - * @return string - */ - public function getDescription() + public function getDescription() : string { // TODO: Implement getDescription() method. } - /** - * @return string - */ - public function getSolution() + public function getSolution() : string { // TODO: Implement getSolution() method. } - /** - * @return string - */ - public function getProblem() + public function getProblem() : string { // TODO: Implement getProblem() method. } - /** - * @return void - */ - public function tearDown() + public function tearDown() : void { // TODO: Implement tearDown() method. } - /** - * @return array - */ - public function getArgs() + public function getArgs() : array { - // TODO: Implement getArgs() method. + return []; // TODO: Implement getArgs() method. } - /** - * @return array[] - */ - public function getRequiredPackages() + public function getRequiredPackages() : array { return [ 'klein/klein', @@ -75,18 +53,12 @@ public function getRequiredPackages() ]; } - /** - * @return ExerciseType - */ - public function getType() + public function getType() : ExerciseType { return ExerciseType::CLI(); } - /** - * @param ExerciseDispatcher $dispatcher - */ - public function configure(ExerciseDispatcher $dispatcher) + public function configure(ExerciseDispatcher $dispatcher) : void { $dispatcher->requireCheck(ComposerCheck::class); } @@ -94,7 +66,7 @@ public function configure(ExerciseDispatcher $dispatcher) /** * @return string[] */ - public function getRequiredFunctions() + public function getRequiredFunctions() : array { return []; } @@ -102,7 +74,7 @@ public function getRequiredFunctions() /** * @return string[] */ - public function getBannedFunctions() + public function getBannedFunctions() : array { return ['file']; } diff --git a/test/Asset/PatchableExercise.php b/test/Asset/PatchableExercise.php index 18560222..27383acf 100644 --- a/test/Asset/PatchableExercise.php +++ b/test/Asset/PatchableExercise.php @@ -15,67 +15,42 @@ */ class PatchableExercise implements ExerciseInterface, SubmissionPatchable { - - /** - * @return string - */ - public function getName() + public function getName() : string { // TODO: Implement getName() method. } - /** - * @return string - */ - public function getDescription() + public function getDescription() : string { // TODO: Implement getDescription() method. } - /** - * @return string - */ - public function getSolution() + public function getSolution() : string { // TODO: Implement getSolution() method. } - /** - * @return string - */ - public function getProblem() + public function getProblem() : string { // TODO: Implement getProblem() method. } - /** - * @return void - */ - public function tearDown() + public function tearDown() : void { // TODO: Implement tearDown() method. } - /** - * @return Patch - */ - public function getPatch() + public function getPatch() : Patch { // TODO: Implement getPatch() method. } - /** - * @return ExerciseType - */ - public function getType() + public function getType() : ExerciseType { // TODO: Implement getType() method. } - /** - * @param ExerciseDispatcher $dispatcher - */ - public function configure(ExerciseDispatcher $dispatcher) + public function configure(ExerciseDispatcher $dispatcher) : void { // TODO: Implement configure() method. } diff --git a/test/Asset/ResultResultAggregator.php b/test/Asset/ResultResultAggregator.php index c1e589e7..a2a77ad0 100644 --- a/test/Asset/ResultResultAggregator.php +++ b/test/Asset/ResultResultAggregator.php @@ -12,11 +12,7 @@ */ class ResultResultAggregator extends ResultAggregator implements ResultInterface { - - /** - * @return string - */ - public function getCheckName() + public function getCheckName() : string { return self::class; } diff --git a/test/Check/CheckRepositoryTest.php b/test/Check/CheckRepositoryTest.php index 492e9117..8eed6d15 100644 --- a/test/Check/CheckRepositoryTest.php +++ b/test/Check/CheckRepositoryTest.php @@ -5,23 +5,23 @@ use PhpSchool\PhpWorkshop\Check\CheckInterface; use PhpSchool\PhpWorkshop\Check\CheckRepository; use PhpSchool\PhpWorkshop\Exception\InvalidArgumentException; -use PHPUnit_Framework_TestCase; +use PHPUnit\Framework\TestCase; /** * Class CheckRepositoryTest * @package PhpSchool\PhpWorkshopTest\Check * @author Aydin Hassan */ -class CheckRepositoryTest extends PHPUnit_Framework_TestCase +class CheckRepositoryTest extends TestCase { - public function testRegisterViaConstructor() + public function testRegisterViaConstructor() : void { $check = $this->createMock(CheckInterface::class); $repository = new CheckRepository([$check]); $this->assertEquals([$check], $repository->getAll()); } - public function testRegisterCheck() + public function testRegisterCheck() : void { $repository = new CheckRepository; $this->assertEquals([], $repository->getAll()); @@ -31,7 +31,7 @@ public function testRegisterCheck() $this->assertEquals([$check], $repository->getAll()); } - public function testHas() + public function testHas() : void { $repository = new CheckRepository; $repository->registerCheck($this->createMock(CheckInterface::class)); @@ -43,7 +43,7 @@ public function testHas() $this->assertFalse($repository->has('SomeClassWhichDoesNotExist')); } - public function testGetByClassThrowsExceptionIfNotExist() + public function testGetByClassThrowsExceptionIfNotExist() : void { $repository = new CheckRepository; $repository->registerCheck($this->createMock(CheckInterface::class)); @@ -54,7 +54,7 @@ public function testGetByClassThrowsExceptionIfNotExist() $repository->getByClass('SomeClassWhichDoesNotExist'); } - public function testGetByClass() + public function testGetByClass() : void { $repository = new CheckRepository; $repository->registerCheck($this->createMock(CheckInterface::class)); diff --git a/test/Check/CodeParseCheckTest.php b/test/Check/CodeParseCheckTest.php index 6144d62e..a995f632 100644 --- a/test/Check/CodeParseCheckTest.php +++ b/test/Check/CodeParseCheckTest.php @@ -11,14 +11,14 @@ use PhpSchool\PhpWorkshop\Input\Input; use PhpSchool\PhpWorkshop\Result\Failure; use PhpSchool\PhpWorkshop\Result\Success; -use PHPUnit_Framework_TestCase; +use PHPUnit\Framework\TestCase; /** * Class CodeParseCheckTest * @package PhpSchool\PhpWorkshopTest\Check * @author Aydin Hassan */ -class CodeParseCheckTest extends PHPUnit_Framework_TestCase +class CodeParseCheckTest extends TestCase { /** * @var SimpleCheckInterface @@ -30,7 +30,7 @@ class CodeParseCheckTest extends PHPUnit_Framework_TestCase */ private $file; - public function setUp() + public function setUp() : void { $this->check = new CodeParseCheck((new ParserFactory)->create(ParserFactory::PREFER_PHP7)); $this->assertEquals('Code Parse Check', $this->check->getName()); @@ -45,7 +45,7 @@ public function setUp() touch($this->file); } - public function testUnParseableCodeReturnsFailure() + public function testUnParseableCodeReturnsFailure() : void { file_put_contents($this->file, 'file, ' */ -class ComposerCheckTest extends PHPUnit_Framework_TestCase +class ComposerCheckTest extends TestCase { /** * @var ComposerCheck @@ -31,7 +31,7 @@ class ComposerCheckTest extends PHPUnit_Framework_TestCase */ private $exercise; - public function setUp() + public function setUp() : void { $this->check = new ComposerCheck; $this->exercise = new ComposerExercise; @@ -43,7 +43,7 @@ public function setUp() $this->assertTrue($this->check->canRun(ExerciseType::CLI())); } - public function testExceptionIsThrownIfNotValidExercise() + public function testExceptionIsThrownIfNotValidExercise() : void { $exercise = $this->createMock(ExerciseInterface::class); $this->expectException(InvalidArgumentException::class); @@ -51,7 +51,7 @@ public function testExceptionIsThrownIfNotValidExercise() $this->check->check($exercise, new Input('app')); } - public function testCheckReturnsFailureIfNoComposerFile() + public function testCheckReturnsFailureIfNoComposerFile() : void { $result = $this->check->check( $this->exercise, @@ -63,7 +63,7 @@ public function testCheckReturnsFailureIfNoComposerFile() $this->assertSame('No composer.json file found', $result->getReason()); } - public function testCheckReturnsFailureIfNoComposerLockFile() + public function testCheckReturnsFailureIfNoComposerLockFile() : void { $result = $this->check->check( $this->exercise, @@ -75,7 +75,7 @@ public function testCheckReturnsFailureIfNoComposerLockFile() $this->assertSame('No composer.lock file found', $result->getReason()); } - public function testCheckReturnsFailureIfNoVendorFolder() + public function testCheckReturnsFailureIfNoVendorFolder() : void { $result = $this->check->check( $this->exercise, @@ -93,12 +93,12 @@ public function testCheckReturnsFailureIfNoVendorFolder() * @param string $dependency * @param string $solutionFile */ - public function testCheckReturnsFailureIfDependencyNotRequired($dependency, $solutionFile) + public function testCheckReturnsFailureIfDependencyNotRequired($dependency, $solutionFile) : void { $exercise = $this->createMock(ComposerExercise::class); $exercise->expects($this->once()) ->method('getRequiredPackages') - ->will($this->returnValue([$dependency])); + ->willReturn([$dependency]); $result = $this->check->check($exercise, new Input('app', ['program' => $solutionFile])); @@ -113,7 +113,7 @@ public function testCheckReturnsFailureIfDependencyNotRequired($dependency, $sol /** * @return array */ - public function dependencyProvider() + public function dependencyProvider() : array { return [ ['klein/klein', __DIR__ . '/../res/composer/no-klein/solution.php'], @@ -121,7 +121,7 @@ public function dependencyProvider() ]; } - public function testCheckReturnsSuccessIfCorrectLockFile() + public function testCheckReturnsSuccessIfCorrectLockFile() : void { $result = $this->check->check( $this->exercise, diff --git a/test/Check/DatabaseCheckTest.php b/test/Check/DatabaseCheckTest.php index 622e028d..d1768f9e 100644 --- a/test/Check/DatabaseCheckTest.php +++ b/test/Check/DatabaseCheckTest.php @@ -2,10 +2,8 @@ namespace PhpSchool\PhpWorkshopTest\Check; -use DI\Container; use DI\ContainerBuilder; use PDO; -use PhpSchool\PhpWorkshop\Check\CheckInterface; use PhpSchool\PhpWorkshop\Check\CheckRepository; use PhpSchool\PhpWorkshop\Check\DatabaseCheck; use PhpSchool\PhpWorkshop\Event\EventDispatcher; @@ -20,7 +18,8 @@ use PhpSchool\PhpWorkshop\ResultAggregator; use PhpSchool\PhpWorkshop\Solution\SingleFileSolution; use PhpSchool\PhpWorkshopTest\Asset\DatabaseExerciseInterface; -use PHPUnit_Framework_TestCase; +use PHPUnit\Framework\MockObject\MockObject; +use PHPUnit\Framework\TestCase; use ReflectionProperty; use RuntimeException; @@ -28,7 +27,7 @@ * @package PhpSchool\PhpWorkshopTest\Check * @author Aydin Hassan */ -class DatabaseCheckTest extends PHPUnit_Framework_TestCase +class DatabaseCheckTest extends TestCase { /** @@ -51,7 +50,7 @@ class DatabaseCheckTest extends PHPUnit_Framework_TestCase */ private $dbDir; - public function setUp() + public function setUp() : void { $containerBuilder = new ContainerBuilder; $containerBuilder->addDefinitions(__DIR__ . '/../../app/config.php'); @@ -61,7 +60,7 @@ public function setUp() $this->check = new DatabaseCheck; $this->exercise = $this->createMock(DatabaseExerciseInterface::class); - $this->exercise->expects($this->any())->method('getType')->willReturn(ExerciseType::CLI()); + $this->exercise->method('getType')->willReturn(ExerciseType::CLI()); $this->dbDir = sprintf( '%s/PhpSchool_PhpWorkshop_Check_DatabaseCheck', str_replace('\\', '/', realpath(sys_get_temp_dir())) @@ -71,12 +70,7 @@ public function setUp() $this->assertEquals(DatabaseExerciseCheck::class, $this->check->getExerciseInterface()); } - /** - * @param ExerciseInterface $exercise - * @param EventDispatcher $eventDispatcher - * @return \PHPUnit_Framework_MockObject_MockObject - */ - private function getRunnerManager(ExerciseInterface $exercise, EventDispatcher $eventDispatcher) + private function getRunnerManager(ExerciseInterface $exercise, EventDispatcher $eventDispatcher) : MockObject { $runner = $this->getMockBuilder(CliRunner::class) ->setConstructorArgs([$exercise, $eventDispatcher]) @@ -84,7 +78,6 @@ private function getRunnerManager(ExerciseInterface $exercise, EventDispatcher $ ->getMock(); $runner - ->expects($this->any()) ->method('getRequiredChecks') ->willReturn([]); @@ -97,7 +90,7 @@ private function getRunnerManager(ExerciseInterface $exercise, EventDispatcher $ return $runnerManager; } - public function testIfDatabaseFolderExistsExceptionIsThrown() + public function testIfDatabaseFolderExistsExceptionIsThrown() : void { $eventDispatcher = new EventDispatcher(new ResultAggregator); @mkdir($this->dbDir); @@ -114,7 +107,7 @@ public function testIfDatabaseFolderExistsExceptionIsThrown() * If an exception is thrown from PDO, check that the check can be run straight away * Previously files were not cleaned up that caused exceptions. */ - public function testIfPDOThrowsExceptionItCleansUp() + public function testIfPDOThrowsExceptionItCleansUp() : void { $eventDispatcher = new EventDispatcher(new ResultAggregator); @@ -134,25 +127,25 @@ public function testIfPDOThrowsExceptionItCleansUp() $this->exercise ->expects($this->once()) ->method('getSolution') - ->will($this->returnValue($solution)); + ->willReturn($solution); $this->exercise ->expects($this->once()) ->method('getArgs') - ->will($this->returnValue([1, 2, 3])); + ->willReturn([1, 2, 3]); $this->exercise ->expects($this->once()) ->method('configure') - ->will($this->returnCallback(function (ExerciseDispatcher $dispatcher) { + ->willReturnCallback(function (ExerciseDispatcher $dispatcher) { $dispatcher->requireCheck(DatabaseCheck::class); - })); + }); $this->exercise ->expects($this->once()) ->method('verify') ->with($this->isInstanceOf(PDO::class)) - ->will($this->returnValue(true)); + ->willReturn(true); $this->checkRepository->registerCheck($this->check); @@ -169,31 +162,31 @@ public function testIfPDOThrowsExceptionItCleansUp() $this->assertTrue($results->isSuccessful()); } - public function testSuccessIsReturnedIfDatabaseVerificationPassed() + public function testSuccessIsReturnedIfDatabaseVerificationPassed() : void { $solution = SingleFileSolution::fromFile(realpath(__DIR__ . '/../res/database/solution.php')); $this->exercise ->expects($this->once()) ->method('getSolution') - ->will($this->returnValue($solution)); + ->willReturn($solution); $this->exercise ->expects($this->once()) ->method('getArgs') - ->will($this->returnValue([[1, 2, 3]])); + ->willReturn([[1, 2, 3]]); $this->exercise ->expects($this->once()) ->method('configure') - ->will($this->returnCallback(function (ExerciseDispatcher $dispatcher) { + ->willReturnCallback(function (ExerciseDispatcher $dispatcher) { $dispatcher->requireCheck(DatabaseCheck::class); - })); + }); $this->exercise ->expects($this->once()) ->method('verify') ->with($this->isInstanceOf(PDO::class)) - ->will($this->returnValue(true)); + ->willReturn(true); $this->checkRepository->registerCheck($this->check); @@ -212,19 +205,19 @@ public function testSuccessIsReturnedIfDatabaseVerificationPassed() $this->assertTrue($results->isSuccessful()); } - public function testRunExercise() + public function testRunExercise() : void { $this->exercise ->expects($this->once()) ->method('getArgs') - ->will($this->returnValue([])); + ->willReturn([]); $this->exercise ->expects($this->once()) ->method('configure') - ->will($this->returnCallback(function (ExerciseDispatcher $dispatcher) { + ->willReturnCallback(function (ExerciseDispatcher $dispatcher) { $dispatcher->requireCheck(DatabaseCheck::class); - })); + }); $this->checkRepository->registerCheck($this->check); @@ -244,7 +237,7 @@ public function testRunExercise() ); } - public function testFailureIsReturnedIfDatabaseVerificationFails() + public function testFailureIsReturnedIfDatabaseVerificationFails() : void { $solution = SingleFileSolution::fromFile(realpath(__DIR__ . '/../res/database/solution.php')); @@ -252,25 +245,25 @@ public function testFailureIsReturnedIfDatabaseVerificationFails() $this->exercise ->expects($this->once()) ->method('getSolution') - ->will($this->returnValue($solution)); + ->willReturn($solution); $this->exercise ->expects($this->once()) ->method('getArgs') - ->will($this->returnValue([1, 2, 3])); + ->willReturn([1, 2, 3]); $this->exercise ->expects($this->once()) ->method('configure') - ->will($this->returnCallback(function (ExerciseDispatcher $dispatcher) { + ->willReturnCallback(function (ExerciseDispatcher $dispatcher) { $dispatcher->requireCheck(DatabaseCheck::class); - })); + }); $this->exercise ->expects($this->once()) ->method('verify') ->with($this->isInstanceOf(PDO::class)) - ->will($this->returnValue(false)); + ->willReturn(false); $this->checkRepository->registerCheck($this->check); @@ -290,44 +283,43 @@ public function testFailureIsReturnedIfDatabaseVerificationFails() $this->assertSame('Database verification failed', $results[1]->getReason()); } - public function testAlteringDatabaseInSolutionDoesNotEffectDatabaseInUserSolution() + public function testAlteringDatabaseInSolutionDoesNotEffectDatabaseInUserSolution() : void { $solution = SingleFileSolution::fromFile(realpath(__DIR__ . '/../res/database/solution-alter-db.php')); $this->exercise ->expects($this->once()) ->method('getSolution') - ->will($this->returnValue($solution)); + ->willReturn($solution); $this->exercise - ->expects($this->any()) ->method('getArgs') - ->will($this->returnValue([])); + ->willReturn([]); $this->exercise ->expects($this->once()) ->method('configure') - ->will($this->returnCallback(function (ExerciseDispatcher $dispatcher) { + ->willReturnCallback(function (ExerciseDispatcher $dispatcher) { $dispatcher->requireCheck(DatabaseCheck::class); - })); + }); $this->exercise ->expects($this->once()) ->method('seed') ->with($this->isInstanceOf(PDO::class)) - ->will($this->returnCallback(function (PDO $db) { + ->willReturnCallback(function (PDO $db) { $db->exec( 'CREATE TABLE IF NOT EXISTS users (id INTEGER PRIMARY KEY, name TEXT, age INTEGER, gender TEXT)' ); $stmt = $db->prepare('INSERT into users (name, age, gender) VALUES (:name, :age, :gender)'); $stmt->execute([':name' => 'Jimi Hendrix', ':age' => 27, ':gender' => 'Male']); - })); + }); $this->exercise ->expects($this->once()) ->method('verify') ->with($this->isInstanceOf(PDO::class)) - ->will($this->returnCallback(function (PDO $db) { + ->willReturnCallback(function (PDO $db) { $users = $db->query('SELECT * FROM users'); $users = $users->fetchAll(PDO::FETCH_ASSOC); @@ -338,7 +330,7 @@ public function testAlteringDatabaseInSolutionDoesNotEffectDatabaseInUserSolutio ], $users ); - })); + }); $this->checkRepository->registerCheck($this->check); diff --git a/test/Check/FileExistsCheckTest.php b/test/Check/FileExistsCheckTest.php index 7f7567ed..865158f8 100644 --- a/test/Check/FileExistsCheckTest.php +++ b/test/Check/FileExistsCheckTest.php @@ -5,7 +5,7 @@ use PhpSchool\PhpWorkshop\Check\SimpleCheckInterface; use PhpSchool\PhpWorkshop\Exercise\ExerciseType; use PhpSchool\PhpWorkshop\Input\Input; -use PHPUnit_Framework_TestCase; +use PHPUnit\Framework\TestCase; use PhpSchool\PhpWorkshop\Check\FileExistsCheck; use PhpSchool\PhpWorkshop\Exercise\ExerciseInterface; use PhpSchool\PhpWorkshop\Result\Failure; @@ -16,7 +16,7 @@ * @package PhpSchool\PhpWorkshopTest * @author Aydin Hassan */ -class FileExistsCheckTest extends PHPUnit_Framework_TestCase +class FileExistsCheckTest extends TestCase { /** * @var string @@ -33,7 +33,7 @@ class FileExistsCheckTest extends PHPUnit_Framework_TestCase */ private $exercise; - public function setUp() + public function setUp() : void { $this->testDir = sprintf('%s/%s', sys_get_temp_dir(), $this->getName()); mkdir($this->testDir, 0777, true); @@ -47,7 +47,7 @@ public function setUp() $this->assertTrue($this->check->canRun(ExerciseType::CLI())); } - public function testSuccess() + public function testSuccess() : void { $file = sprintf('%s/test.txt', $this->testDir); touch($file); @@ -59,7 +59,7 @@ public function testSuccess() unlink($file); } - public function testFailure() + public function testFailure() : void { $file = sprintf('%s/test.txt', $this->testDir); $failure = $this->check->check($this->exercise, new Input('app', ['program' => $file])); @@ -67,7 +67,7 @@ public function testFailure() $this->assertEquals(sprintf('File: "%s" does not exist', $file), $failure->getReason()); } - public function tearDown() + public function tearDown() : void { rmdir($this->testDir); } diff --git a/test/Check/FunctionRequirementsCheckTest.php b/test/Check/FunctionRequirementsCheckTest.php index 32cc9704..852176f7 100644 --- a/test/Check/FunctionRequirementsCheckTest.php +++ b/test/Check/FunctionRequirementsCheckTest.php @@ -9,7 +9,7 @@ use PhpSchool\PhpWorkshop\Exercise\ExerciseType; use PhpSchool\PhpWorkshop\Input\Input; use PhpSchool\PhpWorkshopTest\Asset\FunctionRequirementsExercise; -use PHPUnit_Framework_TestCase; +use PHPUnit\Framework\TestCase; use PhpSchool\PhpWorkshop\Check\FunctionRequirementsCheck; use PhpSchool\PhpWorkshop\Exercise\ExerciseInterface; use PhpSchool\PhpWorkshop\ExerciseCheck\FunctionRequirementsExerciseCheck; @@ -22,7 +22,7 @@ * @package PhpSchool\PhpWorkshopTest\Check * @author Aydin Hassan */ -class FunctionRequirementsCheckTest extends PHPUnit_Framework_TestCase +class FunctionRequirementsCheckTest extends TestCase { /** * @var FunctionRequirementsCheck @@ -39,7 +39,7 @@ class FunctionRequirementsCheckTest extends PHPUnit_Framework_TestCase */ private $parser; - public function setUp() + public function setUp() : void { $parserFactory = new ParserFactory; $this->parser = $parserFactory->create(ParserFactory::PREFER_PHP7); @@ -53,7 +53,7 @@ public function setUp() $this->assertTrue($this->check->canRun(ExerciseType::CLI())); } - public function testExceptionIsThrownIfNotValidExercise() + public function testExceptionIsThrownIfNotValidExercise() : void { $exercise = $this->createMock(ExerciseInterface::class); $this->expectException(InvalidArgumentException::class); @@ -61,7 +61,7 @@ public function testExceptionIsThrownIfNotValidExercise() $this->check->check($exercise, new Input('app')); } - public function testFailureIsReturnedIfCodeCouldNotBeParsed() + public function testFailureIsReturnedIfCodeCouldNotBeParsed() : void { $file = __DIR__ . '/../res/function-requirements/fail-invalid-code.php'; $failure = $this->check->check($this->exercise, new Input('app', ['program' => $file])); @@ -71,7 +71,7 @@ public function testFailureIsReturnedIfCodeCouldNotBeParsed() $this->assertEquals($message, $failure->getReason()); } - public function testFailureIsReturnedIfBannedFunctionsAreUsed() + public function testFailureIsReturnedIfBannedFunctionsAreUsed() : void { $failure = $this->check->check( $this->exercise, @@ -82,18 +82,18 @@ public function testFailureIsReturnedIfBannedFunctionsAreUsed() $this->assertEquals([], $failure->getMissingFunctions()); } - public function testFailureIsReturnedIfNotAllRequiredFunctionsHaveBeenUsed() + public function testFailureIsReturnedIfNotAllRequiredFunctionsHaveBeenUsed() : void { $exercise = $this->createMock(FunctionRequirementsExercise::class); $exercise ->expects($this->once()) ->method('getBannedFunctions') - ->will($this->returnValue([])); + ->willReturn([]); $exercise ->expects($this->once()) ->method('getRequiredFunctions') - ->will($this->returnValue(['file_get_contents', 'implode'])); + ->willReturn(['file_get_contents', 'implode']); $failure = $this->check->check( $exercise, @@ -105,18 +105,18 @@ public function testFailureIsReturnedIfNotAllRequiredFunctionsHaveBeenUsed() $this->assertEquals([], $failure->getBannedFunctions()); } - public function testSuccess() + public function testSuccess() : void { $exercise = $this->createMock(FunctionRequirementsExercise::class); $exercise ->expects($this->once()) ->method('getBannedFunctions') - ->will($this->returnValue([])); + ->willReturn([]); $exercise ->expects($this->once()) ->method('getRequiredFunctions') - ->will($this->returnValue(['file_get_contents'])); + ->willReturn(['file_get_contents']); $success = $this->check->check( $exercise, diff --git a/test/Check/PhpLintCheckTest.php b/test/Check/PhpLintCheckTest.php index 121b2c3b..737be726 100644 --- a/test/Check/PhpLintCheckTest.php +++ b/test/Check/PhpLintCheckTest.php @@ -5,7 +5,7 @@ use PhpSchool\PhpWorkshop\Check\SimpleCheckInterface; use PhpSchool\PhpWorkshop\Exercise\ExerciseType; use PhpSchool\PhpWorkshop\Input\Input; -use PHPUnit_Framework_TestCase; +use PHPUnit\Framework\TestCase; use PhpSchool\PhpWorkshop\Check\PhpLintCheck; use PhpSchool\PhpWorkshop\Exercise\ExerciseInterface; use PhpSchool\PhpWorkshop\Result\Failure; @@ -16,7 +16,7 @@ * @package PhpSchool\PhpWorkshopTest * @author Aydin Hassan */ -class PhpLintCheckTest extends PHPUnit_Framework_TestCase +class PhpLintCheckTest extends TestCase { /** @@ -41,7 +41,7 @@ public function setUp() $this->assertTrue($this->check->canRun(ExerciseType::CLI())); } - public function testSuccess() + public function testSuccess() : void { $this->assertInstanceOf( Success::class, @@ -49,7 +49,7 @@ public function testSuccess() ); } - public function testFailure() + public function testFailure() : void { $failure = $this->check->check( $this->exercise, @@ -57,7 +57,7 @@ public function testFailure() ); $this->assertInstanceOf(Failure::class, $failure); $this->assertRegExp( - "/^PHP Parse error: syntax error, unexpected end of file, expecting ',' or ';'/", + "/^Parse error: syntax error, unexpected end of file, expecting ',' or ';'/", $failure->getReason() ); } diff --git a/test/CodeInsertionTest.php b/test/CodeInsertionTest.php index 8f7113e8..de546d40 100644 --- a/test/CodeInsertionTest.php +++ b/test/CodeInsertionTest.php @@ -4,28 +4,28 @@ use Assert\InvalidArgumentException; use PhpSchool\PhpWorkshop\CodeInsertion; -use PHPUnit_Framework_TestCase; +use PHPUnit\Framework\TestCase; /** * Class CodeInsertionTest * @package PhpSchool\PhpWorkshopTest * @author Aydin Hassan */ -class CodeInsertionTest extends PHPUnit_Framework_TestCase +class CodeInsertionTest extends TestCase { - public function testInvalidType() + public function testInvalidType() : void { $this->expectException(InvalidArgumentException::class); new CodeInsertion('notatype', ''); } - public function testInvalidCode() + public function testInvalidCode() : void { $this->expectException(InvalidArgumentException::class); new CodeInsertion(CodeInsertion::TYPE_BEFORE, new \stdClass); } - public function testGetters() + public function testGetters() : void { $mod = new CodeInsertion(CodeInsertion::TYPE_BEFORE, 'assertEquals(CodeInsertion::TYPE_BEFORE, $mod->getType()); diff --git a/test/CodePatcherTest.php b/test/CodePatcherTest.php index 36323681..2cfee5d4 100644 --- a/test/CodePatcherTest.php +++ b/test/CodePatcherTest.php @@ -2,6 +2,7 @@ namespace PhpSchool\PhpWorkshopTest; +use PhpParser\Node\Expr\Variable; use PhpParser\Node\Name; use PhpParser\Node\Stmt\Catch_; use PhpParser\Node\Stmt\TryCatch; @@ -9,11 +10,9 @@ use PhpParser\PrettyPrinter\Standard; use PhpSchool\PhpWorkshop\CodePatcher; use PhpSchool\PhpWorkshop\Exercise\ExerciseInterface; -use PhpSchool\PhpWorkshop\Exercise\PreProcessable; -use PhpSchool\PhpWorkshop\Exercise\SubmissionPatchable; use PhpSchool\PhpWorkshop\Patch; use PhpSchool\PhpWorkshopTest\Asset\PatchableExercise; -use PHPUnit_Framework_TestCase; +use PHPUnit\Framework\TestCase; use PhpSchool\PhpWorkshop\CodeInsertion as Insertion; /** @@ -21,9 +20,9 @@ * @package PhpSchool\PhpWorkshopTest * @author Aydin Hassan */ -class CodePatcherTest extends PHPUnit_Framework_TestCase +class CodePatcherTest extends TestCase { - public function testDefaultPatchIsAppliedIfAvailable() + public function testDefaultPatchIsAppliedIfAvailable() : void { $patch = (new Patch) ->withInsertion(new Insertion(Insertion::TYPE_BEFORE, 'ini_set("display_errors", 1);')); @@ -36,7 +35,7 @@ public function testDefaultPatchIsAppliedIfAvailable() } - public function testPatcherDoesNotApplyPatchIfNotPatchableExercise() + public function testPatcherDoesNotApplyPatchIfNotPatchableExercise() : void { $patcher = new CodePatcher((new ParserFactory)->create(ParserFactory::PREFER_PHP7), new Standard); $exercise = $this->createMock(ExerciseInterface::class); @@ -47,12 +46,8 @@ public function testPatcherDoesNotApplyPatchIfNotPatchableExercise() /** * @dataProvider codeProvider - * - * @param string $code - * @param Patch $patch - * @param string $expectedResult */ - public function testPatcher($code, Patch $patch, $expectedResult) + public function testPatcher(string $code, Patch $patch, string $expectedResult) : void { $patcher = new CodePatcher((new ParserFactory)->create(ParserFactory::PREFER_PHP7), new Standard); @@ -61,13 +56,13 @@ public function testPatcher($code, Patch $patch, $expectedResult) $exercise ->expects($this->once()) ->method('getPatch') - ->will($this->returnValue($patch)); + ->willReturn($patch); $result = $patcher->patch($exercise, $code); $this->assertEquals($expectedResult, $result); } - public function codeProvider() + public function codeProvider() : array { return [ 'only-before-insertion' => [ @@ -108,7 +103,10 @@ public function codeProvider() (new Patch) ->withTransformer(function (array $statements) { return [ - new TryCatch($statements, [new Catch_([new Name(\Exception::class)], 'e', [])]) + new TryCatch( + $statements, + [new Catch_([new Name(\Exception::class)], new Variable('e'), [])] + ) ]; }), "withInsertion(new Insertion(Insertion::TYPE_BEFORE, '$before = "here";')) ->withTransformer(function (array $statements) { return [ - new TryCatch($statements, [new Catch_([new Name(\Exception::class)], 'e', [])]) + new TryCatch( + $statements, + [new Catch_([new Name(\Exception::class)], new Variable('e'), [])] + ) ]; }), " * @author Michael Woodward */ -class CreditsCommandTest extends PHPUnit_Framework_TestCase +class CreditsCommandTest extends TestCase { - public function testInvoke() + public function testInvoke() : void { $this->expectOutputString(file_get_contents(__DIR__ . '/../res/app-credits-expected.txt')); @@ -36,14 +35,14 @@ public function testInvoke() '@AydinHassan' => 'Aydin Hassan', '@mikeymike' => 'Michael Woodward', ], - new StdOutput($color, $this->createMock(TerminalInterface::class)), + new StdOutput($color, $this->createMock(Terminal::class)), $color ); $command->__invoke(); } - public function testWithOnlyCoreContributors() + public function testWithOnlyCoreContributors() : void { $this->expectOutputString(file_get_contents(__DIR__ . '/../res/app-credits-core-expected.txt')); @@ -58,14 +57,14 @@ public function testWithOnlyCoreContributors() '@chris3ailey' => 'Chris Bailey' ], [], - new StdOutput($color, $this->createMock(TerminalInterface::class)), + new StdOutput($color, $this->createMock(Terminal::class)), $color ); $command->__invoke(); } - public function testWithNoContributors() + public function testWithNoContributors() : void { $this->expectOutputString(''); @@ -75,7 +74,7 @@ public function testWithNoContributors() $command = new CreditsCommand( [], [], - new StdOutput($color, $this->createMock(TerminalInterface::class)), + new StdOutput($color, $this->createMock(Terminal::class)), $color ); diff --git a/test/Command/HelpCommandTest.php b/test/Command/HelpCommandTest.php index 759e29f5..04ea014f 100644 --- a/test/Command/HelpCommandTest.php +++ b/test/Command/HelpCommandTest.php @@ -3,19 +3,19 @@ namespace PhpSchool\PhpWorkshopTest\Command; use Colors\Color; -use PhpSchool\CliMenu\Terminal\TerminalInterface; +use PhpSchool\Terminal\Terminal; use PhpSchool\PhpWorkshop\Command\HelpCommand; use PhpSchool\PhpWorkshop\Output\StdOutput; -use PHPUnit_Framework_TestCase; +use PHPUnit\Framework\TestCase; /** * Class HelpCommandTest * @package PhpSchool\PhpWorkshop\Command * @author Michael Woodward */ -class HelpCommandTest extends PHPUnit_Framework_TestCase +class HelpCommandTest extends TestCase { - public function testInvoke() + public function testInvoke() : void { $this->expectOutputString(file_get_contents(__DIR__ . '/../res/app-help-expected.txt')); @@ -24,7 +24,7 @@ public function testInvoke() $command = new HelpCommand( 'learnyouphp', - new StdOutput($color, $this->createMock(TerminalInterface::class)), + new StdOutput($color, $this->createMock(Terminal::class)), $color ); diff --git a/test/Command/MenuCommandInvokerTest.php b/test/Command/MenuCommandInvokerTest.php index 48366761..765b8b75 100644 --- a/test/Command/MenuCommandInvokerTest.php +++ b/test/Command/MenuCommandInvokerTest.php @@ -4,16 +4,16 @@ use PhpSchool\CliMenu\CliMenu; use PhpSchool\PhpWorkshop\Command\MenuCommandInvoker; -use PHPUnit_Framework_TestCase; +use PHPUnit\Framework\TestCase; /** * Class MenuCommandInvokerTest * @package PhpSchool\PhpWorkshopTest\Command * @author Aydin Hassan */ -class MenuCommandInvokerTest extends PHPUnit_Framework_TestCase +class MenuCommandInvokerTest extends TestCase { - public function testInvoker() + public function testInvoker() : void { $menu = $this->createMock(CliMenu::class); $menu diff --git a/test/Command/MenuCommandTest.php b/test/Command/MenuCommandTest.php index 78d2db5e..a9903660 100644 --- a/test/Command/MenuCommandTest.php +++ b/test/Command/MenuCommandTest.php @@ -4,7 +4,7 @@ namespace PhpSchool\PhpWorkshopTest\Command; use PhpSchool\CliMenu\CliMenu; -use PHPUnit_Framework_TestCase; +use PHPUnit\Framework\TestCase; use PhpSchool\PhpWorkshop\Command\MenuCommand; /** @@ -12,9 +12,9 @@ * @package PhpSchool\PhpWorkshop\Command * @author Aydin Hassan */ -class MenuCommandTest extends PHPUnit_Framework_TestCase +class MenuCommandTest extends TestCase { - public function testInvoke() + public function testInvoke() : void { $menu = $this->createMock(CliMenu::class); $menu diff --git a/test/Command/PrintCommandTest.php b/test/Command/PrintCommandTest.php index 33659319..8779bf4e 100644 --- a/test/Command/PrintCommandTest.php +++ b/test/Command/PrintCommandTest.php @@ -1,10 +1,11 @@ */ -class PrintCommandTest extends PHPUnit_Framework_TestCase +class PrintCommandTest extends TestCase { - public function testExerciseIsPrintedIfAssigned() + public function testExerciseIsPrintedIfAssigned() : void { $file = tempnam(sys_get_temp_dir(), 'pws'); file_put_contents($file, '### Exercise 1'); @@ -39,7 +40,7 @@ public function testExerciseIsPrintedIfAssigned() ->expects($this->once()) ->method('render') ->with('### Exercise 1') - ->will($this->returnValue('### Exercise 1')); + ->willReturn('### Exercise 1'); $output ->expects($this->once()) diff --git a/test/Command/RunCommandTest.php b/test/Command/RunCommandTest.php index 440c041d..272d2bd0 100644 --- a/test/Command/RunCommandTest.php +++ b/test/Command/RunCommandTest.php @@ -3,7 +3,7 @@ namespace PhpSchool\PhpWorkshopTest\Command; use Colors\Color; -use PhpSchool\CliMenu\Terminal\TerminalInterface; +use PhpSchool\Terminal\Terminal; use PhpSchool\PhpWorkshop\Command\RunCommand; use PhpSchool\PhpWorkshop\ExerciseDispatcher; use PhpSchool\PhpWorkshop\ExerciseRepository; @@ -11,14 +11,14 @@ use PhpSchool\PhpWorkshop\Output\StdOutput; use PhpSchool\PhpWorkshop\UserState; use PhpSchool\PhpWorkshopTest\Asset\CliExerciseImpl; -use PHPUnit_Framework_TestCase; +use PHPUnit\Framework\TestCase; /** * @author Aydin Hassan */ -class RunCommandTest extends PHPUnit_Framework_TestCase +class RunCommandTest extends TestCase { - public function test() + public function test() : void { $input = new Input('appName', ['program' => 'solution.php']); @@ -29,7 +29,7 @@ public function test() $state->setCurrentExercise('my-exercise'); $color = new Color; $color->setForceStyle(true); - $output = new StdOutput($color, $this->createMock(TerminalInterface::class)); + $output = new StdOutput($color, $this->createMock(Terminal::class)); $dispatcher = $this->prophesize(ExerciseDispatcher::class); $dispatcher->run($exercise, $input, $output)->shouldBeCalled(); diff --git a/test/Command/VerifyCommandTest.php b/test/Command/VerifyCommandTest.php index dd8ddd3b..bbc6e990 100644 --- a/test/Command/VerifyCommandTest.php +++ b/test/Command/VerifyCommandTest.php @@ -3,13 +3,13 @@ namespace PhpSchool\PhpWorkshopTest\Command; use Colors\Color; -use PhpSchool\CliMenu\Terminal\TerminalInterface; +use PhpSchool\Terminal\Terminal; use PhpSchool\PhpWorkshop\Check\CheckInterface; use PhpSchool\PhpWorkshop\ExerciseDispatcher; use PhpSchool\PhpWorkshop\Input\Input; use PhpSchool\PhpWorkshop\Output\StdOutput; use PhpSchool\PhpWorkshopTest\Asset\CliExerciseImpl; -use PHPUnit_Framework_TestCase; +use PHPUnit\Framework\TestCase; use PhpSchool\PhpWorkshop\Command\VerifyCommand; use PhpSchool\PhpWorkshop\ExerciseRepository; use PhpSchool\PhpWorkshop\Result\Failure; @@ -24,7 +24,7 @@ * @package PhpSchool\PhpWorkshop\Command * @author Aydin Hassan */ -class VerifyCommandTest extends PHPUnit_Framework_TestCase +class VerifyCommandTest extends TestCase { /** @@ -32,16 +32,15 @@ class VerifyCommandTest extends PHPUnit_Framework_TestCase */ private $check; - public function setUp() + public function setUp() : void { $this->check = $this->createMock(CheckInterface::class); $this->check - ->expects($this->any()) ->method('getName') - ->will($this->returnValue('Some Check')); + ->willReturn('Some Check'); } - public function testVerifyAddsCompletedExerciseAndReturnsCorrectCodeOnSuccess() + public function testVerifyAddsCompletedExerciseAndReturnsCorrectCodeOnSuccess() : void { $file = tempnam(sys_get_temp_dir(), 'pws'); touch($file); @@ -55,7 +54,7 @@ public function testVerifyAddsCompletedExerciseAndReturnsCorrectCodeOnSuccess() $state->setCurrentExercise('my-exercise'); $color = new Color; $color->setForceStyle(true); - $output = new StdOutput($color, $this->createMock(TerminalInterface::class)); + $output = new StdOutput($color, $this->createMock(Terminal::class)); $serializer = $this->createMock(UserStateSerializer::class); $serializer @@ -74,7 +73,7 @@ public function testVerifyAddsCompletedExerciseAndReturnsCorrectCodeOnSuccess() ->expects($this->once()) ->method('verify') ->with($exercise, $input) - ->will($this->returnValue($results)); + ->willReturn($results); $renderer ->expects($this->once()) @@ -88,7 +87,7 @@ public function testVerifyAddsCompletedExerciseAndReturnsCorrectCodeOnSuccess() unlink($file); } - public function testVerifyDoesNotAddCompletedExerciseAndReturnsCorrectCodeOnFailure() + public function testVerifyDoesNotAddCompletedExerciseAndReturnsCorrectCodeOnFailure() : void { $file = tempnam(sys_get_temp_dir(), 'pws'); touch($file); @@ -101,7 +100,7 @@ public function testVerifyDoesNotAddCompletedExerciseAndReturnsCorrectCodeOnFail $state->setCurrentExercise('my-exercise'); $color = new Color; $color->setForceStyle(true); - $output = new StdOutput($color, $this->createMock(TerminalInterface::class)); + $output = new StdOutput($color, $this->createMock(Terminal::class)); $serializer = $this->createMock(UserStateSerializer::class); @@ -121,7 +120,7 @@ public function testVerifyDoesNotAddCompletedExerciseAndReturnsCorrectCodeOnFail ->expects($this->once()) ->method('verify') ->with($exercise, $input) - ->will($this->returnValue($results)); + ->willReturn($results); $renderer ->expects($this->once()) diff --git a/test/CommandArgumentTest.php b/test/CommandArgumentTest.php index 7d929083..113332c0 100644 --- a/test/CommandArgumentTest.php +++ b/test/CommandArgumentTest.php @@ -3,21 +3,21 @@ namespace PhpSchool\PhpWorkshopTest; use PhpSchool\PhpWorkshop\CommandArgument; -use PHPUnit_Framework_TestCase; +use PHPUnit\Framework\TestCase; /** * @author Aydin Hassan */ -class CommandArgumentTest extends PHPUnit_Framework_TestCase +class CommandArgumentTest extends TestCase { - public function testRequiredArgument() + public function testRequiredArgument() : void { $arg = new CommandArgument('arg1'); $this->assertSame('arg1', $arg->getName()); $this->assertFalse($arg->isOptional()); } - public function testOptionalArgument() + public function testOptionalArgument() : void { $arg = new CommandArgument('arg1', true); $this->assertSame('arg1', $arg->getName()); diff --git a/test/CommandDefinitionTest.php b/test/CommandDefinitionTest.php index 4dd91fd4..15812dfb 100644 --- a/test/CommandDefinitionTest.php +++ b/test/CommandDefinitionTest.php @@ -4,16 +4,16 @@ use PhpSchool\PhpWorkshop\CommandArgument; use PhpSchool\PhpWorkshop\Exception\InvalidArgumentException; -use PHPUnit_Framework_TestCase; +use PHPUnit\Framework\TestCase; use PhpSchool\PhpWorkshop\CommandDefinition; /** * @author Aydin Hassan */ -class CommandDefinitionTest extends PHPUnit_Framework_TestCase +class CommandDefinitionTest extends TestCase { - public function testGettersSettersWithStringArgs() + public function testGettersSettersWithStringArgs() : void { $callable = function () { }; @@ -29,7 +29,7 @@ public function testGettersSettersWithStringArgs() $this->assertSame($callable, $definition->getCommandCallable()); } - public function testGettersSettersWithObjArgs() + public function testGettersSettersWithObjArgs() : void { $callable = function () { }; @@ -45,7 +45,7 @@ public function testGettersSettersWithObjArgs() $this->assertSame($callable, $definition->getCommandCallable()); } - public function testExceptionIsThrowWhenTryingToAddRequiredArgAfterOptionalArg() + public function testExceptionIsThrowWhenTryingToAddRequiredArgAfterOptionalArg() : void { $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('A required argument cannot follow an optional argument'); @@ -56,7 +56,7 @@ public function testExceptionIsThrowWhenTryingToAddRequiredArgAfterOptionalArg() ->addArgument(CommandArgument::required('required-arg')); } - public function testExceptionIsThrownWithWrongParameterToAddArgument() + public function testExceptionIsThrownWithWrongParameterToAddArgument() : void { $this->expectException(InvalidArgumentException::class); $msg = 'Parameter: "argument" can only be one of: "string", "PhpSchool\PhpWorkshop\CommandArgument" '; diff --git a/test/CommandRouterTest.php b/test/CommandRouterTest.php index 3a8f9f2a..a05dec68 100644 --- a/test/CommandRouterTest.php +++ b/test/CommandRouterTest.php @@ -7,7 +7,7 @@ use PhpSchool\PhpWorkshop\CommandArgument; use PhpSchool\PhpWorkshop\Event\EventDispatcher; use PhpSchool\PhpWorkshop\Input\Input; -use PHPUnit_Framework_TestCase; +use PHPUnit\Framework\TestCase; use PhpSchool\PhpWorkshop\CommandDefinition; use PhpSchool\PhpWorkshop\CommandRouter; use PhpSchool\PhpWorkshop\Exception\CliRouteNotExistsException; @@ -19,9 +19,9 @@ * @package PhpSchool\PhpWorkshopTest * @author Aydin Hassan */ -class CommandRouterTest extends PHPUnit_Framework_TestCase +class CommandRouterTest extends TestCase { - public function testInvalidDefaultThrowsException() + public function testInvalidDefaultThrowsException() : void { $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Default command: "cmd" is not available'); @@ -31,7 +31,7 @@ public function testInvalidDefaultThrowsException() new CommandRouter([], 'cmd', $eventDispatcher, $c); } - public function testAddCommandThrowsExceptionIfCommandWithSameNameExists() + public function testAddCommandThrowsExceptionIfCommandWithSameNameExists() : void { $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Command with name: "cmd" already exists'); @@ -44,14 +44,7 @@ public function testAddCommandThrowsExceptionIfCommandWithSameNameExists() ], 'default', $eventDispatcher, $c); } - public function testConstruct() - { - $c = $this->createMock(ContainerInterface::class); - $eventDispatcher = $this->createMock(EventDispatcher::class); - new CommandRouter([new CommandDefinition('cmd', [], 'service'),], 'cmd', $eventDispatcher, $c); - } - - public function testRouteCommandWithNoArgsFromArrayUsesDefaultCommand() + public function testRouteCommandWithNoArgsFromArrayUsesDefaultCommand() : void { $args = ['app']; @@ -61,7 +54,7 @@ public function testRouteCommandWithNoArgsFromArrayUsesDefaultCommand() $mock->expects($this->once()) ->method('__invoke') - ->will($this->returnValue(true)); + ->willReturn(true); $c = $this->createMock(ContainerInterface::class); $eventDispatcher = $this->createMock(EventDispatcher::class); @@ -70,7 +63,7 @@ public function testRouteCommandWithNoArgsFromArrayUsesDefaultCommand() $router->route($args); } - public function testRouteCommandWithNoArgsFromArgVUsesDefaultCommand() + public function testRouteCommandWithNoArgsFromArgVUsesDefaultCommand() : void { $server = $_SERVER; $_SERVER['argv'] = ['app']; @@ -80,7 +73,7 @@ public function testRouteCommandWithNoArgsFromArgVUsesDefaultCommand() $mock->expects($this->once()) ->method('__invoke') - ->will($this->returnValue(true)); + ->willReturn(true); $c = $this->createMock(ContainerInterface::class); $eventDispatcher = $this->createMock(EventDispatcher::class); @@ -90,7 +83,7 @@ public function testRouteCommandWithNoArgsFromArgVUsesDefaultCommand() $_SERVER = $server; } - public function testRouteCommandThrowsExceptionIfCommandWithNameNotExist() + public function testRouteCommandThrowsExceptionIfCommandWithNameNotExist() : void { $this->expectException(CliRouteNotExistsException::class); $this->expectExceptionMessage('Command: "not-a-cmd" does not exist'); @@ -103,7 +96,7 @@ public function testRouteCommandThrowsExceptionIfCommandWithNameNotExist() $router->route(['app', 'not-a-cmd']); } - public function testRouteCommandThrowsExceptionIfCommandIsMissingAllArguments() + public function testRouteCommandThrowsExceptionIfCommandIsMissingAllArguments() : void { $this->expectException(MissingArgumentException::class); $this->expectExceptionMessage('Command: "verify" is missing the following arguments: "exercise", "program"'); @@ -120,7 +113,7 @@ public function testRouteCommandThrowsExceptionIfCommandIsMissingAllArguments() $router->route(['app', 'verify']); } - public function testRouteCommandThrowsExceptionIfCommandIsMissingArguments() + public function testRouteCommandThrowsExceptionIfCommandIsMissingArguments() : void { $this->expectException(MissingArgumentException::class); $this->expectExceptionMessage('Command: "verify" is missing the following arguments: "program"'); @@ -137,7 +130,7 @@ public function testRouteCommandThrowsExceptionIfCommandIsMissingArguments() $router->route(['app', 'verify', 'some-exercise']); } - public function testRouteCommandWithArgs() + public function testRouteCommandWithArgs() : void { $mock = $this->getMockBuilder('stdClass') ->setMethods(['__invoke']) @@ -150,7 +143,7 @@ public function testRouteCommandWithArgs() && $input->getArgument('exercise') === 'some-exercise' && $input->getArgument('program') === 'program.php'; })) - ->will($this->returnValue(true)); + ->willReturn(true); $c = $this->createMock(ContainerInterface::class); $eventDispatcher = $this->createMock(EventDispatcher::class); @@ -163,7 +156,7 @@ public function testRouteCommandWithArgs() $router->route(['app', 'verify', 'some-exercise', 'program.php']); } - public function testExceptionIsThrownIfCallableNotCallableAndNotContainerReference() + public function testExceptionIsThrownIfCallableNotCallableAndNotContainerReference() : void { $this->expectException(RuntimeException::class); $this->expectExceptionMessage('Callable must be a callable or a container entry for a callable service'); @@ -179,7 +172,7 @@ public function testExceptionIsThrownIfCallableNotCallableAndNotContainerReferen $router->route(['app', 'verify', 'some-exercise', 'program.php']); } - public function testExceptionIsThrownIfCallableNotCallableAndNotExistingContainerEntry() + public function testExceptionIsThrownIfCallableNotCallableAndNotExistingContainerEntry() : void { $this->expectException(RuntimeException::class); $this->expectExceptionMessage('Container has no entry named: "some.service"'); @@ -191,7 +184,7 @@ public function testExceptionIsThrownIfCallableNotCallableAndNotExistingContaine ->expects($this->once()) ->method('has') ->with('some.service') - ->will($this->returnValue(false)); + ->willReturn(false); $router = new CommandRouter( [new CommandDefinition('verify', ['exercise', 'program'], 'some.service'),], @@ -202,7 +195,7 @@ public function testExceptionIsThrownIfCallableNotCallableAndNotExistingContaine $router->route(['app', 'verify', 'some-exercise', 'program.php']); } - public function testExceptionIsThrownIfContainerEntryNotCallable() + public function testExceptionIsThrownIfContainerEntryNotCallable() : void { $this->expectException(RuntimeException::class); $this->expectExceptionMessage('Container entry: "some.service" not callable'); @@ -214,13 +207,13 @@ public function testExceptionIsThrownIfContainerEntryNotCallable() ->expects($this->once()) ->method('has') ->with('some.service') - ->will($this->returnValue(true)); + ->willReturn(true); $c ->expects($this->once()) ->method('get') ->with('some.service') - ->will($this->returnValue(null)); + ->willReturn(null); $router = new CommandRouter( [new CommandDefinition('verify', ['exercise', 'program'], 'some.service'),], @@ -231,7 +224,7 @@ public function testExceptionIsThrownIfContainerEntryNotCallable() $router->route(['app', 'verify', 'some-exercise', 'program.php']); } - public function testCallableFromContainer() + public function testCallableFromContainer() : void { $c = $this->createMock(ContainerInterface::class); @@ -246,19 +239,19 @@ public function testCallableFromContainer() && $input->getArgument('exercise') === 'some-exercise' && $input->getArgument('program') === 'program.php'; })) - ->will($this->returnValue(true)); + ->willReturn(true); $c ->expects($this->once()) ->method('has') ->with('some.service') - ->will($this->returnValue(true)); + ->willReturn(true); $c ->expects($this->once()) ->method('get') ->with('some.service') - ->will($this->returnValue($mock)); + ->willReturn($mock); $eventDispatcher = $this->createMock(EventDispatcher::class); @@ -271,7 +264,7 @@ public function testCallableFromContainer() $router->route(['app', 'verify', 'some-exercise', 'program.php']); } - public function testCallableFromContainerWithIntegerReturnCode() + public function testCallableFromContainerWithIntegerReturnCode() : void { $c = $this->createMock(ContainerInterface::class); @@ -286,19 +279,19 @@ public function testCallableFromContainerWithIntegerReturnCode() && $input->getArgument('exercise') === 'some-exercise' && $input->getArgument('program') === 'program.php'; })) - ->will($this->returnValue(10)); + ->willReturn(10); $c ->expects($this->once()) ->method('has') ->with('some.service') - ->will($this->returnValue(true)); + ->willReturn(true); $c ->expects($this->once()) ->method('get') ->with('some.service') - ->will($this->returnValue($mock)); + ->willReturn($mock); $eventDispatcher = $this->createMock(EventDispatcher::class); @@ -312,7 +305,7 @@ public function testCallableFromContainerWithIntegerReturnCode() $this->assertEquals(10, $res); } - public function testRouteCommandSpeltIncorrectlyStillRoutes() + public function testRouteCommandSpeltIncorrectlyStillRoutes() : void { $mock = $this->getMockBuilder('stdClass') ->setMethods(['__invoke']) @@ -325,7 +318,7 @@ public function testRouteCommandSpeltIncorrectlyStillRoutes() && $input->getArgument('exercise') === 'some-exercise' && $input->getArgument('program') === 'program.php'; })) - ->will($this->returnValue(true)); + ->willReturn(true); $c = $this->createMock(ContainerInterface::class); $eventDispatcher = $this->createMock(EventDispatcher::class); @@ -339,7 +332,7 @@ public function testRouteCommandSpeltIncorrectlyStillRoutes() $router->route(['app', 'verifu', 'some-exercise', 'program.php']); } - public function testRouteCommandWithOptionalArgument() + public function testRouteCommandWithOptionalArgument() : void { $mock = $this->getMockBuilder('stdClass') ->setMethods(['__invoke']) @@ -351,7 +344,7 @@ public function testRouteCommandWithOptionalArgument() return $input->getAppName() === 'app' && $input->getArgument('exercise') === 'some-exercise'; })) - ->will($this->returnValue(true)); + ->willReturn(true); $mock->expects($this->at(1)) ->method('__invoke') @@ -360,7 +353,7 @@ public function testRouteCommandWithOptionalArgument() && $input->getArgument('exercise') === 'some-exercise' && $input->getArgument('program') === 'program.php'; })) - ->will($this->returnValue(true)); + ->willReturn(true); $c = $this->createMock(ContainerInterface::class); $eventDispatcher = $this->createMock(EventDispatcher::class); diff --git a/test/ComposerUtil/LockFileParserTest.php b/test/ComposerUtil/LockFileParserTest.php index d92f25f7..916497f1 100644 --- a/test/ComposerUtil/LockFileParserTest.php +++ b/test/ComposerUtil/LockFileParserTest.php @@ -4,15 +4,15 @@ use PhpSchool\PhpWorkshop\ComposerUtil\LockFileParser; use PhpSchool\PhpWorkshop\Exception\InvalidArgumentException; -use PHPUnit_Framework_TestCase; +use PHPUnit\Framework\TestCase; /** * Class LockFileParserTest * @author Aydin Hassan */ -class LockFileParserTest extends PHPUnit_Framework_TestCase +class LockFileParserTest extends TestCase { - public function testGetPackages() + public function testGetPackages() : void { $locker = new LockFileParser(__DIR__ . '/../res/composer.lock'); $this->assertEquals([ @@ -21,7 +21,7 @@ public function testGetPackages() ], $locker->getInstalledPackages()); } - public function testHasPackage() + public function testHasPackage() : void { $locker = new LockFileParser(__DIR__ . '/../res/composer.lock'); $this->assertTrue($locker->hasInstalledPackage('danielstjules/stringy')); @@ -29,7 +29,7 @@ public function testHasPackage() $this->assertFalse($locker->hasInstalledPackage('not-a-package')); } - public function testExceptionIsThrownIfFileNotExists() + public function testExceptionIsThrownIfFileNotExists() : void { $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Lock File: "not-a-file" does not exist'); diff --git a/test/Event/CgiExecuteEventTest.php b/test/Event/CgiExecuteEventTest.php index a65d9b73..fbe8920a 100644 --- a/test/Event/CgiExecuteEventTest.php +++ b/test/Event/CgiExecuteEventTest.php @@ -3,7 +3,7 @@ namespace PhpSchool\PhpWorkshopTest\Event; use PhpSchool\PhpWorkshop\Event\CgiExecuteEvent; -use PHPUnit_Framework_TestCase; +use PHPUnit\Framework\TestCase; use Psr\Http\Message\RequestInterface; use Zend\Diactoros\Request; @@ -12,9 +12,9 @@ * @package PhpSchool\PhpWorkshopTest\Event * @author Aydin Hassan */ -class CgiExecuteEventTest extends PHPUnit_Framework_TestCase +class CgiExecuteEventTest extends TestCase { - public function testAddHeader() + public function testAddHeader() : void { $request = new Request; $e = new CgiExecuteEvent('event', $request); @@ -24,7 +24,7 @@ public function testAddHeader() $this->assertNotSame($request, $e->getRequest()); } - public function testModifyRequest() + public function testModifyRequest() : void { $request = new Request; $e = new CgiExecuteEvent('event', $request); @@ -39,7 +39,7 @@ public function testModifyRequest() $this->assertNotSame($request, $e->getRequest()); } - public function testGetRequest() + public function testGetRequest() : void { $request = new Request; $e = new CgiExecuteEvent('event', $request); diff --git a/test/Event/CliExecuteEventTest.php b/test/Event/CliExecuteEventTest.php index 9ebd1b6f..382c3d63 100644 --- a/test/Event/CliExecuteEventTest.php +++ b/test/Event/CliExecuteEventTest.php @@ -4,16 +4,16 @@ use PhpSchool\PhpWorkshop\Event\CliExecuteEvent; use PhpSchool\PhpWorkshop\Utils\ArrayObject; -use PHPUnit_Framework_TestCase; +use PHPUnit\Framework\TestCase; /** * Class CliExecuteEventTest * @package PhpSchool\PhpWorkshopTest\Event * @author Aydin Hassan */ -class CliExecuteEventTest extends PHPUnit_Framework_TestCase +class CliExecuteEventTest extends TestCase { - public function testAppendArg() + public function testAppendArg() : void { $arr = new ArrayObject([1, 2, 3]); $e = new CliExecuteEvent('event', $arr); @@ -23,7 +23,7 @@ public function testAppendArg() $this->assertNotSame($arr, $e->getArgs()); } - public function testPrependArg() + public function testPrependArg() : void { $arr = new ArrayObject([1, 2, 3]); $e = new CliExecuteEvent('event', $arr); @@ -33,7 +33,7 @@ public function testPrependArg() $this->assertNotSame($arr, $e->getArgs()); } - public function testGetArgs() + public function testGetArgs() : void { $arr = new ArrayObject([1, 2, 3]); $e = new CliExecuteEvent('event', $arr); diff --git a/test/Event/ContainerListenerHelperTest.php b/test/Event/ContainerListenerHelperTest.php index 497135ea..4d102945 100644 --- a/test/Event/ContainerListenerHelperTest.php +++ b/test/Event/ContainerListenerHelperTest.php @@ -3,14 +3,14 @@ namespace PhpSchool\PhpWorkshopTest\Event; use PhpSchool\PhpWorkshop\Event\ContainerListenerHelper; -use PHPUnit_Framework_TestCase; +use PHPUnit\Framework\TestCase; /** * @author Aydin Hassan */ -class ContainerListenerHelperTest extends PHPUnit_Framework_TestCase +class ContainerListenerHelperTest extends TestCase { - public function testDefaultMethodIsInvoke() + public function testDefaultMethodIsInvoke() : void { $helper = new ContainerListenerHelper('Some\Object'); @@ -18,7 +18,7 @@ public function testDefaultMethodIsInvoke() $this->assertEquals('__invoke', $helper->getMethod()); } - public function testWithCustomMethod() + public function testWithCustomMethod() : void { $helper = new ContainerListenerHelper('Some\Object', 'myMethod'); diff --git a/test/Event/EventDispatcherTest.php b/test/Event/EventDispatcherTest.php index a16eef84..641eac6b 100644 --- a/test/Event/EventDispatcherTest.php +++ b/test/Event/EventDispatcherTest.php @@ -7,14 +7,14 @@ use PhpSchool\PhpWorkshop\Event\EventInterface; use PhpSchool\PhpWorkshop\Result\ResultInterface; use PhpSchool\PhpWorkshop\ResultAggregator; -use PHPUnit_Framework_TestCase; +use PHPUnit\Framework\TestCase; /** * Class EventDispatcherTest * @package PhpSchool\PhpWorkshopTest\Event * @author Aydin Hassan */ -class EventDispatcherTest extends PHPUnit_Framework_TestCase +class EventDispatcherTest extends TestCase { /** * @var ResultAggregator @@ -26,13 +26,13 @@ class EventDispatcherTest extends PHPUnit_Framework_TestCase */ private $eventDispatcher; - public function setUp() + public function setUp() : void { $this->results = new ResultAggregator; $this->eventDispatcher = new EventDispatcher($this->results); } - public function testOnlyAppropriateListenersAreCalledForEvent() + public function testOnlyAppropriateListenersAreCalledForEvent() : void { $e = new Event('some-event', ['arg1' => 1, 'arg2' => 2]); $mockCallback1 = $this->getMockBuilder('stdClass') @@ -42,7 +42,7 @@ public function testOnlyAppropriateListenersAreCalledForEvent() $mockCallback1->expects($this->exactly(2)) ->method('__invoke') ->with($e) - ->will($this->returnValue(true)); + ->willReturn(true); $mockCallback2 = $this->getMockBuilder('stdClass') ->setMethods(['doNotInvokeMe']) @@ -63,7 +63,7 @@ public function testOnlyAppropriateListenersAreCalledForEvent() $this->eventDispatcher->dispatch($e); } - public function testOnlyAppropriateVerifiersAreCalledForEvent() + public function testOnlyAppropriateVerifiersAreCalledForEvent() : void { $e = new Event('some-event', ['arg1' => 1, 'arg2' => 2]); $result = $this->createMock(ResultInterface::class); @@ -75,7 +75,7 @@ public function testOnlyAppropriateVerifiersAreCalledForEvent() $mockCallback1->expects($this->exactly(2)) ->method('__invoke') ->with($e) - ->will($this->returnValue($result)); + ->willReturn($result); $cb = function (Event $e) use ($mockCallback1) { return $mockCallback1($e); @@ -88,7 +88,7 @@ public function testOnlyAppropriateVerifiersAreCalledForEvent() $this->assertEquals([$result, $result], iterator_to_array($this->results)); } - public function testVerifyReturnIsSkippedIfNotInstanceOfResult() + public function testVerifyReturnIsSkippedIfNotInstanceOfResult() : void { $e = new Event('some-event', ['arg1' => 1, 'arg2' => 2]); $mockCallback1 = $this->getMockBuilder('stdClass') @@ -98,7 +98,7 @@ public function testVerifyReturnIsSkippedIfNotInstanceOfResult() $mockCallback1->expects($this->once()) ->method('__invoke') ->with($e) - ->will($this->returnValue(null)); + ->willReturn(null); $this->eventDispatcher->insertVerifier('some-event', function (Event $e) use ($mockCallback1) { $mockCallback1($e); @@ -108,7 +108,7 @@ public function testVerifyReturnIsSkippedIfNotInstanceOfResult() $this->assertEquals([], iterator_to_array($this->results)); } - public function testListenWithMultipleEvents() + public function testListenWithMultipleEvents() : void { $e1 = new Event('some-event', ['arg1' => 1, 'arg2' => 2]); $e2 = new Event('some-event', ['arg1' => 1, 'arg2' => 2]); @@ -119,14 +119,14 @@ public function testListenWithMultipleEvents() $mockCallback1->expects($this->exactly(2)) ->method('__invoke') ->withConsecutive([$e1], [$e2]) - ->will($this->returnValue(true)); + ->willReturn(true); $this->eventDispatcher->listen(['some-event', 'second-event'], $mockCallback1); $this->eventDispatcher->dispatch($e1); $this->eventDispatcher->dispatch($e2); } - public function testListenersAndVerifiersAreCalledInOrderOfAttachment() + public function testListenersAndVerifiersAreCalledInOrderOfAttachment() : void { $e1 = new Event('first-event', ['arg1' => 1, 'arg2' => 2]); diff --git a/test/Event/EventTest.php b/test/Event/EventTest.php index 86857486..80402996 100644 --- a/test/Event/EventTest.php +++ b/test/Event/EventTest.php @@ -4,29 +4,29 @@ use PhpSchool\PhpWorkshop\Event\Event; use PhpSchool\PhpWorkshop\Exception\InvalidArgumentException; -use PHPUnit_Framework_TestCase; +use PHPUnit\Framework\TestCase; /** * Class EventTest * @package PhpSchool\PhpWorkshopTest\Event * @author Aydin Hassan */ -class EventTest extends PHPUnit_Framework_TestCase +class EventTest extends TestCase { - public function testGetName() + public function testGetName() : void { $e = new Event('super-sweet-event!'); $this->assertEquals('super-sweet-event!', $e->getName()); } - public function testGetParameters() + public function testGetParameters() : void { $e = new Event('super-sweet-event-with-cool-params', ['cool' => 'stuff']); $this->assertEquals('stuff', $e->getParameter('cool')); $this->assertEquals(['cool' => 'stuff'], $e->getParameters()); } - public function testExeceptionIsThrownIfParameterDoesNotExist() + public function testExeceptionIsThrownIfParameterDoesNotExist() : void { $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Parameter: "cool" does not exist'); diff --git a/test/Event/ExerciseRunnerEventTest.php b/test/Event/ExerciseRunnerEventTest.php index ba4b6937..d9dc3a90 100644 --- a/test/Event/ExerciseRunnerEventTest.php +++ b/test/Event/ExerciseRunnerEventTest.php @@ -5,14 +5,14 @@ use PhpSchool\PhpWorkshop\Event\ExerciseRunnerEvent; use PhpSchool\PhpWorkshop\Input\Input; use PhpSchool\PhpWorkshopTest\Asset\CliExerciseImpl; -use PHPUnit_Framework_TestCase; +use PHPUnit\Framework\TestCase; /** * @author Aydin Hassan */ -class ExerciseRunnerEventTest extends PHPUnit_Framework_TestCase +class ExerciseRunnerEventTest extends TestCase { - public function testGetters() + public function testGetters() : void { $exercise = new CliExerciseImpl; $input = new Input('app'); diff --git a/test/Exception/CheckNotApplicableExceptionTest.php b/test/Exception/CheckNotApplicableExceptionTest.php index b1f0c050..82f2e03e 100644 --- a/test/Exception/CheckNotApplicableExceptionTest.php +++ b/test/Exception/CheckNotApplicableExceptionTest.php @@ -6,39 +6,39 @@ use PhpSchool\PhpWorkshop\Exception\CheckNotApplicableException; use PhpSchool\PhpWorkshop\Exercise\ExerciseInterface; use PhpSchool\PhpWorkshop\Exercise\ExerciseType; -use PHPUnit_Framework_TestCase; +use PHPUnit\Framework\TestCase; /** * Class CheckNotApplicableExceptionTest * @package PhpSchool\PhpWorkshopTest\Exception * @author Aydin Hassan */ -class CheckNotApplicableExceptionTest extends PHPUnit_Framework_TestCase +class CheckNotApplicableExceptionTest extends TestCase { - public function testException() + public function testException() : void { $e = new CheckNotApplicableException('nope'); $this->assertEquals('nope', $e->getMessage()); } - public function testFromCheckAndExerciseConstructor() + public function testFromCheckAndExerciseConstructor() : void { $exercise = $this->createMock(ExerciseInterface::class); $exercise ->expects($this->once()) ->method('getName') - ->will($this->returnValue('Some Exercise')); + ->willReturn('Some Exercise'); $exercise ->expects($this->once()) ->method('getType') - ->will($this->returnValue(ExerciseType::CLI())); + ->willReturn(ExerciseType::CLI()); $check = $this->createMock(CheckInterface::class); $check ->expects($this->once()) ->method('getName') - ->will($this->returnValue('Some Check')); + ->willReturn('Some Check'); $e = CheckNotApplicableException::fromCheckAndExercise($check, $exercise); diff --git a/test/Exception/CliRouteNotExistsTest.php b/test/Exception/CliRouteNotExistsTest.php index 441422a4..946d0d05 100644 --- a/test/Exception/CliRouteNotExistsTest.php +++ b/test/Exception/CliRouteNotExistsTest.php @@ -2,7 +2,7 @@ namespace PhpSchool\PhpWorkshopTest\Exception; -use PHPUnit_Framework_TestCase; +use PHPUnit\Framework\TestCase; use PhpSchool\PhpWorkshop\Exception\CliRouteNotExistsException; /** @@ -10,9 +10,9 @@ * @package PhpSchool\PhpWorkshopTest\Exception * @author Aydin Hassan */ -class CliRouteNotExistsTest extends PHPUnit_Framework_TestCase +class CliRouteNotExistsTest extends TestCase { - public function testException() + public function testException() : void { $e = new CliRouteNotExistsException('some-route'); $this->assertEquals('Command: "some-route" does not exist', $e->getMessage()); diff --git a/test/Exception/CodeExecutionExceptionTest.php b/test/Exception/CodeExecutionExceptionTest.php index a4e5d9d8..bb64466c 100644 --- a/test/Exception/CodeExecutionExceptionTest.php +++ b/test/Exception/CodeExecutionExceptionTest.php @@ -3,7 +3,7 @@ namespace PhpSchool\PhpWorkshopTest\Exception; use PhpSchool\PhpWorkshop\Exception\CodeExecutionException; -use PHPUnit_Framework_TestCase; +use PHPUnit\Framework\TestCase; use Symfony\Component\Process\Process; /** @@ -11,39 +11,39 @@ * @package PhpSchool\PhpWorkshopTest\Exception * @author Aydin Hassan */ -class CodeExecutionExceptionTest extends PHPUnit_Framework_TestCase +class CodeExecutionExceptionTest extends TestCase { - public function testException() + public function testException() : void { $e = new CodeExecutionException('nope'); $this->assertEquals('nope', $e->getMessage()); } - public function testFromProcessUsesErrorOutputIfNotEmpty() + public function testFromProcessUsesErrorOutputIfNotEmpty() : void { $process = $this->createMock(Process::class); $process - ->expects($this->exactly(2)) + ->expects($this->once()) ->method('getErrorOutput') - ->will($this->returnValue('Error Output')); + ->willReturn('Error Output'); $e = CodeExecutionException::fromProcess($process); $this->assertEquals('PHP Code failed to execute. Error: "Error Output"', $e->getMessage()); } - public function testFromProcessUsesStdOutputIfErrorOutputEmpty() + public function testFromProcessUsesStdOutputIfErrorOutputEmpty() : void { $process = $this->createMock(Process::class); $process - ->expects($this->exactly(1)) + ->expects($this->once()) ->method('getErrorOutput') - ->will($this->returnValue('')); + ->willReturn(''); $process - ->expects($this->exactly(1)) + ->expects($this->once()) ->method('getOutput') - ->will($this->returnValue('Std Output')); + ->willReturn('Std Output'); $e = CodeExecutionException::fromProcess($process); $this->assertEquals('PHP Code failed to execute. Error: "Std Output"', $e->getMessage()); diff --git a/test/Exception/ExerciseNotConfiguredExceptionTest.php b/test/Exception/ExerciseNotConfiguredExceptionTest.php index aee81370..72ac028b 100644 --- a/test/Exception/ExerciseNotConfiguredExceptionTest.php +++ b/test/Exception/ExerciseNotConfiguredExceptionTest.php @@ -4,28 +4,28 @@ use PhpSchool\PhpWorkshop\Exception\ExerciseNotConfiguredException; use PhpSchool\PhpWorkshop\Exercise\ExerciseInterface; -use PHPUnit_Framework_TestCase; +use PHPUnit\Framework\TestCase; /** * Class ExerciseNotConfiguredExceptionTest * @package PhpSchool\PhpWorkshopTest\Exception * @author Aydin Hassan */ -class ExerciseNotConfiguredExceptionTest extends PHPUnit_Framework_TestCase +class ExerciseNotConfiguredExceptionTest extends TestCase { - public function testException() + public function testException() : void { $e = new ExerciseNotConfiguredException('nope'); $this->assertEquals('nope', $e->getMessage()); } - public function testMissingImplementsConstructor() + public function testMissingImplementsConstructor() : void { $exercise = $this->createMock(ExerciseInterface::class); $exercise ->expects($this->once()) ->method('getName') - ->will($this->returnValue('Some Exercise')); + ->willReturn('Some Exercise'); $e = ExerciseNotConfiguredException::missingImplements($exercise, 'SomeInterface'); $this->assertSame('Exercise: "Some Exercise" should implement interface: "SomeInterface"', $e->getMessage()); diff --git a/test/Exception/InvalidArgumentExceptionTest.php b/test/Exception/InvalidArgumentExceptionTest.php index ccfc9dc3..df48b411 100644 --- a/test/Exception/InvalidArgumentExceptionTest.php +++ b/test/Exception/InvalidArgumentExceptionTest.php @@ -4,34 +4,34 @@ use Countable; use PhpSchool\PhpWorkshop\Exception\InvalidArgumentException; -use PHPUnit_Framework_TestCase; +use PHPUnit\Framework\TestCase; /** * Class InvalidArgumentExceptionTest * @package PhpSchool\PhpWorkshopTest\Exception * @author Aydin Hassan */ -class InvalidArgumentExceptionTest extends PHPUnit_Framework_TestCase +class InvalidArgumentExceptionTest extends TestCase { - public function testException() + public function testException() : void { $e = new InvalidArgumentException('nope'); $this->assertEquals('nope', $e->getMessage()); } - public function testExceptionFromTypeMisMatchConstructor() + public function testExceptionFromTypeMisMatchConstructor() : void { $e = InvalidArgumentException::typeMisMatch('string', new \stdClass); $this->assertEquals('Expected: "string" Received: "stdClass"', $e->getMessage()); } - public function testExceptionFromNotValidParameterConstructor() + public function testExceptionFromNotValidParameterConstructor() : void { $e = InvalidArgumentException::notValidParameter('number', [1, 2], 3); $this->assertEquals('Parameter: "number" can only be one of: "1", "2" Received: "3"', $e->getMessage()); } - public function testExceptionFromMissingImplements() + public function testExceptionFromMissingImplements() : void { $e = InvalidArgumentException::missingImplements(new \stdClass, Countable::class); self::assertEquals('"stdClass" is required to implement "Countable", but it does not', $e->getMessage()); @@ -39,10 +39,8 @@ public function testExceptionFromMissingImplements() /** * @dataProvider stringifyProvider - * @param mixed $value - * @param string $expected */ - public function testStringify($value, $expected) + public function testStringify($value, string $expected) : void { $rM = new \ReflectionMethod(InvalidArgumentException::class, 'stringify'); $rM->setAccessible(true); @@ -50,17 +48,14 @@ public function testStringify($value, $expected) $this->assertEquals($rM->invoke(null, $value), $expected); } - /** - * @return array - */ - public function stringifyProvider() + public function stringifyProvider() : array { return [ [new \stdClass, 'stdClass'], [[1, 2, 3], '1", "2", "3'], - [1, "1"], - ["1", "1"], - [true, "true"], + [1, '1'], + ['1', '1'], + [true, 'true'], ]; } } diff --git a/test/Exception/MissingArgumentExceptionTest.php b/test/Exception/MissingArgumentExceptionTest.php index 162a0308..42c40574 100644 --- a/test/Exception/MissingArgumentExceptionTest.php +++ b/test/Exception/MissingArgumentExceptionTest.php @@ -2,7 +2,7 @@ namespace PhpSchool\PhpWorkshopTest\Exception; -use PHPUnit_Framework_TestCase; +use PHPUnit\Framework\TestCase; use PhpSchool\PhpWorkshop\Exception\MissingArgumentException; /** @@ -10,9 +10,9 @@ * @package PhpSchool\PhpWorkshopTest\Exception * @author Aydin Hassan */ -class MissingArgumentExceptionTest extends PHPUnit_Framework_TestCase +class MissingArgumentExceptionTest extends TestCase { - public function testException() + public function testException() : void { $e = new MissingArgumentException('some-route', ['arg1', 'arg2']); $this->assertEquals( diff --git a/test/Exception/SolutionExecutionExceptionTest.php b/test/Exception/SolutionExecutionExceptionTest.php index 012dd280..358e403c 100644 --- a/test/Exception/SolutionExecutionExceptionTest.php +++ b/test/Exception/SolutionExecutionExceptionTest.php @@ -2,7 +2,7 @@ namespace PhpSchool\PhpWorkshopTest\Exception; -use PHPUnit_Framework_TestCase; +use PHPUnit\Framework\TestCase; use PhpSchool\PhpWorkshop\Exception\SolutionExecutionException; /** @@ -10,9 +10,9 @@ * @package PhpSchool\PhpWorkshopTest\Exception * @author Aydin Hassan */ -class SolutionExecutionExceptionTest extends PHPUnit_Framework_TestCase +class SolutionExecutionExceptionTest extends TestCase { - public function testException() + public function testException() : void { $e = new SolutionExecutionException('nope'); $this->assertEquals('nope', $e->getMessage()); diff --git a/test/Exercise/AbstractExerciseTest.php b/test/Exercise/AbstractExerciseTest.php index 695106a2..a4cd57ab 100644 --- a/test/Exercise/AbstractExerciseTest.php +++ b/test/Exercise/AbstractExerciseTest.php @@ -6,7 +6,7 @@ use PhpSchool\PhpWorkshop\Solution\SolutionFile; use PhpSchool\PhpWorkshop\Solution\SolutionInterface; use PhpSchool\PhpWorkshopTest\Asset\AbstractExerciseImpl; -use PHPUnit_Framework_TestCase; +use PHPUnit\Framework\TestCase; use ReflectionClass; /** @@ -14,9 +14,9 @@ * @package PhpSchool\PhpWorkshopTest\Exercise * @author Aydin Hassan */ -class AbstractExerciseTest extends PHPUnit_Framework_TestCase +class AbstractExerciseTest extends TestCase { - public function testTearDownReturnsVoid() + public function testTearDownReturnsVoid() : void { $exercise = new AbstractExerciseImpl('name'); $this->assertNull($exercise->tearDown()); @@ -24,9 +24,8 @@ public function testTearDownReturnsVoid() /** * @dataProvider solutionProvider - * @param string $name */ - public function testGetSolution($name) + public function testGetSolution(string $name) : void { $exercise = new AbstractExerciseImpl($name); $path = __DIR__ . '/../../exercises/array-we-go/solution/solution.php'; @@ -44,10 +43,7 @@ public function testGetSolution($name) rmdir(__DIR__ . '/../../exercises'); } - /** - * @return array - */ - public function solutionProvider() + public function solutionProvider() : array { return [ ['Array We Go!'], @@ -58,19 +54,14 @@ public function solutionProvider() /** * @dataProvider problemProvider - * @param string $name - * @param string $path */ - public function testGetProblem($name, $path) + public function testGetProblem(string $name, string $path) : void { $exercise = new AbstractExerciseImpl($name); $this->assertSame($path, $exercise->getProblem()); } - /** - * @return array - */ - public function problemProvider() + public function problemProvider() : array { $reflector = new ReflectionClass(AbstractExerciseImpl::class); $dir = dirname($reflector->getFileName()); @@ -81,7 +72,7 @@ public function problemProvider() ]; } - public function testConfigureDoesNothing() + public function testConfigureDoesNothing() : void { $dispatcher = $this->createMock(ExerciseDispatcher::class); diff --git a/test/Exercise/TemporaryDirectoryTraitTest.php b/test/Exercise/TemporaryDirectoryTraitTest.php index 08bdce1c..df107465 100644 --- a/test/Exercise/TemporaryDirectoryTraitTest.php +++ b/test/Exercise/TemporaryDirectoryTraitTest.php @@ -3,16 +3,16 @@ namespace PhpSchool\PhpWorkshopTest\Exercise; use PhpSchool\PhpWorkshopTest\Asset\TemporaryDirectoryTraitImpl; -use PHPUnit_Framework_TestCase; +use PHPUnit\Framework\TestCase; /** * Class TemporaryDirectoryTraitTest * @package PhpSchool\PhpWorkshopTest\Exercise * @author Aydin Hassan */ -class TemporaryDirectoryTraitTest extends PHPUnit_Framework_TestCase +class TemporaryDirectoryTraitTest extends TestCase { - public function testGetTemporaryPath() + public function testGetTemporaryPath() : void { $impl = new TemporaryDirectoryTraitImpl; $path = $impl->getTemporaryPath(); diff --git a/test/ExerciseDispatcherTest.php b/test/ExerciseDispatcherTest.php index f0d2eea0..dcd9c709 100644 --- a/test/ExerciseDispatcherTest.php +++ b/test/ExerciseDispatcherTest.php @@ -21,7 +21,7 @@ use PhpSchool\PhpWorkshop\Result\Success; use PhpSchool\PhpWorkshop\ResultAggregator; use PhpSchool\PhpWorkshopTest\Asset\CliExerciseImpl; -use PHPUnit_Framework_TestCase; +use PHPUnit\Framework\TestCase; use Prophecy\Argument; use RuntimeException; use Symfony\Component\Filesystem\Filesystem; @@ -31,7 +31,7 @@ * @package PhpSchool\PhpWorkshopTest * @author Aydin Hassan */ -class ExerciseDispatcherTest extends PHPUnit_Framework_TestCase +class ExerciseDispatcherTest extends TestCase { /** * @var Filesystem @@ -43,7 +43,7 @@ class ExerciseDispatcherTest extends PHPUnit_Framework_TestCase */ private $file; - public function setUp() + public function setUp() : void { $this->filesystem = new Filesystem; $this->file = sprintf('%s/%s/submission.php', str_replace('\\', '/', sys_get_temp_dir()), $this->getName()); @@ -51,7 +51,7 @@ public function setUp() touch($this->file); } - public function testGetEventDispatcher() + public function testGetEventDispatcher() : void { $eventDispatcher = new EventDispatcher($results = new ResultAggregator); @@ -65,7 +65,7 @@ public function testGetEventDispatcher() $this->assertSame($eventDispatcher, $exerciseDispatcher->getEventDispatcher()); } - public function testRequireCheckThrowsExceptionIfCheckDoesNotExist() + public function testRequireCheckThrowsExceptionIfCheckDoesNotExist() : void { $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Check: "NotACheck" does not exist'); @@ -79,7 +79,7 @@ public function testRequireCheckThrowsExceptionIfCheckDoesNotExist() $exerciseDispatcher->requireCheck('NotACheck'); } - public function testRequireCheckThrowsExceptionIfPositionNotValid() + public function testRequireCheckThrowsExceptionIfPositionNotValid() : void { $checkProphecy = $this->prophesize(SimpleCheckInterface::class); $checkProphecy->getName()->willReturn('Some Check'); @@ -99,7 +99,7 @@ public function testRequireCheckThrowsExceptionIfPositionNotValid() $exerciseDispatcher->requireCheck(get_class($check)); } - public function testRequireBeforeCheckIsCorrectlyRegistered() + public function testRequireBeforeCheckIsCorrectlyRegistered() : void { $checkProphecy = $this->prophesize(SimpleCheckInterface::class); $checkProphecy->getName()->willReturn('Some Check'); @@ -119,7 +119,7 @@ public function testRequireBeforeCheckIsCorrectlyRegistered() $this->assertEquals([$check], $checksToRunBefore); } - public function testRequireAfterCheckIsCorrectlyRegistered() + public function testRequireAfterCheckIsCorrectlyRegistered() : void { $checkProphecy = $this->prophesize(SimpleCheckInterface::class); $checkProphecy->getName()->willReturn('Some Check'); @@ -139,7 +139,7 @@ public function testRequireAfterCheckIsCorrectlyRegistered() $this->assertEquals([$check], $checksToRunBefore); } - public function testRequireCheckThrowsExceptionIfCheckIsNotSimpleOrListenable() + public function testRequireCheckThrowsExceptionIfCheckIsNotSimpleOrListenable() : void { $checkProphecy = $this->prophesize(CheckInterface::class); $checkProphecy->getName()->willReturn('Some Check'); @@ -158,7 +158,7 @@ public function testRequireCheckThrowsExceptionIfCheckIsNotSimpleOrListenable() $exerciseDispatcher->requireCheck(get_class($check)); } - public function testRequireListenableCheckAttachesToDispatcher() + public function testRequireListenableCheckAttachesToDispatcher() : void { $eventDispatcher = $this->prophesize(EventDispatcher::class)->reveal(); $checkProphecy = $this->prophesize(ListenableCheckInterface::class); @@ -175,7 +175,7 @@ public function testRequireListenableCheckAttachesToDispatcher() $exerciseDispatcher->requireCheck(get_class($check)); } - public function testVerifyThrowsExceptionIfCheckDoesNotSupportExerciseType() + public function testVerifyThrowsExceptionIfCheckDoesNotSupportExerciseType() : void { $exercise = new CliExerciseImpl('Some Exercise'); @@ -205,7 +205,7 @@ public function testVerifyThrowsExceptionIfCheckDoesNotSupportExerciseType() $exerciseDispatcher->verify($exercise, new Input('app')); } - public function testVerifyThrowsExceptionIfExerciseDoesNotImplementCorrectInterface() + public function testVerifyThrowsExceptionIfExerciseDoesNotImplementCorrectInterface() : void { $exercise = new CliExerciseImpl('Some Exercise'); @@ -235,7 +235,7 @@ public function testVerifyThrowsExceptionIfExerciseDoesNotImplementCorrectInterf $exerciseDispatcher->verify($exercise, new Input('app')); } - public function testVerify() + public function testVerify() : void { $input = new Input('app', ['program' => $this->file]); $exercise = new CliExerciseImpl('Some Exercise'); @@ -266,33 +266,64 @@ public function testVerify() $this->assertTrue($result->isSuccessful()); } - public function testVerifyOnlyRunsRequiredChecks() + public function testVerifyOnlyRunsRequiredChecks() : void { $input = new Input('app', ['program' => $this->file]); $exercise = new CliExerciseImpl('Some Exercise'); - $checkProphecy1 = $this->prophesize(SimpleCheckInterface::class); - $checkProphecy1->canRun($exercise->getType())->willReturn(true); - $checkProphecy1->getPosition()->willReturn(SimpleCheckInterface::CHECK_BEFORE); - $checkProphecy1->getExerciseInterface()->willReturn(ExerciseInterface::class); - $checkProphecy1->check($exercise, $input)->willReturn(new Success('Success!')); - - $checkProphecy2 = $this->prophesize(SimpleCheckInterface::class); - $checkProphecy2->check($exercise, $input)->shouldNotBeCalled(); - - $check1 = $checkProphecy1->reveal(); - $check2 = $checkProphecy2->reveal(); - - $runner = $this->prophesize(ExerciseRunnerInterface::class); - $runner->getRequiredChecks()->willReturn([get_class($check1)]); - $runner->verify($input)->willReturn(new Success('Success!')); - $runnerManager = $this->prophesize(RunnerManager::class); - $runnerManager->getRunner($exercise)->willReturn($runner->reveal()); + $check1 = $this + ->getMockBuilder(SimpleCheckInterface::class) + ->setMockClassName('SimpleCheckMock1') + ->getMock(); + + $check1 + ->method('canRun') + ->willReturn(true); + + $check1 + ->method('getPosition') + ->willReturn(SimpleCheckInterface::CHECK_BEFORE); + + $check1 + ->method('getExerciseInterface') + ->willReturn(ExerciseInterface::class); + + $check1 + ->method('check') + ->with($exercise, $input) + ->willReturn(new Success('Success!')); + + $check2 = $this + ->getMockBuilder(SimpleCheckInterface::class) + ->setMockClassName('SimpleCheckMock2') + ->getMock(); + + $check2 + ->expects($this->never()) + ->method('check') + ->with($exercise, $input); + + $runner = $this->createMock(ExerciseRunnerInterface::class); + $runner + ->expects($this->once()) + ->method('getRequiredChecks') + ->willReturn([get_class($check1)]); + + $runner + ->method('verify') + ->with($input) + ->willReturn(new Success('Success!')); + + $runnerManager = $this->createMock(RunnerManager::class); + $runnerManager + ->method('getRunner') + ->with($exercise) + ->willReturn($runner); $exerciseDispatcher = new ExerciseDispatcher( - $runnerManager->reveal(), + $runnerManager, new ResultAggregator, - $this->prophesize(EventDispatcher::class)->reveal(), + new EventDispatcher(new ResultAggregator()), new CheckRepository([$check1, $check2]) ); @@ -301,7 +332,7 @@ public function testVerifyOnlyRunsRequiredChecks() $this->assertTrue($result->isSuccessful()); } - public function testVerifyWithBeforeAndAfterRequiredChecks() + public function testVerifyWithBeforeAndAfterRequiredChecks() : void { $input = new Input('app', ['program' => $this->file]); $exercise = new CliExerciseImpl('Some Exercise'); @@ -341,36 +372,76 @@ public function testVerifyWithBeforeAndAfterRequiredChecks() } - public function testWhenBeforeChecksFailTheyReturnImmediately() + public function testWhenBeforeChecksFailTheyReturnImmediately() : void { $input = new Input('app', ['program' => $this->file]); $exercise = new CliExerciseImpl('Some Exercise'); - $checkProphecy1 = $this->prophesize(SimpleCheckInterface::class); - $checkProphecy1->canRun($exercise->getType())->willReturn(true); - $checkProphecy1->getPosition()->willReturn(SimpleCheckInterface::CHECK_BEFORE); - $checkProphecy1->getExerciseInterface()->willReturn(ExerciseInterface::class); - $checkProphecy1->check($exercise, $input)->willReturn(new Failure('Failure', 'nope')); - - $checkProphecy2 = $this->prophesize(SimpleCheckInterface::class); - $checkProphecy2->canRun($exercise->getType())->willReturn(true); - $checkProphecy2->getPosition()->willReturn(SimpleCheckInterface::CHECK_BEFORE); - $checkProphecy2->getExerciseInterface()->willReturn(ExerciseInterface::class); - $checkProphecy2->check($exercise, $input)->shouldNotBeCalled(); - - $check1 = $checkProphecy1->reveal(); - $check2 = $checkProphecy2->reveal(); - - $runner = $this->prophesize(ExerciseRunnerInterface::class); - $runner->getRequiredChecks()->willReturn([get_class($check1), get_class($check2)]); - $runner->verify($input)->shouldNotBeCalled(); - $runnerManager = $this->prophesize(RunnerManager::class); - $runnerManager->getRunner($exercise)->willReturn($runner->reveal()); + $check1 = $this + ->getMockBuilder(SimpleCheckInterface::class) + ->setMockClassName('SimpleCheckMock1') + ->getMock(); + + $check1 + ->method('canRun') + ->willReturn(true); + + $check1 + ->method('getPosition') + ->willReturn(SimpleCheckInterface::CHECK_BEFORE); + + $check1 + ->method('getExerciseInterface') + ->willReturn(ExerciseInterface::class); + + $check1 + ->method('check') + ->with($exercise, $input) + ->willReturn(new Failure('Failure', 'nope')); + + $check2 = $this + ->getMockBuilder(SimpleCheckInterface::class) + ->setMockClassName('SimpleCheckMock2') + ->getMock(); + + $check2 + ->method('canRun') + ->willReturn(true); + + $check2 + ->method('getPosition') + ->willReturn(SimpleCheckInterface::CHECK_BEFORE); + + $check2 + ->method('getExerciseInterface') + ->willReturn(ExerciseInterface::class); + + $check2 + ->expects($this->never()) + ->method('check') + ->with($exercise, $input); + + $runner = $this->createMock(ExerciseRunnerInterface::class); + $runner + ->expects($this->once()) + ->method('getRequiredChecks') + ->willReturn([get_class($check1), get_class($check2)]); + + $runner + ->expects($this->never()) + ->method('verify') + ->with($input); + + $runnerManager = $this->createMock(RunnerManager::class); + $runnerManager + ->method('getRunner') + ->with($exercise) + ->willReturn($runner); $exerciseDispatcher = new ExerciseDispatcher( - $runnerManager->reveal(), + $runnerManager, new ResultAggregator, - $this->prophesize(EventDispatcher::class)->reveal(), + new EventDispatcher(new ResultAggregator()), new CheckRepository([$check1, $check2]) ); @@ -379,7 +450,7 @@ public function testWhenBeforeChecksFailTheyReturnImmediately() $this->assertFalse($result->isSuccessful()); } - public function testAllEventsAreDispatched() + public function testAllEventsAreDispatched() : void { $input = new Input('app', ['program' => $this->file]); $exercise = new CliExerciseImpl('Some Exercise'); @@ -429,7 +500,7 @@ public function testAllEventsAreDispatched() $exerciseDispatcher->verify($exercise, $input); } - public function testVerifyPostExecuteIsStillDispatchedEvenIfRunnerThrowsException() + public function testVerifyPostExecuteIsStillDispatchedEvenIfRunnerThrowsException() : void { $input = new Input('app', ['program' => $this->file]); $exercise = new CliExerciseImpl('Some Exercise'); @@ -469,7 +540,7 @@ public function testVerifyPostExecuteIsStillDispatchedEvenIfRunnerThrowsExceptio $exerciseDispatcher->verify($exercise, $input); } - public function testRun() + public function testRun() : void { $input = new Input('app', ['program' => $this->file]); $output = $this->prophesize(OutputInterface::class)->reveal(); diff --git a/test/ExerciseRendererTest.php b/test/ExerciseRendererTest.php index 1f7396bf..93933978 100644 --- a/test/ExerciseRendererTest.php +++ b/test/ExerciseRendererTest.php @@ -8,8 +8,8 @@ use League\CommonMark\Environment; use PhpSchool\CliMenu\CliMenu; use PhpSchool\CliMenu\MenuItem\MenuItemInterface; -use PhpSchool\CliMenu\Terminal\TerminalInterface; -use PHPUnit_Framework_TestCase; +use PhpSchool\Terminal\Terminal; +use PHPUnit\Framework\TestCase; use PhpSchool\PhpWorkshop\Exercise\ExerciseInterface; use PhpSchool\PhpWorkshop\ExerciseRenderer; use PhpSchool\PhpWorkshop\ExerciseRepository; @@ -23,21 +23,20 @@ * @package PhpSchool\PhpWorkshopTest * @author Aydin Hassan */ -class ExerciseRendererTest extends PHPUnit_Framework_TestCase +class ExerciseRendererTest extends TestCase { - public function testExerciseRendererSetsCurrentExerciseAndRendersExercise() + public function testExerciseRendererSetsCurrentExerciseAndRendersExercise() : void { $menu = $this->createMock(CliMenu::class); $item = $this->createMock(MenuItemInterface::class); $item - ->expects($this->any()) ->method('getText') - ->will($this->returnValue('Exercise 2')); + ->willReturn('Exercise 2'); $menu ->expects($this->once()) ->method('getSelectedItem') - ->will($this->returnValue($item)); + ->willReturn($item); $menu ->expects($this->once()) @@ -54,12 +53,12 @@ public function testExerciseRendererSetsCurrentExerciseAndRendersExercise() ->expects($this->once()) ->method('findByName') ->with('Exercise 2') - ->will($this->returnValue($exercise2)); + ->willReturn($exercise2); $exerciseRepository ->expects($this->once()) ->method('findAll') - ->will($this->returnValue($exercises)); + ->willReturn($exercises); $userState ->expects($this->once()) @@ -74,7 +73,7 @@ public function testExerciseRendererSetsCurrentExerciseAndRendersExercise() $exercise2 ->expects($this->once()) ->method('getProblem') - ->will($this->returnValue($problemFile)); + ->willReturn($problemFile); if (!is_dir(dirname($problemFile))) { mkdir(dirname($problemFile), 0775, true); @@ -96,7 +95,7 @@ public function testExerciseRendererSetsCurrentExerciseAndRendersExercise() $userStateSerializer, $markdownRenderer, $color, - new StdOutput($color, $this->createMock(TerminalInterface::class)) + new StdOutput($color, $this->createMock(Terminal::class)) ); $this->expectOutputString(file_get_contents(__DIR__ . '/res/exercise-help-expected.txt')); diff --git a/test/ExerciseRepositoryTest.php b/test/ExerciseRepositoryTest.php index e1d8073f..f2712358 100644 --- a/test/ExerciseRepositoryTest.php +++ b/test/ExerciseRepositoryTest.php @@ -7,7 +7,7 @@ use PhpSchool\PhpWorkshopTest\Asset\CliExerciseImpl; use PhpSchool\PhpWorkshopTest\Asset\CliExerciseInterface; use PhpSchool\PhpWorkshopTest\Asset\CliExerciseMissingInterface; -use PHPUnit_Framework_TestCase; +use PHPUnit\Framework\TestCase; use PhpSchool\PhpWorkshop\Exercise\ExerciseInterface; use PhpSchool\PhpWorkshop\ExerciseRepository; @@ -16,9 +16,9 @@ * @package PhpSchool\PhpWorkshopTest * @author Aydin Hassan */ -class ExerciseRepositoryTest extends PHPUnit_Framework_TestCase +class ExerciseRepositoryTest extends TestCase { - public function testFindAll() + public function testFindAll(): void { $exercises = [ new CliExerciseImpl('Exercise 1'), @@ -30,7 +30,7 @@ public function testFindAll() $this->assertSame($exercises, $repo->findAll()); } - public function testFindByName() + public function testFindByName() : void { $exercises = [ new CliExerciseImpl('Exercise 1'), @@ -41,7 +41,7 @@ public function testFindByName() $this->assertSame($exercises[1], $repo->findByName('Exercise 2')); } - public function testFindByNameThrowsExceptionIfNotFound() + public function testFindByNameThrowsExceptionIfNotFound() : void { $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Exercise with name: "exercise1" does not exist'); @@ -50,7 +50,7 @@ public function testFindByNameThrowsExceptionIfNotFound() $repo->findByName('exercise1'); } - public function testGetAllNames() + public function testGetAllNames() : void { $exercises = [ new CliExerciseImpl('Exercise 1'), @@ -61,7 +61,7 @@ public function testGetAllNames() $this->assertSame(['Exercise 1', 'Exercise 2'], $repo->getAllNames()); } - public function testCount() + public function testCount() : void { $exercises = [ new CliExerciseImpl('Exercise 1'), @@ -72,7 +72,7 @@ public function testCount() $this->assertCount(2, $repo); } - public function testIterator() + public function testIterator() : void { $exercises = [ new CliExerciseImpl('Exercise 1'), @@ -83,7 +83,7 @@ public function testIterator() $this->assertEquals($exercises, iterator_to_array($repo)); } - public function testExceptionIsThrownWhenTryingToAddExerciseWhichDoesNotImplementCorrectInterface() + public function testExceptionIsThrownWhenTryingToAddExerciseWhichDoesNotImplementCorrectInterface() : void { $this->expectException(InvalidArgumentException::class); $message = '"PhpSchool\PhpWorkshopTest\Asset\CliExerciseMissingInterface" is required to implement '; diff --git a/test/ExerciseRunner/CgiRunnerTest.php b/test/ExerciseRunner/CgiRunnerTest.php index 89db6e5d..770c5b09 100644 --- a/test/ExerciseRunner/CgiRunnerTest.php +++ b/test/ExerciseRunner/CgiRunnerTest.php @@ -3,7 +3,7 @@ namespace PhpSchool\PhpWorkshopTest\ExerciseRunner; use Colors\Color; -use PhpSchool\CliMenu\Terminal\TerminalInterface; +use PhpSchool\Terminal\Terminal; use PhpSchool\PhpWorkshop\Check\CodeParseCheck; use PhpSchool\PhpWorkshop\Check\FileExistsCheck; use PhpSchool\PhpWorkshop\Check\PhpLintCheck; @@ -20,7 +20,7 @@ use PhpSchool\PhpWorkshop\Solution\SingleFileSolution; use PhpSchool\PhpWorkshop\Utils\RequestRenderer; use PhpSchool\PhpWorkshopTest\Asset\CgiExerciseInterface; -use PHPUnit_Framework_TestCase; +use PHPUnit\Framework\TestCase; use Zend\Diactoros\Request; use Zend\Diactoros\Uri; @@ -28,7 +28,7 @@ * @package PhpSchool\PhpWorkshop\ExerciseRunner * @author Aydin Hassan */ -class CgiRunnerTest extends PHPUnit_Framework_TestCase +class CgiRunnerTest extends TestCase { /** @var CgiRunner */ private $runner; @@ -38,20 +38,19 @@ class CgiRunnerTest extends PHPUnit_Framework_TestCase */ private $exercise; - public function setUp() + public function setUp() : void { $this->exercise = $this->createMock(CgiExerciseInterface::class); $this->runner = new CgiRunner($this->exercise, new EventDispatcher(new ResultAggregator), new RequestRenderer); $this->exercise - ->expects($this->any()) ->method('getType') - ->will($this->returnValue(ExerciseType::CGI())); + ->willReturn(ExerciseType::CGI()); $this->assertEquals('CGI Program Runner', $this->runner->getName()); } - public function testRequiredChecks() + public function testRequiredChecks() : void { $requiredChecks = [ FileExistsCheck::class, @@ -62,13 +61,13 @@ public function testRequiredChecks() $this->assertEquals($requiredChecks, $this->runner->getRequiredChecks()); } - public function testVerifyThrowsExceptionIfSolutionFailsExecution() + public function testVerifyThrowsExceptionIfSolutionFailsExecution() : void { $solution = SingleFileSolution::fromFile(__DIR__ . '/../res/cgi/solution-error.php'); $this->exercise ->expects($this->once()) ->method('getSolution') - ->will($this->returnValue($solution)); + ->willReturn($solution); $request = (new Request) ->withMethod('GET') @@ -77,21 +76,21 @@ public function testVerifyThrowsExceptionIfSolutionFailsExecution() $this->exercise ->expects($this->once()) ->method('getRequests') - ->will($this->returnValue([$request])); + ->willReturn([$request]); - $regex = "/^PHP Code failed to execute\\. Error: \"PHP Parse error: syntax error, unexpected end of file in/"; + $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->runner->verify(new Input('app', ['program' => ''])); } - public function testVerifyReturnsSuccessIfGetSolutionOutputMatchesUserOutput() + public function testVerifyReturnsSuccessIfGetSolutionOutputMatchesUserOutput() : void { $solution = SingleFileSolution::fromFile(__DIR__ . '/../res/cgi/get-solution.php'); $this->exercise ->expects($this->once()) ->method('getSolution') - ->will($this->returnValue($solution)); + ->willReturn($solution); $request = (new Request) ->withMethod('GET') @@ -100,7 +99,7 @@ public function testVerifyReturnsSuccessIfGetSolutionOutputMatchesUserOutput() $this->exercise ->expects($this->once()) ->method('getRequests') - ->will($this->returnValue([$request])); + ->willReturn([$request]); $this->assertInstanceOf( CgiResult::class, @@ -108,13 +107,13 @@ public function testVerifyReturnsSuccessIfGetSolutionOutputMatchesUserOutput() ); } - public function testVerifyReturnsSuccessIfPostSolutionOutputMatchesUserOutput() + public function testVerifyReturnsSuccessIfPostSolutionOutputMatchesUserOutput() : void { $solution = SingleFileSolution::fromFile(__DIR__ . '/../res/cgi/post-solution.php'); $this->exercise ->expects($this->once()) ->method('getSolution') - ->will($this->returnValue($solution)); + ->willReturn($solution); $request = (new Request) ->withMethod('POST') @@ -126,7 +125,7 @@ public function testVerifyReturnsSuccessIfPostSolutionOutputMatchesUserOutput() $this->exercise ->expects($this->once()) ->method('getRequests') - ->will($this->returnValue([$request])); + ->willReturn([$request]); $this->assertInstanceOf( CgiResult::class, @@ -138,13 +137,13 @@ public function testVerifyReturnsSuccessIfPostSolutionOutputMatchesUserOutput() $this->assertTrue($res->isSuccessful()); } - public function testVerifyReturnsSuccessIfPostSolutionOutputMatchesUserOutputWithMultipleParams() + public function testVerifyReturnsSuccessIfPostSolutionOutputMatchesUserOutputWithMultipleParams() : void { $solution = SingleFileSolution::fromFile(__DIR__ . '/../res/cgi/post-multiple-solution.php'); $this->exercise ->expects($this->once()) ->method('getSolution') - ->will($this->returnValue($solution)); + ->willReturn($solution); $request = (new Request) ->withMethod('POST') @@ -156,7 +155,7 @@ public function testVerifyReturnsSuccessIfPostSolutionOutputMatchesUserOutputWit $this->exercise ->expects($this->once()) ->method('getRequests') - ->will($this->returnValue([$request])); + ->willReturn([$request]); $result = $this->runner->verify( new Input('app', ['program' => realpath(__DIR__ . '/../res/cgi/post-multiple-solution.php')]) @@ -165,13 +164,13 @@ public function testVerifyReturnsSuccessIfPostSolutionOutputMatchesUserOutputWit $this->assertInstanceOf(CgiResult::class, $result); } - public function testVerifyReturnsFailureIfUserSolutionFailsToExecute() + public function testVerifyReturnsFailureIfUserSolutionFailsToExecute() : void { $solution = SingleFileSolution::fromFile(__DIR__ . '/../res/cgi/get-solution.php'); $this->exercise ->expects($this->once()) ->method('getSolution') - ->will($this->returnValue($solution)); + ->willReturn($solution); $request = (new Request) ->withMethod('GET') @@ -180,7 +179,7 @@ public function testVerifyReturnsFailureIfUserSolutionFailsToExecute() $this->exercise ->expects($this->once()) ->method('getRequests') - ->will($this->returnValue([$request])); + ->willReturn([$request]); $failure = $this->runner->verify( new Input('app', ['program' => realpath(__DIR__ . '/../res/cgi/user-error.php')]) @@ -192,18 +191,18 @@ public function testVerifyReturnsFailureIfUserSolutionFailsToExecute() $result = iterator_to_array($failure)[0]; $this->assertInstanceOf(Failure::class, $result); - $failureMsg = "/^PHP Code failed to execute. Error: \"PHP Parse error: syntax error, unexpected end of file"; - $failureMsg .= " in/"; + $failureMsg = '/^PHP Code failed to execute. Error: "PHP Parse error: syntax error, unexpected end of file'; + $failureMsg .= ' in/'; $this->assertRegExp($failureMsg, $result->getReason()); } - public function testVerifyReturnsFailureIfSolutionOutputDoesNotMatchUserOutput() + public function testVerifyReturnsFailureIfSolutionOutputDoesNotMatchUserOutput() : void { $solution = SingleFileSolution::fromFile(__DIR__ . '/../res/cgi/get-solution.php'); $this->exercise ->expects($this->once()) ->method('getSolution') - ->will($this->returnValue($solution)); + ->willReturn($solution); $request = (new Request) ->withMethod('GET') @@ -212,7 +211,7 @@ public function testVerifyReturnsFailureIfSolutionOutputDoesNotMatchUserOutput() $this->exercise ->expects($this->once()) ->method('getRequests') - ->will($this->returnValue([$request])); + ->willReturn([$request]); $failure = $this->runner->verify( new Input('app', ['program' => realpath(__DIR__ . '/../res/cgi/get-user-wrong.php')]) @@ -229,13 +228,13 @@ public function testVerifyReturnsFailureIfSolutionOutputDoesNotMatchUserOutput() $this->assertEquals(['Content-type' => 'text/html; charset=UTF-8'], $result->getActualHeaders()); } - public function testVerifyReturnsFailureIfSolutionOutputHeadersDoesNotMatchUserOutputHeaders() + public function testVerifyReturnsFailureIfSolutionOutputHeadersDoesNotMatchUserOutputHeaders() : void { $solution = SingleFileSolution::fromFile(__DIR__ . '/../res/cgi/get-solution-header.php'); $this->exercise ->expects($this->once()) ->method('getSolution') - ->will($this->returnValue($solution)); + ->willReturn($solution); $request = (new Request) ->withMethod('GET') @@ -244,7 +243,7 @@ public function testVerifyReturnsFailureIfSolutionOutputHeadersDoesNotMatchUserO $this->exercise ->expects($this->once()) ->method('getRequests') - ->will($this->returnValue([$request])); + ->willReturn([$request]); $failure = $this->runner->verify( new Input('app', ['program' => realpath(__DIR__ . '/../res/cgi/get-user-header-wrong.php')]) @@ -273,11 +272,11 @@ public function testVerifyReturnsFailureIfSolutionOutputHeadersDoesNotMatchUserO ); } - public function testRunPassesOutputAndReturnsSuccessIfAllRequestsAreSuccessful() + public function testRunPassesOutputAndReturnsSuccessIfAllRequestsAreSuccessful() : void { $color = new Color; $color->setForceStyle(true); - $output = new StdOutput($color, $this->createMock(TerminalInterface::class)); + $output = new StdOutput($color, $this->createMock(Terminal::class)); $request1 = (new Request) ->withMethod('GET') ->withUri(new Uri('http://some.site?number=5')); @@ -289,7 +288,7 @@ public function testRunPassesOutputAndReturnsSuccessIfAllRequestsAreSuccessful() $this->exercise ->expects($this->once()) ->method('getRequests') - ->will($this->returnValue([$request1, $request2])); + ->willReturn([$request1, $request2]); $exp = "\n\e[1m\e[4mRequest"; $exp .= "\e[0m\e[0m\n\n"; @@ -322,11 +321,11 @@ public function testRunPassesOutputAndReturnsSuccessIfAllRequestsAreSuccessful() $this->assertTrue($success); } - public function testRunPassesOutputAndReturnsFailureIfARequestFails() + public function testRunPassesOutputAndReturnsFailureIfARequestFails() : void { $color = new Color; $color->setForceStyle(true); - $output = new StdOutput($color, $this->createMock(TerminalInterface::class)); + $output = new StdOutput($color, $this->createMock(Terminal::class)); $request1 = (new Request) ->withMethod('GET') ->withUri(new Uri('http://some.site?number=5')); @@ -334,7 +333,7 @@ public function testRunPassesOutputAndReturnsFailureIfARequestFails() $this->exercise ->expects($this->once()) ->method('getRequests') - ->will($this->returnValue([$request1])); + ->willReturn([$request1]); $exp = "\n\e[1m\e[4mRequest"; $exp .= "\e[0m\e[0m\n\n"; diff --git a/test/ExerciseRunner/CliRunnerTest.php b/test/ExerciseRunner/CliRunnerTest.php index d384a3bb..cc9eb356 100644 --- a/test/ExerciseRunner/CliRunnerTest.php +++ b/test/ExerciseRunner/CliRunnerTest.php @@ -3,7 +3,7 @@ namespace PhpSchool\PhpWorkshopTest\ExerciseRunner; use Colors\Color; -use PhpSchool\CliMenu\Terminal\TerminalInterface; +use PhpSchool\Terminal\Terminal; use PhpSchool\PhpWorkshop\Check\CodeParseCheck; use PhpSchool\PhpWorkshop\Check\FileExistsCheck; use PhpSchool\PhpWorkshop\Check\PhpLintCheck; @@ -20,13 +20,13 @@ use PhpSchool\PhpWorkshop\ResultAggregator; use PhpSchool\PhpWorkshop\Solution\SingleFileSolution; use PhpSchool\PhpWorkshopTest\Asset\CliExerciseInterface; -use PHPUnit_Framework_TestCase; +use PHPUnit\Framework\TestCase; /** * @package PhpSchool\PhpWorkshop\ExerciseRunner * @author Aydin Hassan */ -class CliRunnerTest extends PHPUnit_Framework_TestCase +class CliRunnerTest extends TestCase { /** @var CliRunner */ private $runner; @@ -41,21 +41,20 @@ class CliRunnerTest extends PHPUnit_Framework_TestCase */ private $eventDispatcher; - public function setUp() + public function setUp() : void { $this->exercise = $this->createMock(CliExerciseInterface::class); $this->eventDispatcher = new EventDispatcher(new ResultAggregator); $this->runner = new CliRunner($this->exercise, $this->eventDispatcher); $this->exercise - ->expects($this->any()) ->method('getType') - ->will($this->returnValue(ExerciseType::CLI())); + ->willReturn(ExerciseType::CLI()); $this->assertEquals('CLI Program Runner', $this->runner->getName()); } - public function testRequiredChecks() + public function testRequiredChecks() : void { $requiredChecks = [ FileExistsCheck::class, @@ -66,18 +65,18 @@ public function testRequiredChecks() $this->assertEquals($requiredChecks, $this->runner->getRequiredChecks()); } - public function testVerifyThrowsExceptionIfSolutionFailsExecution() + public function testVerifyThrowsExceptionIfSolutionFailsExecution() : void { $solution = SingleFileSolution::fromFile(realpath(__DIR__ . '/../res/cli/solution-error.php')); $this->exercise ->expects($this->once()) ->method('getSolution') - ->will($this->returnValue($solution)); + ->willReturn($solution); $this->exercise ->expects($this->once()) ->method('getArgs') - ->will($this->returnValue([[]])); + ->willReturn([[]]); $regex = "/^PHP Code failed to execute\\. Error: \"PHP Parse error: syntax error, unexpected end of file"; $regex .= ", expecting ',' or ';'/"; @@ -86,18 +85,18 @@ public function testVerifyThrowsExceptionIfSolutionFailsExecution() $this->runner->verify(new Input('app', ['program' => ''])); } - public function testVerifyReturnsSuccessIfSolutionOutputMatchesUserOutput() + public function testVerifyReturnsSuccessIfSolutionOutputMatchesUserOutput() : void { $solution = SingleFileSolution::fromFile(realpath(__DIR__ . '/../res/cli/solution.php')); $this->exercise ->expects($this->once()) ->method('getSolution') - ->will($this->returnValue($solution)); + ->willReturn($solution); $this->exercise ->expects($this->once()) ->method('getArgs') - ->will($this->returnValue([[1, 2, 3]])); + ->willReturn([[1, 2, 3]]); $this->assertInstanceOf( CliResult::class, @@ -107,18 +106,18 @@ public function testVerifyReturnsSuccessIfSolutionOutputMatchesUserOutput() $this->assertTrue($res->isSuccessful()); } - public function testSuccessWithSingleSetOfArgsForBC() + public function testSuccessWithSingleSetOfArgsForBC() : void { $solution = SingleFileSolution::fromFile(realpath(__DIR__ . '/../res/cli/solution.php')); $this->exercise ->expects($this->once()) ->method('getSolution') - ->will($this->returnValue($solution)); + ->willReturn($solution); $this->exercise ->expects($this->once()) ->method('getArgs') - ->will($this->returnValue([1, 2, 3])); + ->willReturn([1, 2, 3]); $this->assertInstanceOf( CliResult::class, @@ -128,25 +127,25 @@ public function testSuccessWithSingleSetOfArgsForBC() $this->assertTrue($res->isSuccessful()); } - public function testVerifyReturnsFailureIfUserSolutionFailsToExecute() + public function testVerifyReturnsFailureIfUserSolutionFailsToExecute() : void { $solution = SingleFileSolution::fromFile(realpath(__DIR__ . '/../res/cli/solution.php')); $this->exercise ->expects($this->once()) ->method('getSolution') - ->will($this->returnValue($solution)); + ->willReturn($solution); $this->exercise ->expects($this->once()) ->method('getArgs') - ->will($this->returnValue([[1, 2, 3]])); + ->willReturn([[1, 2, 3]]); $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 = '/^PHP Code failed to execute. Error: "PHP Parse error: syntax error, '; $failureMsg .= "unexpected end of file, expecting ',' or ';'/"; - $this->assertInstanceOf(CLiResult::class, $failure); + $this->assertInstanceOf(CliResult::class, $failure); $this->assertCount(1, $failure); $result = iterator_to_array($failure)[0]; @@ -154,22 +153,22 @@ public function testVerifyReturnsFailureIfUserSolutionFailsToExecute() $this->assertRegExp($failureMsg, $result->getReason()); } - public function testVerifyReturnsFailureIfSolutionOutputDoesNotMatchUserOutput() + public function testVerifyReturnsFailureIfSolutionOutputDoesNotMatchUserOutput() : void { $solution = SingleFileSolution::fromFile(realpath(__DIR__ . '/../res/cli/solution.php')); $this->exercise ->expects($this->once()) ->method('getSolution') - ->will($this->returnValue($solution)); + ->willReturn($solution); $this->exercise ->expects($this->once()) ->method('getArgs') - ->will($this->returnValue([[1, 2, 3]])); + ->willReturn([[1, 2, 3]]); $failure = $this->runner->verify(new Input('app', ['program' => __DIR__ . '/../res/cli/user-wrong.php'])); - $this->assertInstanceOf(CLiResult::class, $failure); + $this->assertInstanceOf(CliResult::class, $failure); $this->assertCount(1, $failure); $result = iterator_to_array($failure)[0]; @@ -179,16 +178,16 @@ public function testVerifyReturnsFailureIfSolutionOutputDoesNotMatchUserOutput() $this->assertEquals('10', $result->getActualOutput()); } - public function testRunPassesOutputAndReturnsSuccessIfScriptIsSuccessful() + public function testRunPassesOutputAndReturnsSuccessIfScriptIsSuccessful() : void { $color = new Color; $color->setForceStyle(true); - $output = new StdOutput($color, $this->createMock(TerminalInterface::class)); + $output = new StdOutput($color, $this->createMock(Terminal::class)); $this->exercise ->expects($this->once()) ->method('getArgs') - ->will($this->returnValue([[1, 2, 3], [4, 5, 6]])); + ->willReturn([[1, 2, 3], [4, 5, 6]]); $exp = "\n\e[1m\e[4mArguments\e[0m\e[0m\n"; $exp .= "1, 2, 3\n"; @@ -207,22 +206,22 @@ public function testRunPassesOutputAndReturnsSuccessIfScriptIsSuccessful() $this->assertTrue($success); } - public function testRunPassesOutputAndReturnsFailureIfScriptFails() + public function testRunPassesOutputAndReturnsFailureIfScriptFails() : void { - $output = new StdOutput(new Color, $this->createMock(TerminalInterface::class)); + $output = new StdOutput(new Color, $this->createMock(Terminal::class)); $this->exercise ->expects($this->once()) ->method('getArgs') - ->will($this->returnValue([[1, 2, 3]])); + ->willReturn([[1, 2, 3]]); - $this->expectOutputRegex('/PHP Parse error: syntax error, unexpected end of file, expecting \',\' or \';\' /'); + $this->expectOutputRegex('/Parse error: 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); } - public function testsArgsAppendedByEventsArePassedToResults() + public function testsArgsAppendedByEventsArePassedToResults() : void { $this->eventDispatcher->listen( ['cli.verify.student-execute.pre', 'cli.verify.reference-execute.pre'], @@ -235,12 +234,12 @@ function (CliExecuteEvent $e) { $this->exercise ->expects($this->once()) ->method('getSolution') - ->will($this->returnValue($solution)); + ->willReturn($solution); $this->exercise ->expects($this->once()) ->method('getArgs') - ->will($this->returnValue([1, 2, 3])); + ->willReturn([1, 2, 3]); $this->assertInstanceOf( CliResult::class, diff --git a/test/ExerciseRunner/CustomVerifyingRunnerTest.php b/test/ExerciseRunner/CustomVerifyingRunnerTest.php index 411297c0..ce47077b 100644 --- a/test/ExerciseRunner/CustomVerifyingRunnerTest.php +++ b/test/ExerciseRunner/CustomVerifyingRunnerTest.php @@ -1,18 +1,19 @@ */ -class ExtRunnerTest extends PHPUnit_Framework_TestCase +class CustomVerifyingRunnerTest extends TestCase { /** * @var CustomVerifyingRunner @@ -24,7 +25,7 @@ class ExtRunnerTest extends PHPUnit_Framework_TestCase */ private $exercise; - public function setUp() + public function setUp() : void { $this->exercise = new CustomVerifyingExerciseImpl; $this->runner = new CustomVerifyingRunner($this->exercise); @@ -32,16 +33,16 @@ public function setUp() $this->assertEquals('Custom Verifying Runner', $this->runner->getName()); } - public function testRequiredChecks() + public function testRequiredChecks() : void { $this->assertEquals([], $this->runner->getRequiredChecks()); } - public function testRunOutputsErrorMessage() + public function testRunOutputsErrorMessage() : void { $color = new Color; $color->setForceStyle(true); - $output = new StdOutput($color, $this->createMock(TerminalInterface::class)); + $output = new StdOutput($color, $this->createMock(Terminal::class)); $exp = 'Nothing to run here. This exercise does not require a code solution, '; $exp .= "so there is nothing to execute.\n"; @@ -51,7 +52,7 @@ public function testRunOutputsErrorMessage() $this->runner->run(new Input('app'), $output); } - public function testVerifyProxiesToExercise() + public function testVerifyProxiesToExercise() : void { self::assertEquals($this->exercise->verify(), $this->runner->verify(new Input('app'))); } diff --git a/test/ExerciseRunner/Factory/CgiRunnerFactoryTest.php b/test/ExerciseRunner/Factory/CgiRunnerFactoryTest.php index dc6d0211..bb0811ee 100644 --- a/test/ExerciseRunner/Factory/CgiRunnerFactoryTest.php +++ b/test/ExerciseRunner/Factory/CgiRunnerFactoryTest.php @@ -10,12 +10,12 @@ use PhpSchool\PhpWorkshop\ExerciseRunner\Factory\CgiRunnerFactory; use PhpSchool\PhpWorkshop\Utils\RequestRenderer; use PhpSchool\PhpWorkshopTest\Asset\CgiExerciseImpl; -use PHPUnit_Framework_TestCase; +use PHPUnit\Framework\TestCase; /** * @author Aydin Hassan */ -class CgiRunnerFactoryTest extends PHPUnit_Framework_TestCase +class CgiRunnerFactoryTest extends TestCase { /** * @var EventDispatcher @@ -33,7 +33,7 @@ public function setUp() $this->factory = new CgiRunnerFactory($this->eventDispatcher, new RequestRenderer); } - public function testSupports() + public function testSupports() : void { $exercise1 = $this->prophesize(ExerciseInterface::class); $exercise2 = $this->prophesize(ExerciseInterface::class); @@ -45,7 +45,7 @@ public function testSupports() $this->assertFalse($this->factory->supports($exercise2->reveal())); } - public function testConfigureInputAddsProgramArgument() + public function testConfigureInputAddsProgramArgument() : void { $command = new CommandDefinition('my-command', [], 'var_dump'); @@ -56,7 +56,7 @@ public function testConfigureInputAddsProgramArgument() $this->assertTrue($command->getRequiredArgs()[0]->isRequired()); } - public function testCreateReturnsRunner() + public function testCreateReturnsRunner() : void { $exercise = new CgiExerciseImpl; $this->assertInstanceOf(CgiRunner::class, $this->factory->create($exercise)); diff --git a/test/ExerciseRunner/Factory/CliRunnerFactoryTest.php b/test/ExerciseRunner/Factory/CliRunnerFactoryTest.php index bff2134c..178d49d8 100644 --- a/test/ExerciseRunner/Factory/CliRunnerFactoryTest.php +++ b/test/ExerciseRunner/Factory/CliRunnerFactoryTest.php @@ -9,12 +9,12 @@ use PhpSchool\PhpWorkshop\ExerciseRunner\CliRunner; use PhpSchool\PhpWorkshop\ExerciseRunner\Factory\CliRunnerFactory; use PhpSchool\PhpWorkshopTest\Asset\CliExerciseImpl; -use PHPUnit_Framework_TestCase; +use PHPUnit\Framework\TestCase; /** * @author Aydin Hassan */ -class CliRunnerFactoryTest extends PHPUnit_Framework_TestCase +class CliRunnerFactoryTest extends TestCase { /** * @var EventDispatcher @@ -32,7 +32,7 @@ public function setUp() $this->factory = new CliRunnerFactory($this->eventDispatcher); } - public function testSupports() + public function testSupports() : void { $exercise1 = $this->prophesize(ExerciseInterface::class); $exercise2 = $this->prophesize(ExerciseInterface::class); @@ -44,7 +44,7 @@ public function testSupports() $this->assertFalse($this->factory->supports($exercise2->reveal())); } - public function testConfigureInputAddsProgramArgument() + public function testConfigureInputAddsProgramArgument() : void { $command = new CommandDefinition('my-command', [], 'var_dump'); @@ -55,7 +55,7 @@ public function testConfigureInputAddsProgramArgument() $this->assertTrue($command->getRequiredArgs()[0]->isRequired()); } - public function testCreateReturnsRunner() + public function testCreateReturnsRunner() : void { $exercise = new CliExerciseImpl; $this->assertInstanceOf(CliRunner::class, $this->factory->create($exercise)); diff --git a/test/ExerciseRunner/Factory/CustomVerifyingRunnerFactoryTest.php b/test/ExerciseRunner/Factory/CustomVerifyingRunnerFactoryTest.php index 62cdcee4..5b91c3ea 100644 --- a/test/ExerciseRunner/Factory/CustomVerifyingRunnerFactoryTest.php +++ b/test/ExerciseRunner/Factory/CustomVerifyingRunnerFactoryTest.php @@ -8,12 +8,12 @@ use PhpSchool\PhpWorkshop\ExerciseRunner\CustomVerifyingRunner; use PhpSchool\PhpWorkshop\ExerciseRunner\Factory\CustomVerifyingRunnerFactory; use PhpSchool\PhpWorkshopTest\Asset\CustomVerifyingExerciseImpl; -use PHPUnit_Framework_TestCase; +use PHPUnit\Framework\TestCase; /** * @author Aydin Hassan */ -class CustomRunnerFactoryTest extends PHPUnit_Framework_TestCase +class CustomVerifyingRunnerFactoryTest extends TestCase { /** * @var CustomVerifyingRunnerFactory @@ -25,7 +25,7 @@ public function setUp() $this->factory = new CustomVerifyingRunnerFactory; } - public function testSupports() + public function testSupports() : void { $exercise1 = $this->prophesize(ExerciseInterface::class); $exercise2 = $this->prophesize(ExerciseInterface::class); @@ -40,7 +40,7 @@ public function testSupports() $this->assertTrue($this->factory->supports($exercise3->reveal())); } - public function testConfigureInputAddsNoArgument() + public function testConfigureInputAddsNoArgument() : void { $command = new CommandDefinition('my-command', [], 'var_dump'); @@ -48,7 +48,7 @@ public function testConfigureInputAddsNoArgument() $this->assertCount(0, $command->getRequiredArgs()); } - public function testCreateReturnsRunner() + public function testCreateReturnsRunner() : void { $exercise = new CustomVerifyingExerciseImpl; $this->assertInstanceOf(CustomVerifyingRunner::class, $this->factory->create($exercise)); diff --git a/test/ExerciseRunner/RunnerManagerTest.php b/test/ExerciseRunner/RunnerManagerTest.php index cccb1034..a8fa3589 100644 --- a/test/ExerciseRunner/RunnerManagerTest.php +++ b/test/ExerciseRunner/RunnerManagerTest.php @@ -7,14 +7,14 @@ use PhpSchool\PhpWorkshop\ExerciseRunner\Factory\ExerciseRunnerFactoryInterface; use PhpSchool\PhpWorkshop\ExerciseRunner\RunnerManager; use PhpSchool\PhpWorkshopTest\Asset\CliExerciseImpl; -use PHPUnit_Framework_TestCase; +use PHPUnit\Framework\TestCase; /** * @author Aydin Hassan */ -class RunnerManagerTest extends PHPUnit_Framework_TestCase +class RunnerManagerTest extends TestCase { - public function testConfigureInputCallsCorrectFactory() + public function testConfigureInputCallsCorrectFactory() : void { $exercise = new CliExerciseImpl; $manager = new RunnerManager; @@ -33,7 +33,7 @@ public function testConfigureInputCallsCorrectFactory() $manager->configureInput($exercise, $command); } - public function testGetRunnerCallsCorrectFactory() + public function testGetRunnerCallsCorrectFactory() : void { $exercise = new CliExerciseImpl; $manager = new RunnerManager; @@ -51,7 +51,7 @@ public function testGetRunnerCallsCorrectFactory() $manager->getRunner($exercise); } - public function testExceptionIsThrownWhenConfiguringInputIfNoFactorySupportsExercise() + public function testExceptionIsThrownWhenConfiguringInputIfNoFactorySupportsExercise() : void { $exercise = new CliExerciseImpl; $manager = new RunnerManager; @@ -62,7 +62,7 @@ public function testExceptionIsThrownWhenConfiguringInputIfNoFactorySupportsExer $manager->configureInput($exercise, new CommandDefinition('my-command', [], 'var_dump')); } - public function testExceptionIsThrownWhenGettingRunnerIfNoFactorySupportsExercise() + public function testExceptionIsThrownWhenGettingRunnerIfNoFactorySupportsExercise() : void { $exercise = new CliExerciseImpl; $manager = new RunnerManager; diff --git a/test/Factory/CliRendererFactoryTest.php b/test/Factory/CliRendererFactoryTest.php index 51143fa0..f9d7f608 100644 --- a/test/Factory/CliRendererFactoryTest.php +++ b/test/Factory/CliRendererFactoryTest.php @@ -6,34 +6,34 @@ use Colors\Color; use PhpSchool\PhpWorkshop\Factory\MarkdownCliRendererFactory; use Interop\Container\ContainerInterface; -use PhpSchool\CliMenu\Terminal\TerminalInterface; -use PHPUnit_Framework_TestCase; +use PhpSchool\Terminal\Terminal; +use PHPUnit\Framework\TestCase; /** * Class CliRendererFactoryTest * @author Aydin Hassan */ -class CliRendererFactoryTest extends PHPUnit_Framework_TestCase +class CliRendererFactoryTest extends TestCase { - public function testFactoryReturnsInstance() + public function testFactoryReturnsInstance() : void { - $terminal = $this->createMock(TerminalInterface::class); + $terminal = $this->createMock(Terminal::class); $terminal ->expects($this->once()) ->method('getWidth') - ->will($this->returnValue(10)); + ->willReturn(10); $services = [ - TerminalInterface::class => $terminal, + Terminal::class => $terminal, Color::class => new Color, ]; $c = $this->createMock(ContainerInterface::class); - $c->expects($this->any()) + $c ->method('get') - ->will($this->returnCallback(function ($service) use ($services) { + ->willReturnCallback(function ($service) use ($services) { return $services[$service]; - })); + }); $factory = new MarkdownCliRendererFactory(); $this->assertInstanceOf(CliRenderer::class, $factory->__invoke($c)); diff --git a/test/Factory/EventDispatcherFactoryTest.php b/test/Factory/EventDispatcherFactoryTest.php index acc83dbc..beed25a2 100644 --- a/test/Factory/EventDispatcherFactoryTest.php +++ b/test/Factory/EventDispatcherFactoryTest.php @@ -10,17 +10,17 @@ use PhpSchool\PhpWorkshop\Exception\InvalidArgumentException; use PhpSchool\PhpWorkshop\Factory\EventDispatcherFactory; use PhpSchool\PhpWorkshop\ResultAggregator; -use PHPUnit_Framework_TestCase; +use PHPUnit\Framework\TestCase; /** * Class EventDispatcherFactoryTest * @package PhpSchool\PhpWorkshopTest\Event * @author Aydin Hassan */ -class EventDispatcherFactoryTest extends PHPUnit_Framework_TestCase +class EventDispatcherFactoryTest extends TestCase { - public function testCreateWithNoConfig() + public function testCreateWithNoConfig() : void { $c = $this->prophesize(ContainerInterface::class); $c->get(ResultAggregator::class)->willReturn(new ResultAggregator); @@ -31,7 +31,7 @@ public function testCreateWithNoConfig() $this->assertSame([], $this->readAttribute($dispatcher, 'listeners')); } - public function testExceptionIsThrownIfEventListenerGroupsNotArray() + public function testExceptionIsThrownIfEventListenerGroupsNotArray() : void { $c = $this->prophesize(ContainerInterface::class); $c->get(ResultAggregator::class)->willReturn(new ResultAggregator); @@ -44,7 +44,7 @@ public function testExceptionIsThrownIfEventListenerGroupsNotArray() (new EventDispatcherFactory)->__invoke($c->reveal()); } - public function testExceptionIsThrownIfEventsNotArray() + public function testExceptionIsThrownIfEventsNotArray() : void { $c = $this->prophesize(ContainerInterface::class); $c->get(ResultAggregator::class)->willReturn(new ResultAggregator); @@ -57,7 +57,7 @@ public function testExceptionIsThrownIfEventsNotArray() (new EventDispatcherFactory)->__invoke($c->reveal()); } - public function testExceptionIsThrownIfEventListenersNotArray() + public function testExceptionIsThrownIfEventListenersNotArray() : void { $eventConfig = [ 'my-group' => [ @@ -76,7 +76,7 @@ public function testExceptionIsThrownIfEventListenersNotArray() (new EventDispatcherFactory)->__invoke($c->reveal()); } - public function testExceptionIsThrownIfListenerNotCallable() + public function testExceptionIsThrownIfListenerNotCallable() : void { $eventConfig = [ 'my-group' => [ @@ -95,7 +95,7 @@ public function testExceptionIsThrownIfListenerNotCallable() (new EventDispatcherFactory)->__invoke($c->reveal()); } - public function testExceptionIsThrownIfEventsListenerContainerEntryNotExist() + public function testExceptionIsThrownIfEventsListenerContainerEntryNotExist() : void { $eventConfig = [ 'my-group' => [ @@ -116,7 +116,7 @@ public function testExceptionIsThrownIfEventsListenerContainerEntryNotExist() (new EventDispatcherFactory)->__invoke($c->reveal()); } - public function testConfigEventListenersWithAnonymousFunction() + public function testConfigEventListenersWithAnonymousFunction() : void { $callback = function () { }; @@ -144,7 +144,7 @@ public function testConfigEventListenersWithAnonymousFunction() ); } - public function testListenerFromContainerIsNotFetchedDuringAttaching() + public function testListenerFromContainerIsNotFetchedDuringAttaching() : void { $eventConfig = [ 'my-group' => [ @@ -167,7 +167,7 @@ public function testListenerFromContainerIsNotFetchedDuringAttaching() $c->get('containerEntry')->shouldNotHaveBeenCalled(); } - public function testListenerFromContainerIsFetchedWhenEventDispatched() + public function testListenerFromContainerIsFetchedWhenEventDispatched() : void { $eventConfig = [ 'my-group' => [ @@ -191,7 +191,7 @@ public function testListenerFromContainerIsFetchedWhenEventDispatched() $dispatcher->dispatch(new Event('someEvent')); } - public function testExceptionIsThrownIfMethodDoesNotExistOnContainerEntry() + public function testExceptionIsThrownIfMethodDoesNotExistOnContainerEntry() : void { $eventConfig = [ 'my-group' => [ @@ -216,7 +216,7 @@ public function testExceptionIsThrownIfMethodDoesNotExistOnContainerEntry() $dispatcher->dispatch(new Event('someEvent')); } - public function testDefaultListenersAreRegisteredFromConfig() + public function testDefaultListenersAreRegisteredFromConfig() : void { $containerBuilder = new ContainerBuilder; $containerBuilder->addDefinitions(__DIR__ . '/../../app/config.php'); diff --git a/test/Factory/MenuFactoryTest.php b/test/Factory/MenuFactoryTest.php index 37d53f17..a1359f18 100644 --- a/test/Factory/MenuFactoryTest.php +++ b/test/Factory/MenuFactoryTest.php @@ -15,33 +15,33 @@ use PhpSchool\PhpWorkshop\UserState; use PhpSchool\PhpWorkshop\UserStateSerializer; use PhpSchool\PhpWorkshop\WorkshopType; -use PHPUnit_Framework_TestCase; +use PHPUnit\Framework\TestCase; /** * Class MenuFactoryTest * @package PhpSchool\PhpWorkshopTest\Factory * @author Aydin Hassan */ -class MenuFactoryTest extends PHPUnit_Framework_TestCase +class MenuFactoryTest extends TestCase { - public function testFactoryReturnsInstance() + public function testFactoryReturnsInstance() : void { $container = $this->createMock(ContainerInterface::class); $userStateSerializer = $this->createMock(UserStateSerializer::class); $userStateSerializer ->expects($this->once()) ->method('deSerialize') - ->will($this->returnValue(new UserState)); + ->willReturn(new UserState); $exerciseRepository = $this->createMock(ExerciseRepository::class); $exercise = $this->createMock(ExerciseInterface::class); $exercise->expects($this->exactly(2)) ->method('getName') - ->will($this->returnValue('Exercise')); + ->willReturn('Exercise'); $exerciseRepository ->expects($this->once()) ->method('findAll') - ->will($this->returnValue([$exercise])); + ->willReturn([$exercise]); $services = [ UserStateSerializer::class => $userStateSerializer, @@ -59,11 +59,10 @@ public function testFactoryReturnsInstance() ]; $container - ->expects($this->any()) ->method('get') - ->will($this->returnCallback(function ($name) use ($services) { + ->willReturnCallback(function ($name) use ($services) { return $services[$name]; - })); + }); $factory = new MenuFactory; diff --git a/test/Factory/ResultRendererFactoryTest.php b/test/Factory/ResultRendererFactoryTest.php index 35a489f6..5b8ab2e5 100644 --- a/test/Factory/ResultRendererFactoryTest.php +++ b/test/Factory/ResultRendererFactoryTest.php @@ -6,7 +6,7 @@ use PhpSchool\PhpWorkshop\Factory\ResultRendererFactory; use PhpSchool\PhpWorkshop\ResultRenderer\ResultRendererInterface; use PhpSchool\PhpWorkshop\Result\ResultInterface; -use PHPUnit_Framework_TestCase; +use PHPUnit\Framework\TestCase; use RuntimeException; /** @@ -14,14 +14,14 @@ * @package PhpSchool\PhpWorkshopTest\Factory * @author Aydin Hassan */ -class ResultsRendererFactoryTest extends PHPUnit_Framework_TestCase +class ResultRendererFactoryTest extends TestCase { /** * @expectedException InvalidArgumentException */ - public function testRegisterRendererRequiresResultInterface() + public function testRegisterRendererRequiresResultInterface() : void { - $resultClass = get_class($this->createMock(PHPUnit_Framework_TestCase::class)); + $resultClass = get_class($this->createMock(TestCase::class)); $rendererClass = get_class($this->createMock(ResultRendererInterface::class)); $factory = new ResultRendererFactory(); @@ -31,10 +31,10 @@ public function testRegisterRendererRequiresResultInterface() /** * @expectedException InvalidArgumentException */ - public function testRegisterRendererRequiresResultRendererInterface() + public function testRegisterRendererRequiresResultRendererInterface() : void { $resultClass = get_class($this->createMock(ResultInterface::class)); - $rendererClass = get_class($this->createMock(PHPUnit_Framework_TestCase::class)); + $rendererClass = get_class($this->createMock(TestCase::class)); $factory = new ResultRendererFactory(); $factory->registerRenderer($resultClass, $rendererClass); @@ -43,7 +43,7 @@ public function testRegisterRendererRequiresResultRendererInterface() /** * @expectedException InvalidArgumentException */ - public function testRegisterRendererRequiresResultClassToBeString() + public function testRegisterRendererRequiresResultClassToBeString() : void { $resultClass = $this->createMock(ResultInterface::class); $rendererClass = get_class($this->createMock(ResultRendererInterface::class)); @@ -55,7 +55,7 @@ public function testRegisterRendererRequiresResultClassToBeString() /** * @expectedException InvalidArgumentException */ - public function testRegisterRendererRequiresRendererClassToBeString() + public function testRegisterRendererRequiresRendererClassToBeString() : void { $resultClass = get_class($this->createMock(ResultInterface::class)); $rendererClass = $this->createMock(ResultRendererInterface::class); @@ -67,7 +67,7 @@ public function testRegisterRendererRequiresRendererClassToBeString() /** * @expectedException RuntimeException */ - public function testCreateRequiresMappingToClassName() + public function testCreateRequiresMappingToClassName() : void { $resultClass = $this->createMock(ResultInterface::class); $factory = new ResultRendererFactory(); @@ -75,7 +75,7 @@ public function testCreateRequiresMappingToClassName() $factory->create($resultClass); } - public function testCreateReturnsMappedRendererInterface() + public function testCreateReturnsMappedRendererInterface() : void { $resultClass = $this->createMock(ResultInterface::class); $resultClassName = get_class($resultClass); @@ -88,7 +88,7 @@ public function testCreateReturnsMappedRendererInterface() $this->assertInstanceOf($rendererClassName, $returnedRenderer); } - public function testExceptionIsThrownIfFactoryReturnsInCorrectRenderer() + public function testExceptionIsThrownIfFactoryReturnsInCorrectRenderer() : void { $resultClass = $this->createMock(ResultInterface::class); $resultClassName = get_class($resultClass); diff --git a/test/FunctionsTest.php b/test/FunctionsTest.php index 69dd5695..b62f9202 100644 --- a/test/FunctionsTest.php +++ b/test/FunctionsTest.php @@ -2,29 +2,22 @@ namespace PhpSchool\PhpWorkshopTest; -use PHPUnit_Framework_TestCase; +use PHPUnit\Framework\TestCase; /** * @author Aydin Hassan */ -class FunctionsTest extends PHPUnit_Framework_TestCase +class FunctionsTest extends TestCase { /** * @dataProvider mbStrPadProvider - * - * @param string $string - * @param string $pad - * @param string $expected */ - public function testMbStrPad($string, $pad, $expected) + public function testMbStrPad(string $string, string $pad, string $expected) : void { self::assertSame(mb_str_pad($string, $pad), $expected); } - /** - * @return array - */ - public function mbStrPadProvider() + public function mbStrPadProvider() : array { return [ ['hello', 10, 'hello '], @@ -34,19 +27,13 @@ public function mbStrPadProvider() /** * @dataProvider camelCaseToKebabCaseProvider - * - * @param string $string - * @param string $expected */ - public function testCamelCaseToKebabCase($string, $expected) + public function testCamelCaseToKebabCase(string $string, string $expected) : void { self::assertSame(camel_case_to_kebab_case($string), $expected); } - /** - * @return array - */ - public function camelCaseToKebabCaseProvider() + public function camelCaseToKebabCaseProvider() : array { return [ ['camelCase', 'camel-case'], diff --git a/test/Input/InputTest.php b/test/Input/InputTest.php index 0d415c50..ba5e0c30 100644 --- a/test/Input/InputTest.php +++ b/test/Input/InputTest.php @@ -1,29 +1,29 @@ */ -class InputTest extends PHPUnit_Framework_TestCase +class InputTest extends TestCase { - public function testGetAppName() + public function testGetAppName(): void { $input = new Input('app'); $this->assertEquals('app', $input->getAppName()); } - public function testGetArgument() + public function testGetArgument(): void { $input = new Input('app', ['arg1' => 'some-value']); $this->assertEquals('some-value', $input->getArgument('arg1')); } - public function testGetArgumentThrowsExceptionIfArgumentNotExist() + public function testGetArgumentThrowsExceptionIfArgumentNotExist(): void { $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Argument with name: "arg1" does not exist'); @@ -32,14 +32,14 @@ public function testGetArgumentThrowsExceptionIfArgumentNotExist() $input->getArgument('arg1'); } - public function testHasArgument() + public function testHasArgument(): void { $input = new Input('app', ['arg1' => 'some-value']); $this->assertTrue($input->hasArgument('arg1')); $this->assertFalse($input->hasArgument('arg2')); } - public function testSetArgument() + public function testSetArgument(): void { $input = new Input('app'); $this->assertFalse($input->hasArgument('arg1')); diff --git a/test/Listener/CheckExerciseAssignedListenerTest.php b/test/Listener/CheckExerciseAssignedListenerTest.php index 2aa65ed9..2540e75c 100644 --- a/test/Listener/CheckExerciseAssignedListenerTest.php +++ b/test/Listener/CheckExerciseAssignedListenerTest.php @@ -5,19 +5,19 @@ use PhpSchool\PhpWorkshop\CommandDefinition; use PhpSchool\PhpWorkshop\Event\Event; use PhpSchool\PhpWorkshop\Listener\CheckExerciseAssignedListener; -use PHPUnit_Framework_TestCase; +use PHPUnit\Framework\MockObject\MockObject; +use PHPUnit\Framework\TestCase; use PhpSchool\PhpWorkshop\UserState; /** * @author Aydin Hassan */ -class CheckExerciseAssignedListenerTest extends PHPUnit_Framework_TestCase +class CheckExerciseAssignedListenerTest extends TestCase { /** * @dataProvider commandsThatRequireAssignedExercise - * @param CommandDefinition $command */ - public function testExceptionIsThrownIfNoExerciseAssigned(CommandDefinition $command) + public function testExceptionIsThrownIfNoExerciseAssigned(CommandDefinition $command) : void { $state = new UserState; @@ -30,19 +30,17 @@ public function testExceptionIsThrownIfNoExerciseAssigned(CommandDefinition $com /** * @dataProvider commandsThatRequireAssignedExercise - * @param CommandDefinition $command */ - public function testExceptionIsNotThrownIfExerciseAssigned(CommandDefinition $command) + public function testExceptionIsNotThrownIfExerciseAssigned(CommandDefinition $command) : void { $state = new UserState(['exercise1'], 'exercise1'); $listener = new CheckExerciseAssignedListener($state); $listener->__invoke(new Event('some-event', ['command' => $command])); + + $this->assertTrue($state->isAssignedExercise()); } - /** - * @return array - */ - public function commandsThatRequireAssignedExercise() + public function commandsThatRequireAssignedExercise() : array { return [ [$this->command('verify')], @@ -53,19 +51,17 @@ public function commandsThatRequireAssignedExercise() /** * @dataProvider commandsThatDoNotRequireAssignedExercise - * @param CommandDefinition $command */ - public function testExceptionIsNotThrownIfCommandDoesNotRequireAssignedExercise(CommandDefinition $command) + public function testExceptionIsNotThrownIfCommandDoesNotRequireAssignedExercise(CommandDefinition $command) : void { $state = new UserState(['exercise1'], 'exercise1'); $listener = new CheckExerciseAssignedListener($state); $listener->__invoke(new Event('some-event', ['command' => $command])); + + $this->assertTrue($state->isAssignedExercise()); } - /** - * @return array - */ - public function commandsThatDoNotRequireAssignedExercise() + public function commandsThatDoNotRequireAssignedExercise() : array { return [ [$this->command('help')], @@ -75,14 +71,12 @@ public function commandsThatDoNotRequireAssignedExercise() } /** - * @param $commandName - * @return \PHPUnit_Framework_MockObject_MockObject|CommandDefinition + * @return MockObject|CommandDefinition */ - private function command($commandName) + private function command(string $commandName) : MockObject { $command = $this->createMock(CommandDefinition::class); $command - ->expects($this->any()) ->method('getName') ->willReturn($commandName); diff --git a/test/Listener/CodePatchListenerTest.php b/test/Listener/CodePatchListenerTest.php index 3355f47e..e049b301 100644 --- a/test/Listener/CodePatchListenerTest.php +++ b/test/Listener/CodePatchListenerTest.php @@ -7,7 +7,7 @@ use PhpSchool\PhpWorkshop\Exercise\ExerciseInterface; use PhpSchool\PhpWorkshop\Input\Input; use PhpSchool\PhpWorkshop\Listener\CodePatchListener; -use PHPUnit_Framework_TestCase; +use PHPUnit\Framework\TestCase; use RuntimeException; use Symfony\Component\Filesystem\Filesystem; @@ -16,7 +16,7 @@ * @package PhpSchool\PhpWorkshopTest\Listener * @author Aydin Hassan */ -class CodePatchListenerTest extends PHPUnit_Framework_TestCase +class CodePatchListenerTest extends TestCase { /** * @var string @@ -33,7 +33,7 @@ class CodePatchListenerTest extends PHPUnit_Framework_TestCase */ private $codePatcher; - public function setUp() + public function setUp() : void { $this->filesystem = new Filesystem; $this->codePatcher = $this->createMock(CodePatcher::class); @@ -43,7 +43,7 @@ public function setUp() touch($this->file); } - public function testRevertThrowsExceptionIfPatchNotPreviouslyCalled() + public function testRevertThrowsExceptionIfPatchNotPreviouslyCalled() : void { $input = new Input('app', ['program' => $this->file]); $exercise = $this->createMock(ExerciseInterface::class); @@ -56,7 +56,7 @@ public function testRevertThrowsExceptionIfPatchNotPreviouslyCalled() $listener->revert($event); } - public function testPatchUpdatesCode() + public function testPatchUpdatesCode() : void { file_put_contents($this->file, 'ORIGINAL CONTENT'); @@ -67,7 +67,7 @@ public function testPatchUpdatesCode() ->expects($this->once()) ->method('patch') ->with($exercise, 'ORIGINAL CONTENT') - ->will($this->returnValue('MODIFIED CONTENT')); + ->willReturn('MODIFIED CONTENT'); $listener = new CodePatchListener($this->codePatcher); $event = new ExerciseRunnerEvent('event', $exercise, $input); @@ -76,7 +76,7 @@ public function testPatchUpdatesCode() $this->assertStringEqualsFile($this->file, 'MODIFIED CONTENT'); } - public function testRevertAfterPatch() + public function testRevertAfterPatch() : void { file_put_contents($this->file, 'ORIGINAL CONTENT'); @@ -87,7 +87,7 @@ public function testRevertAfterPatch() ->expects($this->once()) ->method('patch') ->with($exercise, 'ORIGINAL CONTENT') - ->will($this->returnValue('MODIFIED CONTENT')); + ->willReturn('MODIFIED CONTENT'); $listener = new CodePatchListener($this->codePatcher); $event = new ExerciseRunnerEvent('event', $exercise, $input); @@ -97,7 +97,7 @@ public function testRevertAfterPatch() $this->assertStringEqualsFile($this->file, 'ORIGINAL CONTENT'); } - public function tearDown() + public function tearDown() : void { $this->filesystem->remove(dirname($this->file)); } diff --git a/test/Listener/ConfigureCommandListenerTest.php b/test/Listener/ConfigureCommandListenerTest.php index 418af96d..e262bfb6 100644 --- a/test/Listener/ConfigureCommandListenerTest.php +++ b/test/Listener/ConfigureCommandListenerTest.php @@ -9,18 +9,17 @@ use PhpSchool\PhpWorkshop\Listener\ConfigureCommandListener; use PhpSchool\PhpWorkshop\UserState; use PhpSchool\PhpWorkshopTest\Asset\CliExerciseImpl; -use PHPUnit_Framework_TestCase; +use PHPUnit\Framework\TestCase; /** * @author Aydin Hassan */ -class ConfigureCommandListenerTest extends PHPUnit_Framework_TestCase +class ConfigureCommandListenerTest extends TestCase { /** * @dataProvider configurableCommands - * @param string $commandName */ - public function testInputIsConfiguredForCorrectCommands($commandName) + public function testInputIsConfiguredForCorrectCommands(string $commandName) : void { $command = new CommandDefinition($commandName, [], function () { }); @@ -36,10 +35,7 @@ public function testInputIsConfiguredForCorrectCommands($commandName) (new ConfigureCommandListener($state, $repo, $runnerManager->reveal()))->__invoke($event); } - /** - * @return array - */ - public function configurableCommands() + public function configurableCommands() : array { return [ ['verify'], @@ -49,9 +45,8 @@ public function configurableCommands() /** * @dataProvider nonConfigurableCommands - * @param string $commandName */ - public function testInputIsNotConfiguredForCorrectCommands($commandName) + public function testInputIsNotConfiguredForCorrectCommands(string $commandName) : void { $command = new CommandDefinition($commandName, [], function () { }); @@ -68,10 +63,7 @@ public function testInputIsNotConfiguredForCorrectCommands($commandName) $runnerManager->configureInput($exercise, $command)->shouldNotHaveBeenCalled(); } - /** - * @return array - */ - public function nonConfigurableCommands() + public function nonConfigurableCommands() : array { return [ ['print'], diff --git a/test/Listener/PrepareSolutionListenerTest.php b/test/Listener/PrepareSolutionListenerTest.php index 6e14e65b..4e954b80 100644 --- a/test/Listener/PrepareSolutionListenerTest.php +++ b/test/Listener/PrepareSolutionListenerTest.php @@ -8,7 +8,7 @@ use PhpSchool\PhpWorkshop\Input\Input; use PhpSchool\PhpWorkshop\Listener\PrepareSolutionListener; use PhpSchool\PhpWorkshop\Solution\SolutionInterface; -use PHPUnit_Framework_TestCase; +use PHPUnit\Framework\TestCase; use ReflectionProperty; use RuntimeException; use Symfony\Component\Filesystem\Filesystem; @@ -18,7 +18,7 @@ * @package PhpSchool\PhpWorkshopTest\Listener * @author Aydin Hassan */ -class PrepareSolutionListenerTest extends PHPUnit_Framework_TestCase +class PrepareSolutionListenerTest extends TestCase { /** * @var string @@ -35,7 +35,7 @@ class PrepareSolutionListenerTest extends PHPUnit_Framework_TestCase */ private $filesystem; - public function setUp() + public function setUp() : void { $this->filesystem = new Filesystem; $this->listener = new PrepareSolutionListener; @@ -45,7 +45,7 @@ public function setUp() touch($this->file); } - public function testIfSolutionRequiresComposerButComposerCannotBeLocatedExceptionIsThrown() + public function testIfSolutionRequiresComposerButComposerCannotBeLocatedExceptionIsThrown() : void { $refProp = new ReflectionProperty(PrepareSolutionListener::class, 'composerLocations'); $refProp->setAccessible(true); @@ -53,14 +53,14 @@ public function testIfSolutionRequiresComposerButComposerCannotBeLocatedExceptio $solution = $this->createMock(SolutionInterface::class); $exercise = $this->createMock([ExerciseInterface::class, CliExercise::class]); - $exercise->expects($this->any()) + $exercise ->method('getSolution') - ->will($this->returnValue($solution)); + ->willReturn($solution); $solution ->expects($this->once()) ->method('hasComposerFile') - ->will($this->returnValue(true)); + ->willReturn(true); $this->expectException(RuntimeException::class); $this->expectExceptionMessage('Composer could not be located on the system'); @@ -68,26 +68,25 @@ public function testIfSolutionRequiresComposerButComposerCannotBeLocatedExceptio $this->listener->__invoke($event); } - public function testIfSolutionRequiresComposerButVendorDirExistsNothingIsDone() + public function testIfSolutionRequiresComposerButVendorDirExistsNothingIsDone() : void { mkdir(sprintf('%s/vendor', dirname($this->file))); $this->assertFileExists(sprintf('%s/vendor', dirname($this->file))); $solution = $this->createMock(SolutionInterface::class); $exercise = $this->createMock([ExerciseInterface::class, CliExercise::class]); - $exercise->expects($this->any()) + $exercise ->method('getSolution') - ->will($this->returnValue($solution)); + ->willReturn($solution); $solution ->expects($this->once()) ->method('hasComposerFile') - ->will($this->returnValue(true)); + ->willReturn(true); $solution - ->expects($this->any()) ->method('getBaseDirectory') - ->will($this->returnValue(dirname($this->file))); + ->willReturn(dirname($this->file)); $event = new ExerciseRunnerEvent('event', $exercise, new Input('app')); $this->listener->__invoke($event); @@ -97,7 +96,7 @@ public function testIfSolutionRequiresComposerButVendorDirExistsNothingIsDone() $this->assertFileNotExists(sprintf('%s/composer.lock', dirname($this->file))); } - public function testIfSolutionRequiresComposerComposerInstallIsExecuted() + public function testIfSolutionRequiresComposerComposerInstallIsExecuted() : void { $this->assertFileNotExists(sprintf('%s/vendor', dirname($this->file))); file_put_contents(sprintf('%s/composer.json', dirname($this->file)), json_encode([ @@ -108,19 +107,18 @@ public function testIfSolutionRequiresComposerComposerInstallIsExecuted() $solution = $this->createMock(SolutionInterface::class); $exercise = $this->createMock([ExerciseInterface::class, CliExercise::class]); - $exercise->expects($this->any()) + $exercise ->method('getSolution') - ->will($this->returnValue($solution)); + ->willReturn($solution); $solution ->expects($this->once()) ->method('hasComposerFile') - ->will($this->returnValue(true)); + ->willReturn(true); $solution - ->expects($this->any()) ->method('getBaseDirectory') - ->will($this->returnValue(dirname($this->file))); + ->willReturn(dirname($this->file)); $event = new ExerciseRunnerEvent('event', $exercise, new Input('app')); $this->listener->__invoke($event); @@ -128,7 +126,7 @@ public function testIfSolutionRequiresComposerComposerInstallIsExecuted() $this->assertFileExists(sprintf('%s/vendor', dirname($this->file))); } - public function tearDown() + public function tearDown() : void { $this->filesystem->remove(dirname($this->file)); } diff --git a/test/Listener/RealPathListenerTest.php b/test/Listener/RealPathListenerTest.php index 239aeb17..54740ecc 100644 --- a/test/Listener/RealPathListenerTest.php +++ b/test/Listener/RealPathListenerTest.php @@ -7,14 +7,14 @@ use PhpSchool\PhpWorkshop\Input\Input; use PhpSchool\PhpWorkshop\Listener\RealPathListener; use PhpSchool\PhpWorkshopTest\Asset\CliExerciseImpl; -use PHPUnit_Framework_TestCase; +use PHPUnit\Framework\TestCase; /** * @author Aydin Hassan */ -class RealPathListenerTest extends PHPUnit_Framework_TestCase +class RealPathListenerTest extends TestCase { - public function testInputArgumentIsReplacesWithAbsolutePathIfFileExists() + public function testInputArgumentIsReplacesWithAbsolutePathIfFileExists() : void { $current = getcwd(); @@ -35,7 +35,7 @@ public function testInputArgumentIsReplacesWithAbsolutePathIfFileExists() chdir($current); } - public function testInputArgumentIsLeftUnchangedIfFileDoesNotExist() + public function testInputArgumentIsLeftUnchangedIfFileDoesNotExist() : void { $exercise = new CliExerciseImpl; $input = new Input('app', ['program' => 'test-file.php']); @@ -45,7 +45,7 @@ public function testInputArgumentIsLeftUnchangedIfFileDoesNotExist() $this->assertEquals('test-file.php', $input->getArgument('program')); } - public function testInputIsUnchangedIfNoProgramArgument() + public function testInputIsUnchangedIfNoProgramArgument() : void { $exercise = new CliExerciseImpl; $input = new Input('app', ['some-arg' => 'some-value']); diff --git a/test/Listener/SelfCheckListenerTest.php b/test/Listener/SelfCheckListenerTest.php index 57f13ef0..128cc11d 100644 --- a/test/Listener/SelfCheckListenerTest.php +++ b/test/Listener/SelfCheckListenerTest.php @@ -9,16 +9,16 @@ use PhpSchool\PhpWorkshop\Result\Success; use PhpSchool\PhpWorkshop\ResultAggregator; use PhpSchool\PhpWorkshopTest\Asset\SelfCheckExerciseInterface; -use PHPUnit_Framework_TestCase; +use PHPUnit\Framework\TestCase; /** * Class SelfCheckListenerTest * @package PhpSchool\PhpWorkshopTest\Listener * @author Aydin Hassan */ -class SelfCheckListenerTest extends PHPUnit_Framework_TestCase +class SelfCheckListenerTest extends TestCase { - public function testSelfCheck() + public function testSelfCheck() : void { $exercise = $this->createMock(SelfCheckExerciseInterface::class); $input = new Input('app', ['program' => 'some-file.php']); @@ -29,7 +29,7 @@ public function testSelfCheck() ->expects($this->once()) ->method('check') ->with($input) - ->will($this->returnValue($success)); + ->willReturn($success); $results = new ResultAggregator; $listener = new SelfCheckListener($results); @@ -39,7 +39,7 @@ public function testSelfCheck() $this->assertCount(1, $results); } - public function testExerciseWithOutSelfCheck() + public function testExerciseWithOutSelfCheck() : void { $exercise = $this->createMock(ExerciseInterface::class); $input = new Input('app', ['program' => 'some-file.php']); diff --git a/test/MarkdownRendererTest.php b/test/MarkdownRendererTest.php index 5e2b416a..414f94b6 100644 --- a/test/MarkdownRendererTest.php +++ b/test/MarkdownRendererTest.php @@ -6,7 +6,7 @@ use AydinHassan\CliMdRenderer\CliRendererFactory; use League\CommonMark\DocParser; use League\CommonMark\Environment; -use PHPUnit_Framework_TestCase; +use PHPUnit\Framework\TestCase; use PhpSchool\PhpWorkshop\MarkdownRenderer; /** @@ -14,9 +14,9 @@ * @package PhpSchool\PhpWorkshopTest * @author Aydin Hassan */ -class MarkdownRendererTest extends PHPUnit_Framework_TestCase +class MarkdownRendererTest extends TestCase { - public function testRender() + public function testRender() : void { $docParser = new DocParser(Environment::createCommonMarkEnvironment()); $cliRenderer = (new CliRendererFactory())->__invoke(); diff --git a/test/MenuItem/ResetProgressTest.php b/test/MenuItem/ResetProgressTest.php index 654bcd16..7dc7e405 100644 --- a/test/MenuItem/ResetProgressTest.php +++ b/test/MenuItem/ResetProgressTest.php @@ -6,21 +6,21 @@ use PhpSchool\CliMenu\Dialogue\Confirm; use PhpSchool\CliMenu\MenuItem\MenuItemInterface; use PhpSchool\CliMenu\MenuStyle; -use PhpSchool\CliMenu\Terminal\TerminalInterface; +use PhpSchool\Terminal\Terminal; use PhpSchool\PhpWorkshop\MenuItem\ResetProgress; use PhpSchool\PhpWorkshop\Output\OutputInterface; use PhpSchool\PhpWorkshop\UserState; use PhpSchool\PhpWorkshop\UserStateSerializer; -use PHPUnit_Framework_TestCase; +use PHPUnit\Framework\TestCase; /** * Class ResetProgressTest * @package PhpSchool\PhpWorkshopTest\MenuItem * @author Aydin Hassan */ -class ResetProgressTest extends PHPUnit_Framework_TestCase +class ResetProgressTest extends TestCase { - public function testResetProgressDisablesParentMenuItems() + public function testResetProgressDisablesParentMenuItems() : void { $item1 = $this->createMock(MenuItemInterface::class); $item2 = $this->createMock(MenuItemInterface::class); @@ -33,7 +33,10 @@ public function testResetProgressDisablesParentMenuItems() ->expects($this->once()) ->method('hideItemExtra'); - $terminal = $this->createMock(TerminalInterface::class); + $terminal = $this->createMock(Terminal::class); + $terminal + ->method('getWidth') + ->willReturn(100); $menu = new CliMenu('Menu', [$item1, $item2], $terminal); diff --git a/test/NodeVisitor/FunctionVisitorTest.php b/test/NodeVisitor/FunctionVisitorTest.php index 3cb5c7da..ba64a548 100644 --- a/test/NodeVisitor/FunctionVisitorTest.php +++ b/test/NodeVisitor/FunctionVisitorTest.php @@ -4,7 +4,7 @@ use PhpParser\Node\Expr\FuncCall; use PhpParser\Node\Name; -use PHPUnit_Framework_TestCase; +use PHPUnit\Framework\TestCase; use PhpSchool\PhpWorkshop\NodeVisitor\FunctionVisitor; /** @@ -12,9 +12,9 @@ * @package PhpSchool\PhpWorkshopTest\NodeVisitor * @author Aydin Hassan */ -class FunctionVisitorTest extends PHPUnit_Framework_TestCase +class FunctionVisitorTest extends TestCase { - public function testLeaveNodeWithARequiredFunctionIsRecorded() + public function testLeaveNodeWithARequiredFunctionIsRecorded() : void { $node = new FuncCall(new Name('file_get_contents')); $visitor = new FunctionVisitor(['file_get_contents'], []); @@ -25,7 +25,7 @@ public function testLeaveNodeWithARequiredFunctionIsRecorded() $this->assertSame([], $visitor->getMissingRequirements()); } - public function testLeaveNodeWithARequiredFunctionIsNotRecorded() + public function testLeaveNodeWithARequiredFunctionIsNotRecorded() : void { $node = new FuncCall(new Name('file')); $visitor = new FunctionVisitor(['file_get_contents'], []); @@ -36,7 +36,7 @@ public function testLeaveNodeWithARequiredFunctionIsNotRecorded() $this->assertSame(['file_get_contents'], $visitor->getMissingRequirements()); } - public function testBannedUsagesAreRecorded() + public function testBannedUsagesAreRecorded() : void { $node = new FuncCall(new Name('file_get_contents')); $visitor = new FunctionVisitor([], ['file_get_contents']); @@ -46,7 +46,7 @@ public function testBannedUsagesAreRecorded() $this->assertSame([$node], $visitor->getBannedUsages()); } - public function testBannedUsagesAreNotRecorded() + public function testBannedUsagesAreNotRecorded() : void { $node = new FuncCall(new Name('file')); $visitor = new FunctionVisitor([], ['file_get_contents']); diff --git a/test/Output/StdOutputTest.php b/test/Output/StdOutputTest.php index 42f606df..22105b0e 100644 --- a/test/Output/StdOutputTest.php +++ b/test/Output/StdOutputTest.php @@ -3,8 +3,8 @@ namespace PhpSchool\PhpWorkshopTest\Output; use Colors\Color; -use PhpSchool\CliMenu\Terminal\TerminalInterface; -use PHPUnit_Framework_TestCase; +use PhpSchool\Terminal\Terminal; +use PHPUnit\Framework\TestCase; use PhpSchool\PhpWorkshop\Output\StdOutput; /** @@ -12,7 +12,7 @@ * @package PhpSchool\PhpWorkshopTest * @author Aydin Hassan */ -class StdOutputTest extends PHPUnit_Framework_TestCase +class StdOutputTest extends TestCase { /** * @var Color @@ -28,10 +28,10 @@ public function setUp() { $this->color = new Color(); $this->color->setForceStyle(true); - $this->output = new StdOutput($this->color, $this->createMock(TerminalInterface::class)); + $this->output = new StdOutput($this->color, $this->createMock(Terminal::class)); } - public function testPrintError() + public function testPrintError(): void { $error = "\n"; $error .= "  \n"; @@ -44,7 +44,7 @@ public function testPrintError() $this->output->printError('ERROR'); } - public function testWrite() + public function testWrite(): void { $message = 'There are people who actually like programming. '; $message .= "I don't understand why they like programming."; @@ -53,21 +53,21 @@ public function testWrite() $this->output->write($message); } - public function testWriteLine() + public function testWriteLine(): void { $message = 'Talk is cheap. Show me the code.'; $this->expectOutputString($message . "\n"); $this->output->writeLine($message); } - public function testWriteLines() + public function testWriteLines(): void { $lines = ['Line 1', 'Line 2', 'Line 3']; $this->expectOutputString("Line 1\nLine 2\nLine 3\n"); $this->output->writeLines($lines); } - public function testEmptyLine() + public function testEmptyLine(): void { $this->expectOutputString("\n"); $this->output->emptyLine(); diff --git a/test/PatchTest.php b/test/PatchTest.php index 1a263f44..e929de20 100644 --- a/test/PatchTest.php +++ b/test/PatchTest.php @@ -4,16 +4,16 @@ use PhpSchool\PhpWorkshop\CodeInsertion; use PhpSchool\PhpWorkshop\Patch; -use PHPUnit_Framework_TestCase; +use PHPUnit\Framework\TestCase; /** * Class PatchTest * @package PhpSchool\PhpWorkshopTest * @author Aydin Hassan */ -class PatchTest extends PHPUnit_Framework_TestCase +class PatchTest extends TestCase { - public function testWithInsertion() + public function testWithInsertion() : void { $patch = new Patch; $insertion = new CodeInsertion(CodeInsertion::TYPE_BEFORE, 'MEH'); @@ -24,7 +24,7 @@ public function testWithInsertion() $this->assertEquals([$insertion], $new->getModifiers()); } - public function testWithTransformer() + public function testWithTransformer() : void { $patch = new Patch; $transformer = function (array $statements) { diff --git a/test/Result/Cgi/CgiResultTest.php b/test/Result/Cgi/CgiResultTest.php index 8fe8a462..7885b856 100644 --- a/test/Result/Cgi/CgiResultTest.php +++ b/test/Result/Cgi/CgiResultTest.php @@ -13,14 +13,14 @@ */ class CgiResultTest extends TestCase { - public function testName() + public function testName() : void { $request = new RequestFailure($this->createMock(RequestInterface::class), '', '', [], []); $cgiResult = new CgiResult([$request]); $this->assertSame('CGI Program Runner', $cgiResult->getCheckName()); } - public function testIsSuccessful() + public function testIsSuccessful() : void { $request = new RequestFailure($this->createMock(RequestInterface::class), '', '', [], []); $cgiResult = new CgiResult([$request]); diff --git a/test/Result/Cgi/GenericFailureTest.php b/test/Result/Cgi/GenericFailureTest.php index a28fbfcd..0286da43 100644 --- a/test/Result/Cgi/GenericFailureTest.php +++ b/test/Result/Cgi/GenericFailureTest.php @@ -4,15 +4,15 @@ use PhpSchool\PhpWorkshop\Exception\CodeExecutionException; use PhpSchool\PhpWorkshop\Result\Cgi\GenericFailure; -use PHPUnit_Framework_TestCase; +use PHPUnit\Framework\TestCase; use Psr\Http\Message\RequestInterface; /** * @author Aydin Hassan */ -class GenericFailureTest extends PHPUnit_Framework_TestCase +class GenericFailureTest extends TestCase { - public function testFailure() + public function testFailure(): void { $request = $this->createMock(RequestInterface::class); $failure = new GenericFailure($request, 'Oops'); @@ -22,7 +22,7 @@ public function testFailure() $this->assertEquals('CGI Program Runner', $failure->getCheckName()); } - public function testFailureWithRequestAndReason() + public function testFailureWithRequestAndReason() : void { $request = $this->createMock(RequestInterface::class); $failure = GenericFailure::fromRequestAndReason($request, 'Oops'); @@ -32,7 +32,7 @@ public function testFailureWithRequestAndReason() $this->assertEquals('CGI Program Runner', $failure->getCheckName()); } - public function testFailureFromCodeExecutionException() + public function testFailureFromCodeExecutionException() : void { $e = new CodeExecutionException('Something went wrong yo'); $request = $this->createMock(RequestInterface::class); diff --git a/test/Result/Cgi/RequestFailureTest.php b/test/Result/Cgi/RequestFailureTest.php index 0ba97faa..f609da60 100644 --- a/test/Result/Cgi/RequestFailureTest.php +++ b/test/Result/Cgi/RequestFailureTest.php @@ -3,19 +3,15 @@ namespace PhpSchool\PhpWorkshopTest\Result\Cgi; use PhpSchool\PhpWorkshop\Result\Cgi\RequestFailure; -use PhpSchool\PhpWorkshop\Result\CgiOutBodyFailure; -use PhpSchool\PhpWorkshop\Result\CgiOutFailure; -use PhpSchool\PhpWorkshop\Result\CgiOutRequestFailure; -use PhpSchool\PhpWorkshop\Result\CgiOutResult; -use PHPUnit_Framework_TestCase; +use PHPUnit\Framework\TestCase; use Psr\Http\Message\RequestInterface; /** * @author Aydin Hassan */ -class RequestFailureTest extends PHPUnit_Framework_TestCase +class RequestFailureTest extends TestCase { - public function setUp() + public function setUp() : void { $request = $this->createMock(RequestInterface::class); $requestFailure = new RequestFailure($request, '', '', [], []); @@ -23,7 +19,7 @@ public function setUp() $this->assertSame($request, $requestFailure->getRequest()); } - public function testWhenOnlyOutputDifferent() + public function testWhenOnlyOutputDifferent() : void { $requestFailure = new RequestFailure( $this->createMock(RequestInterface::class), @@ -41,7 +37,7 @@ public function testWhenOnlyOutputDifferent() $this->assertSame($requestFailure->getExpectedHeaders(), $requestFailure->getActualHeaders()); } - public function testWhenOnlyHeadersDifferent() + public function testWhenOnlyHeadersDifferent() : void { $requestFailure = new RequestFailure( $this->createMock(RequestInterface::class), @@ -59,7 +55,7 @@ public function testWhenOnlyHeadersDifferent() $this->assertSame($requestFailure->getExpectedOutput(), $requestFailure->getActualOutput()); } - public function testWhenOutputAndHeadersDifferent() + public function testWhenOutputAndHeadersDifferent() : void { $requestFailure = new RequestFailure( $this->createMock(RequestInterface::class), diff --git a/test/Result/Cgi/SuccessTest.php b/test/Result/Cgi/SuccessTest.php index d55f4a39..631e18c5 100644 --- a/test/Result/Cgi/SuccessTest.php +++ b/test/Result/Cgi/SuccessTest.php @@ -3,15 +3,15 @@ namespace PhpSchool\PhpWorkshopTest\Result\Cgi; use PhpSchool\PhpWorkshop\Result\Cgi\Success; -use PHPUnit_Framework_TestCase; +use PHPUnit\Framework\TestCase; use Psr\Http\Message\RequestInterface; /** * @author Aydin Hassan */ -class SuccessTest extends PHPUnit_Framework_TestCase +class SuccessTest extends TestCase { - public function testSuccess() + public function testSuccess() : void { $request = $this->createMock(RequestInterface::class); $success = new Success($request); diff --git a/test/Result/Cli/CliResultTest.php b/test/Result/Cli/CliResultTest.php index 6c9db761..899269c6 100644 --- a/test/Result/Cli/CliResultTest.php +++ b/test/Result/Cli/CliResultTest.php @@ -13,14 +13,14 @@ */ class CliResultTest extends TestCase { - public function testName() + public function testName() : void { $request = new RequestFailure(new ArrayObject, 'EXPECTED', 'ACTUAL'); $cliResult = new CliResult([$request]); $this->assertSame('CLI Program Runner', $cliResult->getCheckName()); } - public function testIsSuccessful() + public function testIsSuccessful() : void { $request = new RequestFailure(new ArrayObject, 'EXPECTED', 'ACTUAL'); $cliResult = new CliResult([$request]); diff --git a/test/Result/Cli/GenericFailureTest.php b/test/Result/Cli/GenericFailureTest.php index dca7199e..b27c177e 100644 --- a/test/Result/Cli/GenericFailureTest.php +++ b/test/Result/Cli/GenericFailureTest.php @@ -1,18 +1,18 @@ */ -class GenericFailureTest extends PHPUnit_Framework_TestCase +class GenericFailureTest extends TestCase { - public function testFailure() + public function testFailure() : void { $args = new ArrayObject; $failure = new GenericFailure($args, 'Oops'); @@ -22,7 +22,7 @@ public function testFailure() $this->assertEquals('CLI Program Runner', $failure->getCheckName()); } - public function testFailureWithRequestAndReason() + public function testFailureWithRequestAndReason() : void { $args = new ArrayObject; $failure = GenericFailure::fromArgsAndReason($args, 'Oops'); @@ -32,7 +32,7 @@ public function testFailureWithRequestAndReason() $this->assertEquals('CLI Program Runner', $failure->getCheckName()); } - public function testFailureFromCodeExecutionException() + public function testFailureFromCodeExecutionException() : void { $args = new ArrayObject; $e = new CodeExecutionException('Something went wrong yo'); diff --git a/test/Result/Cli/RequestFailureTest.php b/test/Result/Cli/RequestFailureTest.php index 47f63817..e0d7e72c 100644 --- a/test/Result/Cli/RequestFailureTest.php +++ b/test/Result/Cli/RequestFailureTest.php @@ -2,18 +2,16 @@ namespace PhpSchool\PhpWorkshopTest\Result\Cli; -use PhpSchool\PhpWorkshop\Check\CheckInterface; use PhpSchool\PhpWorkshop\Result\Cli\RequestFailure; use PhpSchool\PhpWorkshop\Utils\ArrayObject; -use PHPUnit_Framework_TestCase; -use PhpSchool\PhpWorkshop\Result\StdOutFailure; +use PHPUnit\Framework\TestCase; /** * @author Aydin Hassan */ -class RequestFailureTest extends PHPUnit_Framework_TestCase +class RequestFailureTest extends TestCase { - public function setUp() + public function setUp() : void { $args = new ArrayObject; $failure = new RequestFailure($args, 'Expected Output', 'Actual Output'); @@ -21,7 +19,7 @@ public function setUp() $this->assertSame($args, $failure->getArgs()); } - public function testGetters() + public function testGetters() : void { $args = new ArrayObject; $failure = new RequestFailure($args, 'Expected Output', 'Actual Output'); @@ -30,7 +28,7 @@ public function testGetters() $this->assertSame($args, $failure->getArgs()); } - public function testFailureFromArgsAndOutput() + public function testFailureFromArgsAndOutput() : void { $args = new ArrayObject; $failure = RequestFailure::fromArgsAndOutput($args, 'Expected Output', 'Actual Output'); diff --git a/test/Result/Cli/SuccessTest.php b/test/Result/Cli/SuccessTest.php index 9ee5f15b..f87b3e84 100644 --- a/test/Result/Cli/SuccessTest.php +++ b/test/Result/Cli/SuccessTest.php @@ -4,14 +4,14 @@ use PhpSchool\PhpWorkshop\Result\Cli\Success; use PhpSchool\PhpWorkshop\Utils\ArrayObject; -use PHPUnit_Framework_TestCase; +use PHPUnit\Framework\TestCase; /** * @author Aydin Hassan */ -class SuccessTest extends PHPUnit_Framework_TestCase +class SuccessTest extends TestCase { - public function testSuccess() + public function testSuccess() : void { $args = new ArrayObject; $success = new Success($args); diff --git a/test/Result/ComparisonFailureTest.php b/test/Result/ComparisonFailureTest.php index a668e880..98c04325 100644 --- a/test/Result/ComparisonFailureTest.php +++ b/test/Result/ComparisonFailureTest.php @@ -3,15 +3,14 @@ namespace PhpSchool\PhpWorkshopTest\Result; use PhpSchool\PhpWorkshop\Result\ComparisonFailure; -use PHPUnit_Framework_TestCase; -use PhpSchool\PhpWorkshop\Result\StdOutFailure; +use PHPUnit\Framework\TestCase; /** * @author Aydin Hassan */ -class ComparisonFailureTest extends PHPUnit_Framework_TestCase +class ComparisonFailureTest extends TestCase { - public function testGetters() + public function testGetters() : void { $failure = new ComparisonFailure('Name', 'Expected Output', 'Actual Output'); self::assertSame('Name', $failure->getCheckName()); @@ -19,7 +18,7 @@ public function testGetters() self::assertEquals('Actual Output', $failure->getActualValue()); } - public function testFailureFromArgsAndOutput() + public function testFailureFromArgsAndOutput() : void { $failure = ComparisonFailure::fromNameAndValues('Name', 'Expected Output', 'Actual Output'); self::assertSame('Name', $failure->getCheckName()); diff --git a/test/Result/FailureTest.php b/test/Result/FailureTest.php index 4246c168..f2a9b1b1 100644 --- a/test/Result/FailureTest.php +++ b/test/Result/FailureTest.php @@ -5,7 +5,7 @@ use PhpParser\Error; use PhpSchool\PhpWorkshop\Check\CheckInterface; use PhpSchool\PhpWorkshop\Exception\CodeExecutionException; -use PHPUnit_Framework_TestCase; +use PHPUnit\Framework\TestCase; use PhpSchool\PhpWorkshop\Result\ResultInterface; use PhpSchool\PhpWorkshop\Result\Failure; @@ -14,26 +14,25 @@ * @package PhpSchool\PhpWorkshopTest\Result * @author Aydin Hassan */ -class FailureTest extends PHPUnit_Framework_TestCase +class FailureTest extends TestCase { /** * @var CheckInterface */ private $check; - public function setUp() + public function setUp() : void { $this->check = $this->createMock(CheckInterface::class); $this->check - ->expects($this->any()) ->method('getName') - ->will($this->returnValue('Some Check')); + ->willReturn('Some Check'); $failure = new Failure($this->check->getName(), ''); $this->assertSame('Some Check', $failure->getCheckName()); } - public function testFailure() + public function testFailure() : void { $failure = new Failure($this->check->getName(), 'Something went wrong yo'); $this->assertInstanceOf(ResultInterface::class, $failure); @@ -41,7 +40,7 @@ public function testFailure() $this->assertEquals('Some Check', $failure->getCheckName()); } - public function testFailureWithNameAndReason() + public function testFailureWithNameAndReason() : void { $failure = Failure::fromNameAndReason('Some Check', 'Something went wrong yo'); $this->assertInstanceOf(ResultInterface::class, $failure); @@ -49,7 +48,7 @@ public function testFailureWithNameAndReason() $this->assertEquals('Some Check', $failure->getCheckName()); } - public function testFailureWithReason() + public function testFailureWithReason() : void { $failure = Failure::fromCheckAndReason($this->check, 'Something went wrong yo'); $this->assertInstanceOf(ResultInterface::class, $failure); @@ -57,7 +56,7 @@ public function testFailureWithReason() $this->assertEquals('Some Check', $failure->getCheckName()); } - public function testFailureFromCodeExecutionException() + public function testFailureFromCodeExecutionException() : void { $e = new CodeExecutionException('Something went wrong yo'); $failure = Failure::fromNameAndCodeExecutionFailure('Some Check', $e); @@ -66,7 +65,7 @@ public function testFailureFromCodeExecutionException() $this->assertEquals('Some Check', $failure->getCheckName()); } - public function testFailureFromCodeParseException() + public function testFailureFromCodeParseException() : void { $e = new Error('Something went wrong yo'); $failure = Failure::fromCheckAndCodeParseFailure($this->check, $e, 'exercise.php'); diff --git a/test/Result/FunctionRequirementsFailureTest.php b/test/Result/FunctionRequirementsFailureTest.php index 7fc699d6..f5bbc122 100644 --- a/test/Result/FunctionRequirementsFailureTest.php +++ b/test/Result/FunctionRequirementsFailureTest.php @@ -3,7 +3,7 @@ namespace PhpSchool\PhpWorkshopTest\Result; use PhpSchool\PhpWorkshop\Check\CheckInterface; -use PHPUnit_Framework_TestCase; +use PHPUnit\Framework\TestCase; use PhpSchool\PhpWorkshop\Result\FunctionRequirementsFailure; /** @@ -11,15 +11,14 @@ * @package PhpSchool\PhpWorkshopTest\Result * @author Aydin Hassan */ -class FunctionRequirementsFailureTest extends PHPUnit_Framework_TestCase +class FunctionRequirementsFailureTest extends TestCase { - public function testGetters() + public function testGetters() : void { $check = $this->createMock(CheckInterface::class); $check - ->expects($this->any()) ->method('getName') - ->will($this->returnValue('Some Check')); + ->willReturn('Some Check'); $failure = new FunctionRequirementsFailure($check, ['function' => 'file', 'line' => 3], ['explode']); $this->assertEquals(['function' => 'file', 'line' => 3], $failure->getBannedFunctions()); diff --git a/test/Result/SuccessTest.php b/test/Result/SuccessTest.php index 43fed1f9..54c45f39 100644 --- a/test/Result/SuccessTest.php +++ b/test/Result/SuccessTest.php @@ -3,7 +3,7 @@ namespace PhpSchool\PhpWorkshopTest\Result; use PhpSchool\PhpWorkshop\Check\CheckInterface; -use PHPUnit_Framework_TestCase; +use PHPUnit\Framework\TestCase; use PhpSchool\PhpWorkshop\Result\ResultInterface; use PhpSchool\PhpWorkshop\Result\Success; @@ -12,22 +12,21 @@ * @package PhpSchool\PhpWorkshopTest\Result * @author Aydin Hassan */ -class SuccessTest extends PHPUnit_Framework_TestCase +class SuccessTest extends TestCase { - public function testSuccess() + public function testSuccess() : void { $success = new Success('Some Check'); $this->assertInstanceOf(ResultInterface::class, $success); $this->assertEquals('Some Check', $success->getCheckName()); } - public function testSuccessFromCheck() + public function testSuccessFromCheck() : void { $check = $this->createMock(CheckInterface::class); $check - ->expects($this->any()) ->method('getName') - ->will($this->returnValue('Some Check')); + ->willReturn('Some Check'); $success = Success::fromCheck($check); $this->assertInstanceOf(ResultInterface::class, $success); diff --git a/test/ResultAggregatorTest.php b/test/ResultAggregatorTest.php index e271702c..d19e66f8 100644 --- a/test/ResultAggregatorTest.php +++ b/test/ResultAggregatorTest.php @@ -6,7 +6,7 @@ use PhpSchool\PhpWorkshop\Check\CheckInterface; use PhpSchool\PhpWorkshop\Result\Cli\CliResult; use PhpSchool\PhpWorkshop\Utils\ArrayObject; -use PHPUnit_Framework_TestCase; +use PHPUnit\Framework\TestCase; use PhpSchool\PhpWorkshop\Result\Failure; use PhpSchool\PhpWorkshop\Result\Success; use PhpSchool\PhpWorkshop\Result\Cli\Success as CliSuccess; @@ -18,23 +18,22 @@ * @package PhpSchool\PhpWorkshopTest * @author Aydin Hassan */ -class ResultAggregatorTest extends PHPUnit_Framework_TestCase +class ResultAggregatorTest extends TestCase { /** * @var CheckInterface */ private $check; - public function setUp() + public function setUp() : void { $this->check = $this->createMock(CheckInterface::class); $this->check - ->expects($this->any()) ->method('getName') - ->will($this->returnValue('Some Check')); + ->willReturn('Some Check'); } - public function testIsSuccessful() + public function testIsSuccessful() : void { $resultAggregator = new ResultAggregator; $this->assertTrue($resultAggregator->isSuccessful()); @@ -46,7 +45,7 @@ public function testIsSuccessful() $this->assertFalse($resultAggregator->isSuccessful()); } - public function testIsSuccessfulWithResultGroups() + public function testIsSuccessfulWithResultGroups() : void { $resultAggregator = new ResultAggregator; $this->assertTrue($resultAggregator->isSuccessful()); @@ -62,7 +61,7 @@ public function testIsSuccessfulWithResultGroups() $this->assertFalse($resultAggregator->isSuccessful()); } - public function testIterator() + public function testIterator() : void { $results = [ new Success($this->check), diff --git a/test/ResultRenderer/AbstractResultRendererTest.php b/test/ResultRenderer/AbstractResultRendererTest.php index ac9ed905..dbd04bbd 100644 --- a/test/ResultRenderer/AbstractResultRendererTest.php +++ b/test/ResultRenderer/AbstractResultRendererTest.php @@ -4,7 +4,7 @@ use Colors\Color; use Kadet\Highlighter\KeyLighter; -use PhpSchool\CliMenu\Terminal\TerminalInterface; +use PhpSchool\Terminal\Terminal; use PhpSchool\PhpWorkshop\Factory\ResultRendererFactory; use PHPUnit\Framework\TestCase; use PhpSchool\PhpWorkshop\ExerciseRepository; @@ -30,7 +30,7 @@ abstract class AbstractResultRendererTest extends TestCase /** * @return ResultRendererFactory */ - public function getResultRendererFactory() + public function getResultRendererFactory(): ResultRendererFactory { if (null === $this->resultRendererFactory) { $this->resultRendererFactory = new ResultRendererFactory; @@ -42,13 +42,13 @@ public function getResultRendererFactory() /** * @return ResultsRenderer */ - protected function getRenderer() + protected function getRenderer(): ResultsRenderer { if (null === $this->renderer) { $color = new Color; $color->setForceStyle(true); - $terminal = $this->prophesize(TerminalInterface::class); + $terminal = $this->prophesize(Terminal::class); $terminal->getWidth()->willReturn(50); $exerciseRepo = $this->createMock(ExerciseRepository::class); diff --git a/test/ResultRenderer/Cgi/RequestFailureRendererTest.php b/test/ResultRenderer/Cgi/RequestFailureRendererTest.php index 118327a8..c50af05b 100644 --- a/test/ResultRenderer/Cgi/RequestFailureRendererTest.php +++ b/test/ResultRenderer/Cgi/RequestFailureRendererTest.php @@ -12,7 +12,7 @@ */ class RequestFailureRendererTest extends AbstractResultRendererTest { - public function testRenderWhenOnlyHeadersDifferent() + public function testRenderWhenOnlyHeadersDifferent() : void { $failure = new RequestFailure( $this->request(), @@ -31,7 +31,7 @@ public function testRenderWhenOnlyHeadersDifferent() $this->assertSame($expected, $renderer->render($this->getRenderer())); } - public function testRenderWhenOnlyOutputDifferent() + public function testRenderWhenOnlyOutputDifferent() : void { $failure = new RequestFailure( $this->request(), @@ -49,7 +49,7 @@ public function testRenderWhenOnlyOutputDifferent() $this->assertSame($expected, $renderer->render($this->getRenderer())); } - public function testRenderWhenOutputAndHeadersDifferent() + public function testRenderWhenOutputAndHeadersDifferent() : void { $failure = new RequestFailure( $this->request(), @@ -73,7 +73,7 @@ public function testRenderWhenOutputAndHeadersDifferent() $this->assertSame($expected, $renderer->render($this->getRenderer())); } - private function request() + private function request() : Request { return (new Request('http://www.test.com')) ->withMethod('POST') diff --git a/test/ResultRenderer/CgiResultRendererTest.php b/test/ResultRenderer/CgiResultRendererTest.php index d050de7c..ddcb5c19 100644 --- a/test/ResultRenderer/CgiResultRendererTest.php +++ b/test/ResultRenderer/CgiResultRendererTest.php @@ -17,7 +17,7 @@ */ class CgiResultRendererTest extends AbstractResultRendererTest { - public function testNothingIsOutputIfNoFailures() + public function testNothingIsOutputIfNoFailures() : void { $result = new CgiResult([new Success($this->request())]); $renderer = new CgiResultRenderer($result, new RequestRenderer); @@ -25,7 +25,7 @@ public function testNothingIsOutputIfNoFailures() $this->assertEmpty($renderer->render($this->getRenderer())); } - public function testRenderWithFailedRequest() + public function testRenderWithFailedRequest() : void { $failureRenderer = $this->prophesize(RequestFailureRenderer::class); $failureRenderer->render($this->getRenderer())->willReturn("REQUEST FAILURE\n"); @@ -63,7 +63,7 @@ function (RequestFailure $failure) use ($failureRenderer) { $this->assertSame($expected, $renderer->render($this->getRenderer())); } - public function testMultipleFailedRequests() + public function testMultipleFailedRequests() : void { $failureRenderer = $this->prophesize(RequestFailureRenderer::class); $failureRenderer->render($this->getRenderer())->willReturn("REQUEST FAILURE\n"); @@ -121,7 +121,7 @@ function (RequestFailure $failure) use ($failureRenderer) { $this->assertSame($expected, $renderer->render($this->getRenderer())); } - public function testRenderWithFailedRequestAndSuccess() + public function testRenderWithFailedRequestAndSuccess() : void { $failureRenderer = $this->prophesize(RequestFailureRenderer::class); $failureRenderer->render($this->getRenderer())->willReturn("REQUEST FAILURE\n"); @@ -159,7 +159,7 @@ function (RequestFailure $failure) use ($failureRenderer) { $this->assertSame($expected, $renderer->render($this->getRenderer())); } - public function testRenderWithFailedRequestAndGenericFailure() + public function testRenderWithFailedRequestAndGenericFailure() : void { $requestFailureRenderer = $this->prophesize(RequestFailureRenderer::class); @@ -223,7 +223,7 @@ function (GenericFailure $failure) use ($genericFailureRenderer) { $this->assertSame($expected, $renderer->render($this->getRenderer())); } - private function request() + private function request() : Request { return (new Request('http://www.test.com')) ->withMethod('POST') diff --git a/test/ResultRenderer/Cli/RequestFailureRendererTest.php b/test/ResultRenderer/Cli/RequestFailureRendererTest.php index 102b8132..79ef2360 100644 --- a/test/ResultRenderer/Cli/RequestFailureRendererTest.php +++ b/test/ResultRenderer/Cli/RequestFailureRendererTest.php @@ -12,7 +12,7 @@ */ class RequestFailureRendererTest extends AbstractResultRendererTest { - public function testRender() + public function testRender() : void { $failure = new RequestFailure(new ArrayObject, 'EXPECTED OUTPUT', 'ACTUAL OUTPUT'); $renderer = new RequestFailureRenderer($failure); diff --git a/test/ResultRenderer/CliResultRendererTest.php b/test/ResultRenderer/CliResultRendererTest.php index 5aedb1e6..ace0186c 100644 --- a/test/ResultRenderer/CliResultRendererTest.php +++ b/test/ResultRenderer/CliResultRendererTest.php @@ -14,7 +14,7 @@ */ class CliResultRendererTest extends AbstractResultRendererTest { - public function testNothingIsOutputIfNoFailures() + public function testNothingIsOutputIfNoFailures() : void { $result = new CliResult([new Success(new ArrayObject)]); $renderer = new CliResultRenderer($result); @@ -22,7 +22,7 @@ public function testNothingIsOutputIfNoFailures() $this->assertEmpty($renderer->render($this->getRenderer())); } - public function testRenderWithFailedRequest() + public function testRenderWithFailedRequest() : void { $failureRenderer = $this->prophesize(RequestFailureRenderer::class); $failureRenderer->render($this->getRenderer())->willReturn("REQUEST FAILURE\n"); @@ -52,7 +52,7 @@ function (RequestFailure $failure) use ($failureRenderer) { $this->assertSame($expected, $renderer->render($this->getRenderer())); } - public function testRenderWithFailedRequestWithMultipleArgs() + public function testRenderWithFailedRequestWithMultipleArgs() : void { $failureRenderer = $this->prophesize(RequestFailureRenderer::class); $failureRenderer->render($this->getRenderer())->willReturn("REQUEST FAILURE\n"); diff --git a/test/ResultRenderer/ComparisonFailureRendererTest.php b/test/ResultRenderer/ComparisonFailureRendererTest.php index ead0f7f3..8b85d1ff 100644 --- a/test/ResultRenderer/ComparisonFailureRendererTest.php +++ b/test/ResultRenderer/ComparisonFailureRendererTest.php @@ -10,7 +10,7 @@ */ class ComparisonFailureRendererTest extends AbstractResultRendererTest { - public function testRender() + public function testRender() : void { $failure = new ComparisonFailure('Name', 'EXPECTED OUTPUT', 'ACTUAL OUTPUT'); $renderer = new ComparisonFailureRenderer($failure); diff --git a/test/ResultRenderer/FailureRendererTest.php b/test/ResultRenderer/FailureRendererTest.php index 7417e43e..9b1c8b99 100644 --- a/test/ResultRenderer/FailureRendererTest.php +++ b/test/ResultRenderer/FailureRendererTest.php @@ -16,7 +16,7 @@ */ class FailureRendererTest extends AbstractResultRendererTest { - public function testRender() + public function testRender() : void { $failure = new Failure($this->createMock(CheckInterface::class), 'Something went wrong'); $renderer = new FailureRenderer($failure); diff --git a/test/ResultRenderer/FunctionRequirementsFailureRendererTest.php b/test/ResultRenderer/FunctionRequirementsFailureRendererTest.php index 017fcd19..53a4217e 100644 --- a/test/ResultRenderer/FunctionRequirementsFailureRendererTest.php +++ b/test/ResultRenderer/FunctionRequirementsFailureRendererTest.php @@ -14,7 +14,7 @@ */ class FunctionRequirementsFailureRendererTest extends AbstractResultRendererTest { - public function testRenderer() + public function testRenderer() : void { $failure = new FunctionRequirementsFailure( $this->createMock(CheckInterface::class), @@ -27,7 +27,7 @@ public function testRenderer() $expected .= " file on line 3\n"; $expected .= " explode on line 5\n"; - $expected .= " Some function requirements were missing. You should use the functions"; + $expected .= ' Some function requirements were missing. You should use the functions'; $expected .= "\n"; $expected .= " implode\n"; diff --git a/test/ResultRenderer/ResultsRendererTest.php b/test/ResultRenderer/ResultsRendererTest.php index 945bf9d8..dc4011da 100644 --- a/test/ResultRenderer/ResultsRendererTest.php +++ b/test/ResultRenderer/ResultsRendererTest.php @@ -6,7 +6,7 @@ use Kadet\Highlighter\Formatter\CliFormatter; use Kadet\Highlighter\KeyLighter; use Kadet\Highlighter\Language\Php; -use PhpSchool\CliMenu\Terminal\TerminalInterface; +use PhpSchool\Terminal\Terminal; use PhpSchool\PhpWorkshop\Exercise\ExerciseInterface; use PhpSchool\PhpWorkshop\Exercise\ProvidesSolution; use PhpSchool\PhpWorkshop\ExerciseRepository; @@ -19,7 +19,7 @@ use PhpSchool\PhpWorkshop\ResultRenderer\ResultsRenderer; use PhpSchool\PhpWorkshop\Solution\SingleFileSolution; use PhpSchool\PhpWorkshop\UserState; -use PHPUnit_Framework_TestCase; +use PHPUnit\Framework\TestCase; use Prophecy\Argument; /** @@ -27,10 +27,10 @@ * @package PhpSchool\PhpWorkshopTest\ResultRenderer * @author Aydin Hassan */ -class ResultsRendererTest extends PHPUnit_Framework_TestCase +class ResultsRendererTest extends TestCase { - public function testRenderIndividualResult() + public function testRenderIndividualResult() : void { $color = new Color; $color->setForceStyle(true); @@ -38,7 +38,7 @@ public function testRenderIndividualResult() $resultRendererFactory = new ResultRendererFactory; $resultRendererFactory->registerRenderer(Failure::class, FailureRenderer::class); - $terminal = $this->prophesize(TerminalInterface::class); + $terminal = $this->prophesize(Terminal::class); $terminal->getWidth()->willReturn(30); $renderer = new ResultsRenderer( @@ -55,12 +55,12 @@ public function testRenderIndividualResult() $this->assertSame(" Some Failure\n", $renderer->renderResult($result)); } - public function testLineBreak() + public function testLineBreak() : void { $color = new Color; $color->setForceStyle(true); - $terminal = $this->prophesize(TerminalInterface::class); + $terminal = $this->prophesize(Terminal::class); $terminal->getWidth()->willReturn(10); $renderer = new ResultsRenderer( @@ -75,14 +75,14 @@ public function testLineBreak() $this->assertSame("\e[33m──────────\e[0m", $renderer->lineBreak()); } - public function testRenderSuccess() + public function testRenderSuccess() : void { $color = new Color; $color->setForceStyle(true); $resultRendererFactory = new ResultRendererFactory; - $terminal = $this->prophesize(TerminalInterface::class); + $terminal = $this->prophesize(Terminal::class); $terminal->getWidth()->willReturn(100); $terminal = $terminal->reveal(); @@ -112,14 +112,14 @@ public function testRenderSuccess() ); } - public function testRenderSuccessWithSolution() + public function testRenderSuccessWithSolution() : void { $color = new Color; $color->setForceStyle(true); $resultRendererFactory = new ResultRendererFactory; - $terminal = $this->prophesize(TerminalInterface::class); + $terminal = $this->prophesize(Terminal::class); $terminal->getWidth()->willReturn(100); $terminal = $terminal->reveal(); @@ -162,14 +162,14 @@ public function testRenderSuccessWithSolution() rmdir(dirname($tmpFile)); } - public function testRenderSuccessWithPhpSolutionFileIsSyntaxHighlighted() + public function testRenderSuccessWithPhpSolutionFileIsSyntaxHighlighted() : void { $color = new Color; $color->setForceStyle(true); $resultRendererFactory = new ResultRendererFactory; - $terminal = $this->prophesize(TerminalInterface::class); + $terminal = $this->prophesize(Terminal::class); $terminal->getWidth()->willReturn(100); $terminal = $terminal->reveal(); @@ -219,7 +219,7 @@ public function testRenderSuccessWithPhpSolutionFileIsSyntaxHighlighted() rmdir(dirname($tmpFile)); } - public function testRenderSuccessAndFailure() + public function testRenderSuccessAndFailure() : void { $color = new Color; $color->setForceStyle(true); @@ -231,7 +231,7 @@ public function testRenderSuccessAndFailure() return $renderer->reveal(); }); - $terminal = $this->prophesize(TerminalInterface::class); + $terminal = $this->prophesize(Terminal::class); $terminal->getWidth()->willReturn(100); $terminal = $terminal->reveal(); @@ -262,7 +262,7 @@ public function testRenderSuccessAndFailure() ); } - public function testAllSuccessResultsAreHoistedToTheTop() + public function testAllSuccessResultsAreHoistedToTheTop() : void { $color = new Color; $color->setForceStyle(true); @@ -274,7 +274,7 @@ public function testAllSuccessResultsAreHoistedToTheTop() return $renderer->reveal(); }); - $terminal = $this->prophesize(TerminalInterface::class); + $terminal = $this->prophesize(Terminal::class); $terminal->getWidth()->willReturn(100); $terminal = $terminal->reveal(); @@ -306,7 +306,7 @@ public function testAllSuccessResultsAreHoistedToTheTop() ); } - public function testRenderAllFailures() + public function testRenderAllFailures() : void { $color = new Color; $color->setForceStyle(true); @@ -318,7 +318,7 @@ public function testRenderAllFailures() return $renderer->reveal(); }); - $terminal = $this->prophesize(TerminalInterface::class); + $terminal = $this->prophesize(Terminal::class); $terminal->getWidth()->willReturn(100); $terminal = $terminal->reveal(); @@ -348,10 +348,7 @@ public function testRenderAllFailures() ); } - /** - * @return string - */ - private function getExpectedOutput() + private function getExpectedOutput() : string { $name = camel_case_to_kebab_case($this->getName()); return file_get_contents(sprintf('%s/../res/exercise-renderer/%s.txt', __DIR__, $name)); diff --git a/test/Solution/DirectorySolutionTest.php b/test/Solution/DirectorySolutionTest.php index aeee0e4e..69c74311 100644 --- a/test/Solution/DirectorySolutionTest.php +++ b/test/Solution/DirectorySolutionTest.php @@ -4,7 +4,7 @@ use InvalidArgumentException; use PhpSchool\PhpWorkshop\Solution\DirectorySolution; -use PHPUnit_Framework_TestCase; +use PHPUnit\Framework\TestCase; /** * Class DirectorySolutionTest @@ -12,9 +12,9 @@ * @author Aydin Hassan * @author Michael Woodward */ -class DirectorySolutionTest extends PHPUnit_Framework_TestCase +class DirectorySolutionTest extends TestCase { - public function testExceptionIsThrownIfEntryPointDoesNotExist() + public function testExceptionIsThrownIfEntryPointDoesNotExist() : void { $tempPath = sprintf('%s/%s', realpath(sys_get_temp_dir()), $this->getName()); @mkdir($tempPath, 0775, true); @@ -29,7 +29,7 @@ public function testExceptionIsThrownIfEntryPointDoesNotExist() rmdir($tempPath); } - public function testWithDefaultEntryPoint() + public function testWithDefaultEntryPoint() : void { $tempPath = sprintf('%s/%s', realpath(sys_get_temp_dir()), $this->getName()); @mkdir($tempPath, 0775, true); @@ -41,7 +41,6 @@ public function testWithDefaultEntryPoint() $this->assertSame($tempPath, $solution->getBaseDirectory()); $this->assertFalse($solution->hasComposerFile()); $this->assertSame(sprintf('%s/solution.php', $tempPath), $solution->getEntryPoint()); - $this->assertInternalType('array', $solution->getFiles()); $files = $solution->getFiles(); $this->assertCount(2, $files); @@ -53,7 +52,7 @@ public function testWithDefaultEntryPoint() rmdir($tempPath); } - public function testWithManualEntryPoint() + public function testWithManualEntryPoint() : void { $tempPath = sprintf('%s/%s', realpath(sys_get_temp_dir()), $this->getName()); @mkdir($tempPath, 0775, true); @@ -65,7 +64,6 @@ public function testWithManualEntryPoint() $this->assertSame($tempPath, $solution->getBaseDirectory()); $this->assertFalse($solution->hasComposerFile()); $this->assertSame(sprintf('%s/index.php', $tempPath), $solution->getEntryPoint()); - $this->assertInternalType('array', $solution->getFiles()); $files = $solution->getFiles(); $this->assertCount(2, $files); @@ -77,7 +75,7 @@ public function testWithManualEntryPoint() rmdir($tempPath); } - public function testHasComposerFileReturnsTrueIfPresent() + public function testHasComposerFileReturnsTrueIfPresent() : void { $tempPath = sprintf('%s/%s', realpath(sys_get_temp_dir()), $this->getName()); @mkdir($tempPath, 0775, true); @@ -90,7 +88,6 @@ public function testHasComposerFileReturnsTrueIfPresent() $this->assertSame($tempPath, $solution->getBaseDirectory()); $this->assertTrue($solution->hasComposerFile()); $this->assertSame(sprintf('%s/solution.php', $tempPath), $solution->getEntryPoint()); - $this->assertInternalType('array', $solution->getFiles()); $files = $solution->getFiles(); $this->assertCount(2, $files); @@ -102,7 +99,7 @@ public function testHasComposerFileReturnsTrueIfPresent() unlink(sprintf('%s/some-class.php', $tempPath)); } - public function testWithExceptions() + public function testWithExceptions() : void { $tempPath = sprintf('%s/%s', realpath(sys_get_temp_dir()), $this->getName()); @mkdir($tempPath, 0775, true); @@ -115,7 +112,6 @@ public function testWithExceptions() $solution = DirectorySolution::fromDirectory($tempPath, $exclusions); $this->assertSame(sprintf('%s/solution.php', $tempPath), $solution->getEntryPoint()); - $this->assertInternalType('array', $solution->getFiles()); $files = $solution->getFiles(); $this->assertCount(2, $files); @@ -128,7 +124,7 @@ public function testWithExceptions() rmdir($tempPath); } - public function testWithNestedDirectories() + public function testWithNestedDirectories() : void { $tempPath = sprintf('%s/%s', realpath(sys_get_temp_dir()), $this->getName()); @mkdir($tempPath, 0775, true); @@ -145,7 +141,6 @@ public function testWithNestedDirectories() $solution = DirectorySolution::fromDirectory($tempPath); $this->assertSame(sprintf('%s/solution.php', $tempPath), $solution->getEntryPoint()); - $this->assertInternalType('array', $solution->getFiles()); $files = $solution->getFiles(); $this->assertCount(5, $files); @@ -165,7 +160,7 @@ public function testWithNestedDirectories() rmdir($tempPath); } - public function testExceptionsWithNestedDirectories() + public function testExceptionsWithNestedDirectories() : void { $tempPath = sprintf('%s/%s', realpath(sys_get_temp_dir()), $this->getName()); @mkdir($tempPath, 0775, true); @@ -187,7 +182,6 @@ public function testExceptionsWithNestedDirectories() $solution = DirectorySolution::fromDirectory($tempPath, $exclusions); $this->assertSame(sprintf('%s/solution.php', $tempPath), $solution->getEntryPoint()); - $this->assertInternalType('array', $solution->getFiles()); $files = $solution->getFiles(); $this->assertCount(2, $files); diff --git a/test/Solution/SingleFileSolutionTest.php b/test/Solution/SingleFileSolutionTest.php index 7688e503..94006e94 100644 --- a/test/Solution/SingleFileSolutionTest.php +++ b/test/Solution/SingleFileSolutionTest.php @@ -3,16 +3,16 @@ namespace PhpSchool\PhpWorkshopTest\Solution; use PhpSchool\PhpWorkshop\Solution\SingleFileSolution; -use PHPUnit_Framework_TestCase; +use PHPUnit\Framework\TestCase; /** * Class SingleFileSolutionTest * @package PhpSchool\PhpWorkshop\Solution * @author Aydin Hassan */ -class SingleFileSolutionTest extends PHPUnit_Framework_TestCase +class SingleFileSolutionTest extends TestCase { - public function testGetters() + public function testGetters() : void { $tempPath = sprintf('%s/%s', realpath(sys_get_temp_dir()), $this->getName()); $filePath = sprintf('%s/test.file', $tempPath); diff --git a/test/Solution/SolutionFileTest.php b/test/Solution/SolutionFileTest.php index 8e02e7af..64e8bae7 100644 --- a/test/Solution/SolutionFileTest.php +++ b/test/Solution/SolutionFileTest.php @@ -4,16 +4,16 @@ use InvalidArgumentException; use PhpSchool\PhpWorkshop\Solution\SolutionFile; -use PHPUnit_Framework_TestCase; +use PHPUnit\Framework\TestCase; /** * Class SolutionFileTest * @package PhpSchool\PhpWorkshop\Solution * @author Aydin Hassan */ -class SolutionFileTest extends PHPUnit_Framework_TestCase +class SolutionFileTest extends TestCase { - public function testExceptionIsThrowIfFileNotExists() + public function testExceptionIsThrowIfFileNotExists() : void { $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('File: "file/that/does/not/exist.php" does not exist'); @@ -21,7 +21,7 @@ public function testExceptionIsThrowIfFileNotExists() SolutionFile::fromFile('file/that/does/not/exist.php'); } - public function testPaths() + public function testPaths() : void { $tempPath = sprintf('%s/%s', sys_get_temp_dir(), $this->getName()); $filePath = sprintf('%s/test.file', $tempPath); @@ -39,7 +39,7 @@ public function testPaths() rmdir($tempPath); } - public function testEmptyContents() + public function testEmptyContents() : void { $tempPath = sprintf('%s/%s', sys_get_temp_dir(), $this->getName()); $filePath = sprintf('%s/test.file', $tempPath); @@ -57,7 +57,7 @@ public function testEmptyContents() rmdir($tempPath); } - public function testGetContents() + public function testGetContents() : void { $tempPath = sprintf('%s/%s', sys_get_temp_dir(), $this->getName()); $filePath = sprintf('%s/test.file', $tempPath); @@ -75,7 +75,7 @@ public function testGetContents() rmdir($tempPath); } - public function testConstructionWithManualBaseDirectory() + public function testConstructionWithManualBaseDirectory() : void { $tempPath = sprintf('%s/%s/sub-dir', sys_get_temp_dir(), $this->getName()); $filePath = sprintf('%s/test.file', $tempPath); @@ -93,7 +93,7 @@ public function testConstructionWithManualBaseDirectory() rmdir($tempPath); } - public function testGetExtension() + public function testGetExtension() : void { $tempPath = sprintf('%s/%s/sub-dir', sys_get_temp_dir(), $this->getName()); $filePath = sprintf('%s/test.php', $tempPath); diff --git a/test/TestWorkshopType.php b/test/TestWorkshopType.php index d57a1e35..345e7bff 100644 --- a/test/TestWorkshopType.php +++ b/test/TestWorkshopType.php @@ -11,7 +11,7 @@ */ class TestWorkshopType extends TestCase { - public function testIsTutorialMode() + public function testIsTutorialMode() : void { $tutorial = WorkshopType::TUTORIAL(); $standard = WorkshopType::STANDARD(); diff --git a/test/UserStateSerializerTest.php b/test/UserStateSerializerTest.php index 7f2db2cc..864be92a 100644 --- a/test/UserStateSerializerTest.php +++ b/test/UserStateSerializerTest.php @@ -7,13 +7,14 @@ use PhpSchool\PhpWorkshop\UserState; use PhpSchool\PhpWorkshop\UserStateSerializer; use PhpSchool\PhpWorkshopTest\Asset\CliExerciseInterface; +use PHPUnit\Framework\TestCase; /** * Class UserStateSerializerTest * @package PhpSchool\PhpWorkshopTest * @author Aydin Hassan */ -class UserStateSerializerTest extends \PHPUnit_Framework_TestCase +class UserStateSerializerTest extends TestCase { /** * @var string @@ -35,28 +36,28 @@ class UserStateSerializerTest extends \PHPUnit_Framework_TestCase */ private $exerciseRepository; - public function setUp() + public function setUp() : void { - $this->tmpDir = sprintf('%s/%s/%s', sys_get_temp_dir(), $this->getName(), rand(1, 100)); + $this->tmpDir = sprintf('%s/%s/%s', sys_get_temp_dir(), $this->getName(), random_int(1, 100)); $this->tmpFile = sprintf('%s/.phpschool-save.json', $this->tmpDir); $this->exerciseRepository = new ExerciseRepository([]); } - public function testIfDirNotExistsItIsCreated() + public function testIfDirNotExistsItIsCreated() : void { $this->assertFileNotExists($this->tmpDir); new UserStateSerializer($this->tmpDir, $this->workshopName, $this->exerciseRepository); $this->assertFileExists($this->tmpDir); } - public function testConstructWhenFileExists() + public function testConstructWhenFileExists() : void { mkdir($this->tmpDir, 0777, true); $this->assertFileExists($this->tmpDir); new UserStateSerializer($this->tmpDir, $this->workshopName, $this->exerciseRepository); } - public function testSerializeEmptySate() + public function testSerializeEmptySate() : void { mkdir($this->tmpDir, 0777, true); $serializer = new UserStateSerializer($this->tmpDir, $this->workshopName, $this->exerciseRepository); @@ -75,7 +76,7 @@ public function testSerializeEmptySate() $this->assertSame($expected, file_get_contents($this->tmpFile)); } - public function testSerialize() + public function testSerialize() : void { mkdir($this->tmpDir, 0777, true); $serializer = new UserStateSerializer($this->tmpDir, $this->workshopName, $this->exerciseRepository); @@ -95,7 +96,7 @@ public function testSerialize() $this->assertSame($expected, file_get_contents($this->tmpFile)); } - public function testDeserializeNonExistingFile() + public function testDeserializeNonExistingFile() : void { mkdir($this->tmpDir, 0777, true); $serializer = new UserStateSerializer($this->tmpDir, $this->workshopName, $this->exerciseRepository); @@ -104,7 +105,7 @@ public function testDeserializeNonExistingFile() $this->assertEmpty($state->getCompletedExercises()); } - public function testDeserializeEmptyFile() + public function testDeserializeEmptyFile() : void { mkdir($this->tmpDir, 0777, true); file_put_contents($this->tmpFile, ''); @@ -114,7 +115,7 @@ public function testDeserializeEmptyFile() $this->assertEmpty($state->getCompletedExercises()); } - public function testDeserializeNonValidJson() + public function testDeserializeNonValidJson() : void { mkdir($this->tmpDir, 0777, true); file_put_contents($this->tmpFile, 'yayayayayanotjson'); @@ -125,11 +126,9 @@ public function testDeserializeNonValidJson() } /** - * @param array $data - * @param array $expected * @dataProvider deserializerProvider */ - public function testDeserialize(array $data, array $expected) + public function testDeserialize(array $data, array $expected) : void { mkdir($this->tmpDir, 0777, true); file_put_contents($this->tmpFile, json_encode($data)); @@ -145,7 +144,7 @@ public function testDeserialize(array $data, array $expected) rmdir($this->tmpDir); } - public function deserializerProvider() + public function deserializerProvider() : array { return [ 'empty-array' => [ @@ -187,7 +186,7 @@ public function deserializerProvider() ]; } - public function testOldDataWillBeMigratedWhenInCorrectWorkshop() + public function testOldDataWillBeMigratedWhenInCorrectWorkshop() : void { $oldSave = sprintf('%s/.phpschool.json', $this->tmpDir); $newSave = sprintf('%s/.phpschool-save.json', $this->tmpDir); @@ -232,7 +231,7 @@ public function testOldDataWillBeMigratedWhenInCorrectWorkshop() $this->assertEquals($expected, json_decode(file_get_contents($newSave), true)); } - public function testOldDataWillNotBeMigratedWhenNotInCorrectWorkshop() + public function testOldDataWillNotBeMigratedWhenNotInCorrectWorkshop() : void { $oldSave = sprintf('%s/.phpschool.json', $this->tmpDir); $newSave = sprintf('%s/.phpschool-save.json', $this->tmpDir); @@ -271,7 +270,7 @@ public function testOldDataWillNotBeMigratedWhenNotInCorrectWorkshop() unlink($oldSave); } - public function testOldDataWillNotBeMigratedWhenNotInCorrectWorkshopWithOtherWorkshop() + public function testOldDataWillNotBeMigratedWhenNotInCorrectWorkshopWithOtherWorkshop() : void { $oldSave = sprintf('%s/.phpschool.json', $this->tmpDir); $newSave = sprintf('%s/.phpschool-save.json', $this->tmpDir); @@ -326,7 +325,7 @@ public function testOldDataWillNotBeMigratedWhenNotInCorrectWorkshopWithOtherWor unlink($oldSave); } - public function tearDown() + public function tearDown() : void { if (file_exists($this->tmpFile)) { unlink($this->tmpFile); diff --git a/test/UserStateTest.php b/test/UserStateTest.php index 9bbccde3..f600e314 100644 --- a/test/UserStateTest.php +++ b/test/UserStateTest.php @@ -2,7 +2,7 @@ namespace PhpSchool\PhpWorkshopTest; -use PHPUnit_Framework_TestCase; +use PHPUnit\Framework\TestCase; use PhpSchool\PhpWorkshop\UserState; /** @@ -10,9 +10,9 @@ * @package PhpSchool\PhpWorkshopTest * @author Aydin Hassan */ -class UserStateTest extends PHPUnit_Framework_TestCase +class UserStateTest extends TestCase { - public function testWithNoCurrentExercisesOrCompleted() + public function testWithNoCurrentExercisesOrCompleted() : void { $state = new UserState; $this->assertFalse($state->isAssignedExercise()); @@ -20,7 +20,7 @@ public function testWithNoCurrentExercisesOrCompleted() $this->assertNull($state->getCurrentExercise()); } - public function testWithCurrentExerciseButNoCompleted() + public function testWithCurrentExerciseButNoCompleted() : void { $state = new UserState([], 'exercise1'); $this->assertTrue($state->isAssignedExercise()); @@ -28,7 +28,7 @@ public function testWithCurrentExerciseButNoCompleted() $this->assertSame('exercise1', $state->getCurrentExercise()); } - public function testWithCurrentExerciseAndCompleted() + public function testWithCurrentExerciseAndCompleted() : void { $state = new UserState(['exercise1'], 'exercise2'); $this->assertTrue($state->isAssignedExercise()); @@ -36,7 +36,7 @@ public function testWithCurrentExerciseAndCompleted() $this->assertSame('exercise2', $state->getCurrentExercise()); } - public function testWithCompletedExerciseButNoCurrent() + public function testWithCompletedExerciseButNoCurrent() : void { $state = new UserState(['exercise1']); $this->assertFalse($state->isAssignedExercise()); @@ -44,7 +44,7 @@ public function testWithCompletedExerciseButNoCurrent() $this->assertNull($state->getCurrentExercise()); } - public function testAddCompletedExercise() + public function testAddCompletedExercise() : void { $state = new UserState([], 'exercise1'); $this->assertTrue($state->isAssignedExercise()); @@ -57,7 +57,7 @@ public function testAddCompletedExercise() $this->assertSame('exercise1', $state->getCurrentExercise()); } - public function testSetCompletedExercise() + public function testSetCompletedExercise() : void { $state = new UserState(['exercise1']); $this->assertFalse($state->isAssignedExercise()); @@ -70,7 +70,7 @@ public function testSetCompletedExercise() $this->assertSame(['exercise1'], $state->getCompletedExercises()); } - public function testCompletedExercise() + public function testCompletedExercise() : void { $state = new UserState(['exercise1']); $this->assertTrue($state->completedExercise('exercise1')); diff --git a/test/Util/ArrayObjectTest.php b/test/Util/ArrayObjectTest.php index b98e1fd2..43d04a55 100644 --- a/test/Util/ArrayObjectTest.php +++ b/test/Util/ArrayObjectTest.php @@ -3,16 +3,16 @@ namespace PhpSchool\PhpWorkshopTest\Util; use PhpSchool\PhpWorkshop\Utils\ArrayObject; -use PHPUnit_Framework_TestCase; +use PHPUnit\Framework\TestCase; /** * Class ArrayObjectTest * @package PhpSchool\PhpWorkshopTest\Util * @author Aydin Hassan */ -class ArrayObjectTest extends PHPUnit_Framework_TestCase +class ArrayObjectTest extends TestCase { - public function testMap() + public function testMap() : void { $arrayObject = new ArrayObject([1, 2, 3]); $new = $arrayObject->map(function ($elem) { @@ -23,13 +23,13 @@ public function testMap() $this->assertEquals([2, 4, 6], $new->getArrayCopy()); } - public function testImplode() + public function testImplode() : void { $arrayObject = new ArrayObject([1, 2, 3]); $this->assertSame('1 2 3', $arrayObject->implode(' ')); } - public function testPrepend() + public function testPrepend() : void { $arrayObject = new ArrayObject([1, 2, 3]); $new = $arrayObject->prepend(0); @@ -38,7 +38,7 @@ public function testPrepend() $this->assertSame([0, 1, 2, 3], $new->getArrayCopy()); } - public function testAppend() + public function testAppend() : void { $arrayObject = new ArrayObject([1, 2, 3]); $new = $arrayObject->append(4); @@ -47,19 +47,19 @@ public function testAppend() $this->assertSame([1, 2, 3, 4], $new->getArrayCopy()); } - public function testGetIterator() + public function testGetIterator() : void { $arrayObject = new ArrayObject([1, 2, 3]); $this->assertSame([1, 2, 3], iterator_to_array($arrayObject)); } - public function testGetArrayCopy() + public function testGetArrayCopy() : void { $arrayObject = new ArrayObject([1, 2, 3]); $this->assertSame([1, 2, 3], $arrayObject->getArrayCopy()); } - public function testFlatMap() + public function testFlatMap() : void { $arrayObject = new ArrayObject([ ['name' => 'Aydin', 'pets' => ['rat', 'raccoon', 'binturong']], @@ -72,7 +72,7 @@ public function testFlatMap() $this->assertSame(['rat', 'raccoon', 'binturong', 'rabbit', 'squirrel', 'dog'], $new->getArrayCopy()); } - public function testCollapse() + public function testCollapse() : void { $arrayObject = new ArrayObject([[1, 2], [3, 4, 5], [6, 7, 8]]); $new = $arrayObject->collapse(); @@ -86,7 +86,7 @@ public function testCollapse() $this->assertSame([1, 2, 3, 4, 5, 6, 7, 8], $new->getArrayCopy()); } - public function testReduce() + public function testReduce() : void { $arrayObject = new ArrayObject([6, 3, 1]); $total = $arrayObject->reduce(function ($carry, $item) { @@ -96,7 +96,7 @@ public function testReduce() $this->assertEquals(10, $total); } - public function testKeys() + public function testKeys() : void { $arrayObject = new ArrayObject(['one' => 1, 'two' => 2, 'three' => 3]); $new = $arrayObject->keys(); @@ -104,19 +104,19 @@ public function testKeys() $this->assertSame(['one', 'two', 'three'], $new->getArrayCopy()); } - public function testGetReturnsDefaultIfNotSet() + public function testGetReturnsDefaultIfNotSet() : void { $arrayObject = new ArrayObject(['one' => 1, 'two' => 2, 'three' => 3]); $this->assertEquals(4, $arrayObject->get('four', 4)); } - public function testGet() + public function testGet() : void { $arrayObject = new ArrayObject(['one' => 1, 'two' => 2, 'three' => 3]); $this->assertEquals(3, $arrayObject->get('three')); } - public function testSet() + public function testSet() : void { $arrayObject = new ArrayObject([1, 2, 3]); $new = $arrayObject->set(3, 4); @@ -131,7 +131,7 @@ public function testSet() $this->assertSame(['one' => 1, 'two' => 2, 'three' => 4], $new->getArrayCopy()); } - public function testIsEmpty() + public function testIsEmpty() : void { $arrayObject = new ArrayObject([1, 2, 3]); self::assertFalse($arrayObject->isEmpty()); diff --git a/test/Util/RequestRendererTest.php b/test/Util/RequestRendererTest.php index 8b729581..3c6928e4 100644 --- a/test/Util/RequestRendererTest.php +++ b/test/Util/RequestRendererTest.php @@ -11,7 +11,7 @@ */ class RequestRendererTest extends TestCase { - public function testWriteRequestWithHeaders() + public function testWriteRequestWithHeaders() : void { $request = (new Request('http://www.time.com/api/pt?iso=2016-01-21T18:14:33+0000')) ->withMethod('GET'); @@ -23,7 +23,7 @@ public function testWriteRequestWithHeaders() $this->assertEquals($expected, (new RequestRenderer)->renderRequest($request)); } - public function testWriteRequestWithNoHeaders() + public function testWriteRequestWithNoHeaders() : void { $request = (new Request('/endpoint')) ->withMethod('GET'); @@ -34,7 +34,7 @@ public function testWriteRequestWithNoHeaders() $this->assertEquals($expected, (new RequestRenderer)->renderRequest($request)); } - public function testWriteRequestWithPostBodyJson() + public function testWriteRequestWithPostBodyJson() : void { $request = (new Request('/endpoint')) ->withMethod('POST') @@ -55,7 +55,7 @@ public function testWriteRequestWithPostBodyJson() $this->assertEquals($expected, (new RequestRenderer)->renderRequest($request)); } - public function testWriteRequestWithPostBodyUrlEncoded() + public function testWriteRequestWithPostBodyUrlEncoded() : void { $request = (new Request('/endpoint')) ->withMethod('POST') diff --git a/test/res/cgi/get-solution-header.php b/test/res/cgi/get-solution-header.php index e2a9c767..37aae527 100644 --- a/test/res/cgi/get-solution-header.php +++ b/test/res/cgi/get-solution-header.php @@ -1,4 +1,4 @@