From 9a2f81d5532b7ae9391a0e7922b45bbe5ffecb95 Mon Sep 17 00:00:00 2001 From: Gordon Forsythe Date: Sun, 24 May 2020 09:18:29 -0700 Subject: [PATCH 01/11] add secondary pretty printer for phpunit 9 --- src/PrettyPrinterForPhpUnit9.php | 212 +++++++++++++++++++++++++++++++ 1 file changed, 212 insertions(+) create mode 100644 src/PrettyPrinterForPhpUnit9.php diff --git a/src/PrettyPrinterForPhpUnit9.php b/src/PrettyPrinterForPhpUnit9.php new file mode 100644 index 0000000..df6b25b --- /dev/null +++ b/src/PrettyPrinterForPhpUnit9.php @@ -0,0 +1,212 @@ +className = get_class($test); + } + + public function endTest(Test $test, float $time): void + { + parent::endTest($test, $time); + + $testMethodName = \PHPUnit\Util\Test::describe($test); + + // Convert capitalized words to lowercase + $testMethodName[1] = preg_replace_callback('/([A-Z]{2,})/', function ($matches) { return strtolower($matches[0]); }, $testMethodName[1]); + + // Convert non-breaking method name to camelCase + $testMethodName[1] = str_replace(' ', '', ucwords($testMethodName[1], ' ')); + + // Convert snakeCase method name to camelCase + $testMethodName[1] = str_replace('_', '', ucwords($testMethodName[1], '_')); + + preg_match_all('/((?:^|[A-Z])[a-z0-9]+)/', $testMethodName[1], $matches); + + // Prepend all numbers with a space + $replaced = preg_replace('/(\d+)/', ' $1', $matches[0]); + + $testNameArray = array_map('strtolower', $replaced); + + $name = implode(' ', $testNameArray); + + // check if prefix is test remove it + $name = preg_replace('/^test /', '', $name, 1); + + // Get the data set name + $name = $this->handleDataSetName($name, $testMethodName[1]); + + $color = 'fg-green'; + if ($test->getStatus() !== 0) { + $color = 'fg-red'; + } + + $this->write(' '); + + switch ($test->getStatus()) { + case BaseTestRunner::STATUS_PASSED: + $this->writeWithColor('fg-green', $name, false); + + break; + case BaseTestRunner::STATUS_SKIPPED: + $this->writeWithColor('fg-yellow', $name, false); + + break; + case BaseTestRunner::STATUS_INCOMPLETE: + $this->writeWithColor('fg-blue', $name, false); + + break; + case BaseTestRunner::STATUS_FAILURE: + $this->writeWithColor('fg-red', $name, false); + + break; + case BaseTestRunner::STATUS_ERROR: + $this->writeWithColor('fg-red', $name, false); + + break; + case BaseTestRunner::STATUS_RISKY: + $this->writeWithColor('fg-magenta', $name, false); + + break; + case BaseTestRunner::STATUS_WARNING: + $this->writeWithColor('fg-yellow', $name, false); + + break; + case BaseTestRunner::STATUS_UNKNOWN: + default: + $this->writeWithColor('fg-cyan', $name, false); + + break; + } + + $this->write(' '); + + $timeColor = $time > 0.5 ? 'fg-yellow' : 'fg-white'; + $this->writeWithColor($timeColor, '[' . number_format($time, 3) . 's]', true); + } + + protected function writeProgress(string $progress): void + { + if ($this->previousClassName !== $this->className) { + $this->write("\n"); + $this->writeWithColor('bold', $this->className, false); + $this->writeNewLine(); + } + + $this->previousClassName = $this->className; + + $this->printProgress(); + + switch (strtoupper(preg_replace('#\\x1b[[][^A-Za-z]*[A-Za-z]#', '', $progress))) { + case '.': + $this->writeWithColor('fg-green', ' ✓', false); + + break; + case 'S': + $this->writeWithColor('fg-yellow', ' →', false); + + break; + case 'I': + $this->writeWithColor('fg-blue', ' ∅', false); + + break; + case 'F': + $this->writeWithColor('fg-red', ' x', false); + + break; + case 'E': + $this->writeWithColor('fg-red', ' ⚈', false); + + break; + case 'R': + $this->writeWithColor('fg-magenta', ' ⌽', false); + + break; + case 'W': + $this->writeWithColor('fg-yellow', ' ¤', false); + + break; + default: + $this->writeWithColor('fg-cyan', ' ≈', false); + + break; + } + } + + protected function printDefectTrace(TestFailure $defect): void + { + $this->write($this->formatExceptionMsg($defect->getExceptionAsString())); + $trace = Filter::getFilteredStacktrace( + $defect->thrownException() + ); + if (!empty($trace)) { + $this->write("\n" . $trace); + } + $exception = $defect->thrownException()->getPrevious(); + while ($exception) { + $this->write( + "\nCaused by\n" . + TestFailure::exceptionToString($exception) . "\n" . + Filter::getFilteredStacktrace($exception) + ); + $exception = $exception->getPrevious(); + } + } + + protected function formatExceptionMsg($exceptionMessage): string + { + $exceptionMessage = str_replace("+++ Actual\n", '', $exceptionMessage); + $exceptionMessage = str_replace("--- Expected\n", '', $exceptionMessage); + $exceptionMessage = str_replace('@@ @@', '', $exceptionMessage); + + if ($this->colors) { + $exceptionMessage = preg_replace('/^(Exception.*)$/m', "\033[01;31m$1\033[0m", $exceptionMessage); + $exceptionMessage = preg_replace('/(Failed.*)$/m', "\033[01;31m$1\033[0m", $exceptionMessage); + $exceptionMessage = preg_replace("/(\-+.*)$/m", "\033[01;32m$1\033[0m", $exceptionMessage); + $exceptionMessage = preg_replace("/(\++.*)$/m", "\033[01;31m$1\033[0m", $exceptionMessage); + } + + return $exceptionMessage; + } + + private function handleDataSetName($name, $testMethodName): string + { + preg_match('/\bwith data set "([^"]+)"/', $testMethodName, $dataSetMatch); + + if (empty($dataSetMatch)) { + return $name; + } + + return $name . ' [' . $dataSetMatch[1] . ']'; + } + + private function printProgress() + { + if (filter_var(getenv('PHPUNIT_PRETTY_PRINT_PROGRESS'), FILTER_VALIDATE_BOOLEAN)) { + $this->numTestsRun++; + + $total = $this->numTests; + $current = str_pad($this->numTestsRun, strlen($total), '0', STR_PAD_LEFT); + + $this->write("[{$current}/{$total}]"); + } + } +} From cf19b9878e80a4f8b7d25f7de6fe24f0af4f037b Mon Sep 17 00:00:00 2001 From: Gordon Forsythe Date: Sun, 24 May 2020 09:20:52 -0700 Subject: [PATCH 02/11] update dependencies for phpunit 9 --- composer.json | 2 +- composer.lock | 725 +++++++++++++++++++++++++++++++------------------- 2 files changed, 450 insertions(+), 277 deletions(-) diff --git a/composer.json b/composer.json index 6b6de43..391feaf 100644 --- a/composer.json +++ b/composer.json @@ -8,7 +8,7 @@ "prefer-stable": true, "require": { "php": ">=7.1.0", - "phpunit/phpunit": ">=7.0.0 <9.0.0" + "phpunit/phpunit": ">=7.0.0 ^9.0.0" }, "autoload": { "psr-4": { diff --git a/composer.lock b/composer.lock index d1b0cec..9f8be45 100644 --- a/composer.lock +++ b/composer.lock @@ -4,20 +4,20 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "d0d4ccee57029a6b685d73c5d9732881", + "content-hash": "40708f6c740c1edc7b168a4a3b7f95bd", "packages": [ { "name": "doctrine/instantiator", - "version": "1.2.0", + "version": "1.3.0", "source": { "type": "git", "url": "https://github.com/doctrine/instantiator.git", - "reference": "a2c590166b2133a4633738648b6b064edae0814a" + "reference": "ae466f726242e637cebdd526a7d991b9433bacf1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/a2c590166b2133a4633738648b6b064edae0814a", - "reference": "a2c590166b2133a4633738648b6b064edae0814a", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/ae466f726242e637cebdd526a7d991b9433bacf1", + "reference": "ae466f726242e637cebdd526a7d991b9433bacf1", "shasum": "" }, "require": { @@ -60,20 +60,20 @@ "constructor", "instantiate" ], - "time": "2019-03-17T17:37:11+00:00" + "time": "2019-10-21T16:45:58+00:00" }, { "name": "myclabs/deep-copy", - "version": "1.9.1", + "version": "1.9.5", "source": { "type": "git", "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "e6828efaba2c9b79f4499dae1d66ef8bfa7b2b72" + "reference": "b2c28789e80a97badd14145fda39b545d83ca3ef" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/e6828efaba2c9b79f4499dae1d66ef8bfa7b2b72", - "reference": "e6828efaba2c9b79f4499dae1d66ef8bfa7b2b72", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/b2c28789e80a97badd14145fda39b545d83ca3ef", + "reference": "b2c28789e80a97badd14145fda39b545d83ca3ef", "shasum": "" }, "require": { @@ -108,7 +108,7 @@ "object", "object graph" ], - "time": "2019-04-07T13:18:21+00:00" + "time": "2020-01-17T21:11:47+00:00" }, { "name": "phar-io/manifest", @@ -214,35 +214,30 @@ }, { "name": "phpdocumentor/reflection-common", - "version": "1.0.1", + "version": "2.1.0", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionCommon.git", - "reference": "21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6" + "reference": "6568f4687e5b41b054365f9ae03fcb1ed5f2069b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6", - "reference": "21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/6568f4687e5b41b054365f9ae03fcb1ed5f2069b", + "reference": "6568f4687e5b41b054365f9ae03fcb1ed5f2069b", "shasum": "" }, "require": { - "php": ">=5.5" - }, - "require-dev": { - "phpunit/phpunit": "^4.6" + "php": ">=7.1" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "2.x-dev" } }, "autoload": { "psr-4": { - "phpDocumentor\\Reflection\\": [ - "src" - ] + "phpDocumentor\\Reflection\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -264,44 +259,42 @@ "reflection", "static analysis" ], - "time": "2017-09-11T18:02:19+00:00" + "time": "2020-04-27T09:25:28+00:00" }, { "name": "phpdocumentor/reflection-docblock", - "version": "4.3.1", + "version": "5.1.0", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "bdd9f737ebc2a01c06ea7ff4308ec6697db9b53c" + "reference": "cd72d394ca794d3466a3b2fc09d5a6c1dc86b47e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/bdd9f737ebc2a01c06ea7ff4308ec6697db9b53c", - "reference": "bdd9f737ebc2a01c06ea7ff4308ec6697db9b53c", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/cd72d394ca794d3466a3b2fc09d5a6c1dc86b47e", + "reference": "cd72d394ca794d3466a3b2fc09d5a6c1dc86b47e", "shasum": "" }, "require": { - "php": "^7.0", - "phpdocumentor/reflection-common": "^1.0.0", - "phpdocumentor/type-resolver": "^0.4.0", - "webmozart/assert": "^1.0" + "ext-filter": "^7.1", + "php": "^7.2", + "phpdocumentor/reflection-common": "^2.0", + "phpdocumentor/type-resolver": "^1.0", + "webmozart/assert": "^1" }, "require-dev": { - "doctrine/instantiator": "~1.0.5", - "mockery/mockery": "^1.0", - "phpunit/phpunit": "^6.4" + "doctrine/instantiator": "^1", + "mockery/mockery": "^1" }, "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/", @@ -312,44 +305,46 @@ { "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": "2019-04-30T17:48:53+00:00" + "time": "2020-02-22T12:28:44+00:00" }, { "name": "phpdocumentor/type-resolver", - "version": "0.4.0", + "version": "1.1.0", "source": { "type": "git", "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "9c977708995954784726e25d0cd1dddf4e65b0f7" + "reference": "7462d5f123dfc080dfdf26897032a6513644fc95" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/9c977708995954784726e25d0cd1dddf4e65b0f7", - "reference": "9c977708995954784726e25d0cd1dddf4e65b0f7", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/7462d5f123dfc080dfdf26897032a6513644fc95", + "reference": "7462d5f123dfc080dfdf26897032a6513644fc95", "shasum": "" }, "require": { - "php": "^5.5 || ^7.0", - "phpdocumentor/reflection-common": "^1.0" + "php": "^7.2", + "phpdocumentor/reflection-common": "^2.0" }, "require-dev": { - "mockery/mockery": "^0.9.4", - "phpunit/phpunit": "^5.2||^4.8.24" + "ext-tokenizer": "^7.2", + "mockery/mockery": "~1" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "1.x-dev" } }, "autoload": { "psr-4": { - "phpDocumentor\\Reflection\\": [ - "src/" - ] + "phpDocumentor\\Reflection\\": "src" } }, "notification-url": "https://packagist.org/downloads/", @@ -362,37 +357,38 @@ "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-02-18T18:59:58+00:00" }, { "name": "phpspec/prophecy", - "version": "1.8.1", + "version": "v1.10.3", "source": { "type": "git", "url": "https://github.com/phpspec/prophecy.git", - "reference": "1927e75f4ed19131ec9bcc3b002e07fb1173ee76" + "reference": "451c3cd1418cf640de218914901e51b064abb093" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/1927e75f4ed19131ec9bcc3b002e07fb1173ee76", - "reference": "1927e75f4ed19131ec9bcc3b002e07fb1173ee76", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/451c3cd1418cf640de218914901e51b064abb093", + "reference": "451c3cd1418cf640de218914901e51b064abb093", "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|^3.0", - "sebastian/recursion-context": "^1.0|^2.0|^3.0" + "phpdocumentor/reflection-docblock": "^2.0|^3.0.2|^4.0|^5.0", + "sebastian/comparator": "^1.2.3|^2.0|^3.0|^4.0", + "sebastian/recursion-context": "^1.0|^2.0|^3.0|^4.0" }, "require-dev": { - "phpspec/phpspec": "^2.5|^3.2", + "phpspec/phpspec": "^2.5 || ^3.2", "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.5 || ^7.1" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.8.x-dev" + "dev-master": "1.10.x-dev" } }, "autoload": { @@ -425,44 +421,45 @@ "spy", "stub" ], - "time": "2019-06-13T12:50:23+00:00" + "time": "2020-03-05T15:02:03+00:00" }, { "name": "phpunit/php-code-coverage", - "version": "7.0.6", + "version": "8.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "d471d0d2b529a67c6a722dd446c4ec90881ac315" + "reference": "ca6647ffddd2add025ab3f21644a441d7c146cdc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/d471d0d2b529a67c6a722dd446c4ec90881ac315", - "reference": "d471d0d2b529a67c6a722dd446c4ec90881ac315", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/ca6647ffddd2add025ab3f21644a441d7c146cdc", + "reference": "ca6647ffddd2add025ab3f21644a441d7c146cdc", "shasum": "" }, "require": { "ext-dom": "*", "ext-xmlwriter": "*", - "php": "^7.2", - "phpunit/php-file-iterator": "^2.0.2", - "phpunit/php-text-template": "^1.2.1", - "phpunit/php-token-stream": "^3.0.2", - "sebastian/code-unit-reverse-lookup": "^1.0.1", - "sebastian/environment": "^4.2.2", - "sebastian/version": "^2.0.1", + "php": "^7.3", + "phpunit/php-file-iterator": "^3.0", + "phpunit/php-text-template": "^2.0", + "phpunit/php-token-stream": "^4.0", + "sebastian/code-unit-reverse-lookup": "^2.0", + "sebastian/environment": "^5.0", + "sebastian/version": "^3.0", "theseer/tokenizer": "^1.1.3" }, "require-dev": { - "phpunit/phpunit": "^8.2.2" + "phpunit/phpunit": "^9.0" }, "suggest": { - "ext-xdebug": "^2.7.2" + "ext-pcov": "*", + "ext-xdebug": "*" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "7.0-dev" + "dev-master": "8.0-dev" } }, "autoload": { @@ -488,32 +485,38 @@ "testing", "xunit" ], - "time": "2019-07-08T05:29:42+00:00" + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-05-23T08:02:54+00:00" }, { "name": "phpunit/php-file-iterator", - "version": "2.0.2", + "version": "3.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "050bedf145a257b1ff02746c31894800e5122946" + "reference": "4ac5b3e13df14829daa60a2eb4fdd2f2b7d33cf4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/050bedf145a257b1ff02746c31894800e5122946", - "reference": "050bedf145a257b1ff02746c31894800e5122946", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/4ac5b3e13df14829daa60a2eb4fdd2f2b7d33cf4", + "reference": "4ac5b3e13df14829daa60a2eb4fdd2f2b7d33cf4", "shasum": "" }, "require": { - "php": "^7.1" + "php": "^7.3" }, "require-dev": { - "phpunit/phpunit": "^7.1" + "phpunit/phpunit": "^9.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0.x-dev" + "dev-master": "3.0-dev" } }, "autoload": { @@ -538,26 +541,90 @@ "filesystem", "iterator" ], - "time": "2018-09-13T20:33:42+00:00" + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-04-18T05:02:12+00:00" + }, + { + "name": "phpunit/php-invoker", + "version": "3.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-invoker.git", + "reference": "7579d5a1ba7f3ac11c80004d205877911315ae7a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-invoker/zipball/7579d5a1ba7f3ac11c80004d205877911315ae7a", + "reference": "7579d5a1ba7f3ac11c80004d205877911315ae7a", + "shasum": "" + }, + "require": { + "php": "^7.3" + }, + "require-dev": { + "ext-pcntl": "*", + "phpunit/phpunit": "^9.0" + }, + "suggest": { + "ext-pcntl": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Invoke callables with a timeout", + "homepage": "https://github.com/sebastianbergmann/php-invoker/", + "keywords": [ + "process" + ], + "time": "2020-02-07T06:06:11+00:00" }, { "name": "phpunit/php-text-template", - "version": "1.2.1", + "version": "2.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-text-template.git", - "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686" + "reference": "526dc996cc0ebdfa428cd2dfccd79b7b53fee346" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/31f8b717e51d9a2afca6c9f046f5d69fc27c8686", - "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686", + "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/526dc996cc0ebdfa428cd2dfccd79b7b53fee346", + "reference": "526dc996cc0ebdfa428cd2dfccd79b7b53fee346", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": "^7.3" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" + } + }, "autoload": { "classmap": [ "src/" @@ -579,32 +646,32 @@ "keywords": [ "template" ], - "time": "2015-06-21T13:50:34+00:00" + "time": "2020-02-01T07:43:44+00:00" }, { "name": "phpunit/php-timer", - "version": "2.1.2", + "version": "3.1.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-timer.git", - "reference": "1038454804406b0b5f5f520358e78c1c2f71501e" + "reference": "dc9368fae6ef2ffa57eba80a7410bcef81df6258" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/1038454804406b0b5f5f520358e78c1c2f71501e", - "reference": "1038454804406b0b5f5f520358e78c1c2f71501e", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/dc9368fae6ef2ffa57eba80a7410bcef81df6258", + "reference": "dc9368fae6ef2ffa57eba80a7410bcef81df6258", "shasum": "" }, "require": { - "php": "^7.1" + "php": "^7.3" }, "require-dev": { - "phpunit/phpunit": "^7.0" + "phpunit/phpunit": "^9.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.1-dev" + "dev-master": "3.1-dev" } }, "autoload": { @@ -628,33 +695,39 @@ "keywords": [ "timer" ], - "time": "2019-06-07T04:22:29+00:00" + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-04-20T06:00:37+00:00" }, { "name": "phpunit/php-token-stream", - "version": "3.0.2", + "version": "4.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-token-stream.git", - "reference": "c4a66b97f040e3e20b3aa2a243230a1c3a9f7c8c" + "reference": "cdc0db5aed8fbfaf475fbd95bfd7bab83c7a779c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/c4a66b97f040e3e20b3aa2a243230a1c3a9f7c8c", - "reference": "c4a66b97f040e3e20b3aa2a243230a1c3a9f7c8c", + "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/cdc0db5aed8fbfaf475fbd95bfd7bab83c7a779c", + "reference": "cdc0db5aed8fbfaf475fbd95bfd7bab83c7a779c", "shasum": "" }, "require": { "ext-tokenizer": "*", - "php": "^7.1" + "php": "^7.3" }, "require-dev": { - "phpunit/phpunit": "^7.0" + "phpunit/phpunit": "^9.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0-dev" + "dev-master": "4.0-dev" } }, "autoload": { @@ -677,20 +750,26 @@ "keywords": [ "tokenizer" ], - "time": "2019-07-08T05:24:54+00:00" + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-05-06T09:56:31+00:00" }, { "name": "phpunit/phpunit", - "version": "8.2.5", + "version": "9.1.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "c1b8534b3730f20f58600124129197bf1183dc92" + "reference": "1b570cd7edbe136055bf5f651857dc8af6b829d2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/c1b8534b3730f20f58600124129197bf1183dc92", - "reference": "c1b8534b3730f20f58600124129197bf1183dc92", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/1b570cd7edbe136055bf5f651857dc8af6b829d2", + "reference": "1b570cd7edbe136055bf5f651857dc8af6b829d2", "shasum": "" }, "require": { @@ -704,29 +783,31 @@ "myclabs/deep-copy": "^1.9.1", "phar-io/manifest": "^1.0.3", "phar-io/version": "^2.0.1", - "php": "^7.2", + "php": "^7.3", "phpspec/prophecy": "^1.8.1", - "phpunit/php-code-coverage": "^7.0.5", - "phpunit/php-file-iterator": "^2.0.2", - "phpunit/php-text-template": "^1.2.1", - "phpunit/php-timer": "^2.1.2", - "sebastian/comparator": "^3.0.2", - "sebastian/diff": "^3.0.2", - "sebastian/environment": "^4.2.2", - "sebastian/exporter": "^3.1.0", - "sebastian/global-state": "^3.0.0", - "sebastian/object-enumerator": "^3.0.3", - "sebastian/resource-operations": "^2.0.1", - "sebastian/type": "^1.1.3", - "sebastian/version": "^2.0.1" + "phpunit/php-code-coverage": "^8.0.1", + "phpunit/php-file-iterator": "^3.0", + "phpunit/php-invoker": "^3.0", + "phpunit/php-text-template": "^2.0", + "phpunit/php-timer": "^3.1.4", + "sebastian/code-unit": "^1.0.2", + "sebastian/comparator": "^4.0", + "sebastian/diff": "^4.0", + "sebastian/environment": "^5.0.1", + "sebastian/exporter": "^4.0", + "sebastian/global-state": "^4.0", + "sebastian/object-enumerator": "^4.0", + "sebastian/resource-operations": "^3.0", + "sebastian/type": "^2.0", + "sebastian/version": "^3.0" }, "require-dev": { - "ext-pdo": "*" + "ext-pdo": "*", + "phpspec/prophecy-phpunit": "^2.0" }, "suggest": { "ext-soap": "*", - "ext-xdebug": "*", - "phpunit/php-invoker": "^2.0.0" + "ext-xdebug": "*" }, "bin": [ "phpunit" @@ -734,12 +815,15 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "8.2-dev" + "dev-master": "9.1-dev" } }, "autoload": { "classmap": [ "src/" + ], + "files": [ + "src/Framework/Assert/Functions.php" ] }, "notification-url": "https://packagist.org/downloads/", @@ -760,32 +844,94 @@ "testing", "xunit" ], - "time": "2019-07-15T06:26:24+00:00" + "funding": [ + { + "url": "https://phpunit.de/donate.html", + "type": "custom" + }, + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-05-22T13:54:05+00:00" + }, + { + "name": "sebastian/code-unit", + "version": "1.0.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/code-unit.git", + "reference": "ac958085bc19fcd1d36425c781ef4cbb5b06e2a5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit/zipball/ac958085bc19fcd1d36425c781ef4cbb5b06e2a5", + "reference": "ac958085bc19fcd1d36425c781ef4cbb5b06e2a5", + "shasum": "" + }, + "require": { + "php": "^7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Collection of value objects that represent the PHP code units", + "homepage": "https://github.com/sebastianbergmann/code-unit", + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-04-30T05:58:10+00:00" }, { "name": "sebastian/code-unit-reverse-lookup", - "version": "1.0.1", + "version": "2.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", - "reference": "4419fcdb5eabb9caa61a27c7a1db532a6b55dd18" + "reference": "5b5dbe0044085ac41df47e79d34911a15b96d82e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/4419fcdb5eabb9caa61a27c7a1db532a6b55dd18", - "reference": "4419fcdb5eabb9caa61a27c7a1db532a6b55dd18", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/5b5dbe0044085ac41df47e79d34911a15b96d82e", + "reference": "5b5dbe0044085ac41df47e79d34911a15b96d82e", "shasum": "" }, "require": { - "php": "^5.6 || ^7.0" + "php": "^7.3" }, "require-dev": { - "phpunit/phpunit": "^5.7 || ^6.0" + "phpunit/phpunit": "^9.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "2.0-dev" } }, "autoload": { @@ -805,34 +951,34 @@ ], "description": "Looks up which function or method a line of code belongs to", "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", - "time": "2017-03-04T06:30:41+00:00" + "time": "2020-02-07T06:20:13+00:00" }, { "name": "sebastian/comparator", - "version": "3.0.2", + "version": "4.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "5de4fc177adf9bce8df98d8d141a7559d7ccf6da" + "reference": "85b3435da967696ed618ff745f32be3ff4a2b8e8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/5de4fc177adf9bce8df98d8d141a7559d7ccf6da", - "reference": "5de4fc177adf9bce8df98d8d141a7559d7ccf6da", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/85b3435da967696ed618ff745f32be3ff4a2b8e8", + "reference": "85b3435da967696ed618ff745f32be3ff4a2b8e8", "shasum": "" }, "require": { - "php": "^7.1", - "sebastian/diff": "^3.0", - "sebastian/exporter": "^3.1" + "php": "^7.3", + "sebastian/diff": "^4.0", + "sebastian/exporter": "^4.0" }, "require-dev": { - "phpunit/phpunit": "^7.1" + "phpunit/phpunit": "^9.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0-dev" + "dev-master": "4.0-dev" } }, "autoload": { @@ -845,6 +991,10 @@ "BSD-3-Clause" ], "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, { "name": "Jeff Welch", "email": "whatthejeff@gmail.com" @@ -856,10 +1006,6 @@ { "name": "Bernhard Schussek", "email": "bschussek@2bepublished.at" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" } ], "description": "Provides the functionality to compare PHP values for equality", @@ -869,33 +1015,33 @@ "compare", "equality" ], - "time": "2018-07-12T15:12:46+00:00" + "time": "2020-02-07T06:08:51+00:00" }, { "name": "sebastian/diff", - "version": "3.0.2", + "version": "4.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "720fcc7e9b5cf384ea68d9d930d480907a0c1a29" + "reference": "3e523c576f29dacecff309f35e4cc5a5c168e78a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/720fcc7e9b5cf384ea68d9d930d480907a0c1a29", - "reference": "720fcc7e9b5cf384ea68d9d930d480907a0c1a29", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/3e523c576f29dacecff309f35e4cc5a5c168e78a", + "reference": "3e523c576f29dacecff309f35e4cc5a5c168e78a", "shasum": "" }, "require": { - "php": "^7.1" + "php": "^7.3" }, "require-dev": { - "phpunit/phpunit": "^7.5 || ^8.0", - "symfony/process": "^2 || ^3.3 || ^4" + "phpunit/phpunit": "^9.0", + "symfony/process": "^4.2 || ^5" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0-dev" + "dev-master": "4.0-dev" } }, "autoload": { @@ -908,13 +1054,13 @@ "BSD-3-Clause" ], "authors": [ - { - "name": "Kore Nordmann", - "email": "mail@kore-nordmann.de" - }, { "name": "Sebastian Bergmann", "email": "sebastian@phpunit.de" + }, + { + "name": "Kore Nordmann", + "email": "mail@kore-nordmann.de" } ], "description": "Diff implementation", @@ -925,27 +1071,33 @@ "unidiff", "unified diff" ], - "time": "2019-02-04T06:01:07+00:00" + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-05-08T05:01:12+00:00" }, { "name": "sebastian/environment", - "version": "4.2.2", + "version": "5.1.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "f2a2c8e1c97c11ace607a7a667d73d47c19fe404" + "reference": "c753f04d68cd489b6973cf9b4e505e191af3b05c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/f2a2c8e1c97c11ace607a7a667d73d47c19fe404", - "reference": "f2a2c8e1c97c11ace607a7a667d73d47c19fe404", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/c753f04d68cd489b6973cf9b4e505e191af3b05c", + "reference": "c753f04d68cd489b6973cf9b4e505e191af3b05c", "shasum": "" }, "require": { - "php": "^7.1" + "php": "^7.3" }, "require-dev": { - "phpunit/phpunit": "^7.5" + "phpunit/phpunit": "^9.0" }, "suggest": { "ext-posix": "*" @@ -953,7 +1105,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.2-dev" + "dev-master": "5.0-dev" } }, "autoload": { @@ -978,34 +1130,40 @@ "environment", "hhvm" ], - "time": "2019-05-05T09:05:15+00:00" + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-04-14T13:36:52+00:00" }, { "name": "sebastian/exporter", - "version": "3.1.0", + "version": "4.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "234199f4528de6d12aaa58b612e98f7d36adb937" + "reference": "80c26562e964016538f832f305b2286e1ec29566" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/234199f4528de6d12aaa58b612e98f7d36adb937", - "reference": "234199f4528de6d12aaa58b612e98f7d36adb937", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/80c26562e964016538f832f305b2286e1ec29566", + "reference": "80c26562e964016538f832f305b2286e1ec29566", "shasum": "" }, "require": { - "php": "^7.0", - "sebastian/recursion-context": "^3.0" + "php": "^7.3", + "sebastian/recursion-context": "^4.0" }, "require-dev": { "ext-mbstring": "*", - "phpunit/phpunit": "^6.0" + "phpunit/phpunit": "^9.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.1.x-dev" + "dev-master": "4.0-dev" } }, "autoload": { @@ -1018,6 +1176,10 @@ "BSD-3-Clause" ], "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, { "name": "Jeff Welch", "email": "whatthejeff@gmail.com" @@ -1026,17 +1188,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", @@ -1045,30 +1203,30 @@ "export", "exporter" ], - "time": "2017-04-03T13:19:02+00:00" + "time": "2020-02-07T06:10:52+00:00" }, { "name": "sebastian/global-state", - "version": "3.0.0", + "version": "4.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "edf8a461cf1d4005f19fb0b6b8b95a9f7fa0adc4" + "reference": "bdb1e7c79e592b8c82cb1699be3c8743119b8a72" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/edf8a461cf1d4005f19fb0b6b8b95a9f7fa0adc4", - "reference": "edf8a461cf1d4005f19fb0b6b8b95a9f7fa0adc4", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/bdb1e7c79e592b8c82cb1699be3c8743119b8a72", + "reference": "bdb1e7c79e592b8c82cb1699be3c8743119b8a72", "shasum": "" }, "require": { - "php": "^7.2", - "sebastian/object-reflector": "^1.1.1", - "sebastian/recursion-context": "^3.0" + "php": "^7.3", + "sebastian/object-reflector": "^2.0", + "sebastian/recursion-context": "^4.0" }, "require-dev": { "ext-dom": "*", - "phpunit/phpunit": "^8.0" + "phpunit/phpunit": "^9.0" }, "suggest": { "ext-uopz": "*" @@ -1076,7 +1234,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0-dev" + "dev-master": "4.0-dev" } }, "autoload": { @@ -1099,34 +1257,34 @@ "keywords": [ "global state" ], - "time": "2019-02-01T05:30:01+00:00" + "time": "2020-02-07T06:11:37+00:00" }, { "name": "sebastian/object-enumerator", - "version": "3.0.3", + "version": "4.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/object-enumerator.git", - "reference": "7cfd9e65d11ffb5af41198476395774d4c8a84c5" + "reference": "e67516b175550abad905dc952f43285957ef4363" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/7cfd9e65d11ffb5af41198476395774d4c8a84c5", - "reference": "7cfd9e65d11ffb5af41198476395774d4c8a84c5", + "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/e67516b175550abad905dc952f43285957ef4363", + "reference": "e67516b175550abad905dc952f43285957ef4363", "shasum": "" }, "require": { - "php": "^7.0", - "sebastian/object-reflector": "^1.1.1", - "sebastian/recursion-context": "^3.0" + "php": "^7.3", + "sebastian/object-reflector": "^2.0", + "sebastian/recursion-context": "^4.0" }, "require-dev": { - "phpunit/phpunit": "^6.0" + "phpunit/phpunit": "^9.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0.x-dev" + "dev-master": "4.0-dev" } }, "autoload": { @@ -1146,32 +1304,32 @@ ], "description": "Traverses array structures and object graphs to enumerate all referenced objects", "homepage": "https://github.com/sebastianbergmann/object-enumerator/", - "time": "2017-08-03T12:35:26+00:00" + "time": "2020-02-07T06:12:23+00:00" }, { "name": "sebastian/object-reflector", - "version": "1.1.1", + "version": "2.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/object-reflector.git", - "reference": "773f97c67f28de00d397be301821b06708fca0be" + "reference": "f4fd0835cabb0d4a6546d9fe291e5740037aa1e7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/773f97c67f28de00d397be301821b06708fca0be", - "reference": "773f97c67f28de00d397be301821b06708fca0be", + "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/f4fd0835cabb0d4a6546d9fe291e5740037aa1e7", + "reference": "f4fd0835cabb0d4a6546d9fe291e5740037aa1e7", "shasum": "" }, "require": { - "php": "^7.0" + "php": "^7.3" }, "require-dev": { - "phpunit/phpunit": "^6.0" + "phpunit/phpunit": "^9.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.1-dev" + "dev-master": "2.0-dev" } }, "autoload": { @@ -1191,32 +1349,32 @@ ], "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" + "time": "2020-02-07T06:19:40+00:00" }, { "name": "sebastian/recursion-context", - "version": "3.0.0", + "version": "4.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/recursion-context.git", - "reference": "5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8" + "reference": "cdd86616411fc3062368b720b0425de10bd3d579" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8", - "reference": "5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/cdd86616411fc3062368b720b0425de10bd3d579", + "reference": "cdd86616411fc3062368b720b0425de10bd3d579", "shasum": "" }, "require": { - "php": "^7.0" + "php": "^7.3" }, "require-dev": { - "phpunit/phpunit": "^6.0" + "phpunit/phpunit": "^9.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0.x-dev" + "dev-master": "4.0-dev" } }, "autoload": { @@ -1229,14 +1387,14 @@ "BSD-3-Clause" ], "authors": [ - { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, { "name": "Sebastian Bergmann", "email": "sebastian@phpunit.de" }, + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, { "name": "Adam Harvey", "email": "aharvey@php.net" @@ -1244,29 +1402,32 @@ ], "description": "Provides functionality to recursively process PHP variables", "homepage": "http://www.github.com/sebastianbergmann/recursion-context", - "time": "2017-03-03T06:23:57+00:00" + "time": "2020-02-07T06:18:20+00:00" }, { "name": "sebastian/resource-operations", - "version": "2.0.1", + "version": "3.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/resource-operations.git", - "reference": "4d7a795d35b889bf80a0cc04e08d77cedfa917a9" + "reference": "8c98bf0dfa1f9256d0468b9803a1e1df31b6fa98" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/4d7a795d35b889bf80a0cc04e08d77cedfa917a9", - "reference": "4d7a795d35b889bf80a0cc04e08d77cedfa917a9", + "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/8c98bf0dfa1f9256d0468b9803a1e1df31b6fa98", + "reference": "8c98bf0dfa1f9256d0468b9803a1e1df31b6fa98", "shasum": "" }, "require": { - "php": "^7.1" + "php": "^7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0-dev" + "dev-master": "3.0-dev" } }, "autoload": { @@ -1286,32 +1447,32 @@ ], "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" + "time": "2020-02-07T06:13:02+00:00" }, { "name": "sebastian/type", - "version": "1.1.3", + "version": "2.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/type.git", - "reference": "3aaaa15fa71d27650d62a948be022fe3b48541a3" + "reference": "9e8f42f740afdea51f5f4e8cec2035580e797ee1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/3aaaa15fa71d27650d62a948be022fe3b48541a3", - "reference": "3aaaa15fa71d27650d62a948be022fe3b48541a3", + "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/9e8f42f740afdea51f5f4e8cec2035580e797ee1", + "reference": "9e8f42f740afdea51f5f4e8cec2035580e797ee1", "shasum": "" }, "require": { - "php": "^7.2" + "php": "^7.3" }, "require-dev": { - "phpunit/phpunit": "^8.2" + "phpunit/phpunit": "^9.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.1-dev" + "dev-master": "2.0-dev" } }, "autoload": { @@ -1332,29 +1493,29 @@ ], "description": "Collection of value objects that represent the types of the PHP type system", "homepage": "https://github.com/sebastianbergmann/type", - "time": "2019-07-02T08:10:15+00:00" + "time": "2020-02-07T06:13:43+00:00" }, { "name": "sebastian/version", - "version": "2.0.1", + "version": "3.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/version.git", - "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019" + "reference": "0411bde656dce64202b39c2f4473993a9081d39e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/99732be0ddb3361e16ad77b68ba41efc8e979019", - "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019", + "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/0411bde656dce64202b39c2f4473993a9081d39e", + "reference": "0411bde656dce64202b39c2f4473993a9081d39e", "shasum": "" }, "require": { - "php": ">=5.6" + "php": "^7.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0.x-dev" + "dev-master": "3.0-dev" } }, "autoload": { @@ -1375,20 +1536,20 @@ ], "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" + "time": "2020-01-21T06:36:37+00:00" }, { "name": "symfony/polyfill-ctype", - "version": "v1.11.0", + "version": "v1.17.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "82ebae02209c21113908c229e9883c419720738a" + "reference": "e94c8b1bbe2bc77507a1056cdb06451c75b427f9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/82ebae02209c21113908c229e9883c419720738a", - "reference": "82ebae02209c21113908c229e9883c419720738a", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/e94c8b1bbe2bc77507a1056cdb06451c75b427f9", + "reference": "e94c8b1bbe2bc77507a1056cdb06451c75b427f9", "shasum": "" }, "require": { @@ -1400,7 +1561,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.11-dev" + "dev-master": "1.17-dev" } }, "autoload": { @@ -1416,13 +1577,13 @@ "MIT" ], "authors": [ - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - }, { "name": "Gert de Pagter", "email": "BackEndTea@gmail.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" } ], "description": "Symfony polyfill for ctype functions", @@ -1433,7 +1594,21 @@ "polyfill", "portable" ], - "time": "2019-02-06T07:57:58+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-05-12T16:14:59+00:00" }, { "name": "theseer/tokenizer", @@ -1477,32 +1652,29 @@ }, { "name": "webmozart/assert", - "version": "1.4.0", + "version": "1.8.0", "source": { "type": "git", "url": "https://github.com/webmozart/assert.git", - "reference": "83e253c8e0be5b0257b881e1827274667c5c17a9" + "reference": "ab2cb0b3b559010b75981b1bdce728da3ee90ad6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/webmozart/assert/zipball/83e253c8e0be5b0257b881e1827274667c5c17a9", - "reference": "83e253c8e0be5b0257b881e1827274667c5c17a9", + "url": "https://api.github.com/repos/webmozart/assert/zipball/ab2cb0b3b559010b75981b1bdce728da3ee90ad6", + "reference": "ab2cb0b3b559010b75981b1bdce728da3ee90ad6", "shasum": "" }, "require": { "php": "^5.3.3 || ^7.0", "symfony/polyfill-ctype": "^1.8" }, + "conflict": { + "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/" @@ -1524,7 +1696,7 @@ "check", "validate" ], - "time": "2018-12-25T11:19:39+00:00" + "time": "2020-04-18T12:12:48+00:00" } ], "packages-dev": [ @@ -2795,5 +2967,6 @@ "platform": { "php": ">=7.1.0" }, - "platform-dev": [] + "platform-dev": [], + "plugin-api-version": "1.1.0" } From 8857660c552eb9e8ba0f67b485473c2a41b54763 Mon Sep 17 00:00:00 2001 From: Gordon Forsythe Date: Sun, 24 May 2020 09:21:13 -0700 Subject: [PATCH 03/11] update phpunit xml for phpunit 9 --- phpunit.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpunit.xml b/phpunit.xml index c173089..94935fe 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -3,7 +3,7 @@ backupStaticAttributes="false" bootstrap="vendor/autoload.php" colors="true" - printerClass="Sempro\PHPUnitPrettyPrinter\PrettyPrinter" + printerClass="Sempro\PHPUnitPrettyPrinter\PrettyPrinterForPhpUnit9" convertErrorsToExceptions="true" convertNoticesToExceptions="true" convertWarningsToExceptions="true" From 9299f288c17a4bc4b381a782f95018878c52e9d9 Mon Sep 17 00:00:00 2001 From: Gordon Forsythe Date: Sun, 24 May 2020 09:26:12 -0700 Subject: [PATCH 04/11] rename class so the overall test works properly --- tests/Output.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Output.php b/tests/Output.php index 60ff313..547774a 100644 --- a/tests/Output.php +++ b/tests/Output.php @@ -4,7 +4,7 @@ use Exception; -class OutputTest extends \PHPUnit\Framework\TestCase +class Output extends \PHPUnit\Framework\TestCase { public function testSuccess(): void { From 19a678346b3cf57a50a9d2dd7607fcf2f5979bbc Mon Sep 17 00:00:00 2001 From: Gordon Forsythe Date: Sun, 24 May 2020 09:26:29 -0700 Subject: [PATCH 05/11] use the printer for phpunit 9 --- tests/PrinterTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/PrinterTest.php b/tests/PrinterTest.php index 5d429a7..65408cb 100644 --- a/tests/PrinterTest.php +++ b/tests/PrinterTest.php @@ -98,7 +98,7 @@ private function getOutput(): array $command = [ "vendor/bin/phpunit", "tests/Output.php", - "--printer 'Sempro\PHPUnitPrettyPrinter\PrettyPrinter'", + "--printer 'Sempro\PHPUnitPrettyPrinter\PrettyPrinterForPhpUnit9'", ]; exec(implode(' ', $command), $out); From 49c45883a5da6a29c59961738b1281a8eadfcbec Mon Sep 17 00:00:00 2001 From: Gordon Forsythe Date: Sun, 24 May 2020 09:34:02 -0700 Subject: [PATCH 06/11] update readme to reflect alterations for phpunit 9 --- README.md | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 447c48b..c06e49f 100755 --- a/README.md +++ b/README.md @@ -14,23 +14,30 @@ composer require sempro/phpunit-pretty-print --dev ``` This package requires `>=7.0.0` of PHPUnit. + If you're running on `6.x`, please use version `1.0.3`. +If you are running on `9.x` use the `\Sempro\PHPUnitPrettyPrinter\PrettyPrinterForPhpUnit9` class + ### Usage You can specify the printer to use on the phpunit command line: +For PhpUnit < 9, use the following: ```bash php vendor/bin/phpunit --printer 'Sempro\PHPUnitPrettyPrinter\PrettyPrinter' tests/ ``` +For PhpUnit >= 9, use the following: +```bash +php vendor/bin/phpunit --printer 'Sempro\PHPUnitPrettyPrinter\PrettyPrinterForPhpUnit9' tests/ +``` Optionally, you can add it to your project's `phpunit.xml` file instead: - ```xml + printerClass="Sempro\PHPUnitPrettyPrinter\PrettyPrinterForPhpUnit9"> ``` phpunit-pretty-print From 4fd881e0a3b25efbbe1888ad41e66b4bb9133c25 Mon Sep 17 00:00:00 2001 From: Gordon Forsythe Date: Sun, 24 May 2020 09:39:04 -0700 Subject: [PATCH 07/11] switch to php7.4 for testing (required by phpunit 9) --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 0276687..a6d5a2a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,7 @@ language: php php: - - 7.2 + - 7.4 before_script: composer install @@ -13,4 +13,4 @@ script: notifications: email: on_success: never - on_failure: never \ No newline at end of file + on_failure: never From b090497c6bc23a567335ec5887ad1b8edd1c5e71 Mon Sep 17 00:00:00 2001 From: Gordon Forsythe Date: Sun, 24 May 2020 09:44:46 -0700 Subject: [PATCH 08/11] move main code to a trait to use for both printer classes... this breaks history, but allows for a single place to change things --- src/PrettyPrinter.php | 204 +---------------------------- src/PrettyPrinterForPhpUnit9.php | 204 +---------------------------- src/PrettyPrinterTrait.php | 213 +++++++++++++++++++++++++++++++ 3 files changed, 215 insertions(+), 406 deletions(-) create mode 100644 src/PrettyPrinterTrait.php diff --git a/src/PrettyPrinter.php b/src/PrettyPrinter.php index 8331f02..a81d407 100644 --- a/src/PrettyPrinter.php +++ b/src/PrettyPrinter.php @@ -2,212 +2,10 @@ namespace Sempro\PHPUnitPrettyPrinter; -use PHPUnit\Framework\Test; -use PHPUnit\Framework\TestFailure; use PHPUnit\Framework\TestListener; -use PHPUnit\Framework\TestSuite; -use PHPUnit\Runner\BaseTestRunner; use PHPUnit\TextUI\ResultPrinter; -use PHPUnit\Util\Filter; class PrettyPrinter extends ResultPrinter implements TestListener { - protected $className; - protected $previousClassName; - - public function startTestSuite(TestSuite $suite): void - { - parent::startTestSuite($suite); - } - - public function startTest(Test $test): void - { - $this->className = get_class($test); - } - - public function endTest(Test $test, float $time): void - { - parent::endTest($test, $time); - - $testMethodName = \PHPUnit\Util\Test::describe($test); - - // Convert capitalized words to lowercase - $testMethodName[1] = preg_replace_callback('/([A-Z]{2,})/', function ($matches) { return strtolower($matches[0]); }, $testMethodName[1]); - - // Convert non-breaking method name to camelCase - $testMethodName[1] = str_replace(' ', '', ucwords($testMethodName[1], ' ')); - - // Convert snakeCase method name to camelCase - $testMethodName[1] = str_replace('_', '', ucwords($testMethodName[1], '_')); - - preg_match_all('/((?:^|[A-Z])[a-z0-9]+)/', $testMethodName[1], $matches); - - // Prepend all numbers with a space - $replaced = preg_replace('/(\d+)/', ' $1', $matches[0]); - - $testNameArray = array_map('strtolower', $replaced); - - $name = implode(' ', $testNameArray); - - // check if prefix is test remove it - $name = preg_replace('/^test /', '', $name, 1); - - // Get the data set name - $name = $this->handleDataSetName($name, $testMethodName[1]); - - $color = 'fg-green'; - if ($test->getStatus() !== 0) { - $color = 'fg-red'; - } - - $this->write(' '); - - switch ($test->getStatus()) { - case BaseTestRunner::STATUS_PASSED: - $this->writeWithColor('fg-green', $name, false); - - break; - case BaseTestRunner::STATUS_SKIPPED: - $this->writeWithColor('fg-yellow', $name, false); - - break; - case BaseTestRunner::STATUS_INCOMPLETE: - $this->writeWithColor('fg-blue', $name, false); - - break; - case BaseTestRunner::STATUS_FAILURE: - $this->writeWithColor('fg-red', $name, false); - - break; - case BaseTestRunner::STATUS_ERROR: - $this->writeWithColor('fg-red', $name, false); - - break; - case BaseTestRunner::STATUS_RISKY: - $this->writeWithColor('fg-magenta', $name, false); - - break; - case BaseTestRunner::STATUS_WARNING: - $this->writeWithColor('fg-yellow', $name, false); - - break; - case BaseTestRunner::STATUS_UNKNOWN: - default: - $this->writeWithColor('fg-cyan', $name, false); - - break; - } - - $this->write(' '); - - $timeColor = $time > 0.5 ? 'fg-yellow' : 'fg-white'; - $this->writeWithColor($timeColor, '[' . number_format($time, 3) . 's]', true); - } - - protected function writeProgress(string $progress): void - { - if ($this->previousClassName !== $this->className) { - $this->write("\n"); - $this->writeWithColor('bold', $this->className, false); - $this->writeNewLine(); - } - - $this->previousClassName = $this->className; - - $this->printProgress(); - - switch (strtoupper(preg_replace('#\\x1b[[][^A-Za-z]*[A-Za-z]#', '', $progress))) { - case '.': - $this->writeWithColor('fg-green', ' ✓', false); - - break; - case 'S': - $this->writeWithColor('fg-yellow', ' →', false); - - break; - case 'I': - $this->writeWithColor('fg-blue', ' ∅', false); - - break; - case 'F': - $this->writeWithColor('fg-red', ' x', false); - - break; - case 'E': - $this->writeWithColor('fg-red', ' ⚈', false); - - break; - case 'R': - $this->writeWithColor('fg-magenta', ' ⌽', false); - - break; - case 'W': - $this->writeWithColor('fg-yellow', ' ¤', false); - - break; - default: - $this->writeWithColor('fg-cyan', ' ≈', false); - - break; - } - } - - protected function printDefectTrace(TestFailure $defect): void - { - $this->write($this->formatExceptionMsg($defect->getExceptionAsString())); - $trace = Filter::getFilteredStacktrace( - $defect->thrownException() - ); - if (!empty($trace)) { - $this->write("\n" . $trace); - } - $exception = $defect->thrownException()->getPrevious(); - while ($exception) { - $this->write( - "\nCaused by\n" . - TestFailure::exceptionToString($exception) . "\n" . - Filter::getFilteredStacktrace($exception) - ); - $exception = $exception->getPrevious(); - } - } - - protected function formatExceptionMsg($exceptionMessage): string - { - $exceptionMessage = str_replace("+++ Actual\n", '', $exceptionMessage); - $exceptionMessage = str_replace("--- Expected\n", '', $exceptionMessage); - $exceptionMessage = str_replace('@@ @@', '', $exceptionMessage); - - if ($this->colors) { - $exceptionMessage = preg_replace('/^(Exception.*)$/m', "\033[01;31m$1\033[0m", $exceptionMessage); - $exceptionMessage = preg_replace('/(Failed.*)$/m', "\033[01;31m$1\033[0m", $exceptionMessage); - $exceptionMessage = preg_replace("/(\-+.*)$/m", "\033[01;32m$1\033[0m", $exceptionMessage); - $exceptionMessage = preg_replace("/(\++.*)$/m", "\033[01;31m$1\033[0m", $exceptionMessage); - } - - return $exceptionMessage; - } - - private function handleDataSetName($name, $testMethodName): string - { - preg_match('/\bwith data set "([^"]+)"/', $testMethodName, $dataSetMatch); - - if (empty($dataSetMatch)) { - return $name; - } - - return $name . ' [' . $dataSetMatch[1] . ']'; - } - - private function printProgress() - { - if (filter_var(getenv('PHPUNIT_PRETTY_PRINT_PROGRESS'), FILTER_VALIDATE_BOOLEAN)) { - $this->numTestsRun++; - - $total = $this->numTests; - $current = str_pad($this->numTestsRun, strlen($total), '0', STR_PAD_LEFT); - - $this->write("[{$current}/{$total}]"); - } - } + use PrettyPrinterTrait; } diff --git a/src/PrettyPrinterForPhpUnit9.php b/src/PrettyPrinterForPhpUnit9.php index df6b25b..42b7c32 100644 --- a/src/PrettyPrinterForPhpUnit9.php +++ b/src/PrettyPrinterForPhpUnit9.php @@ -2,211 +2,9 @@ namespace Sempro\PHPUnitPrettyPrinter; -use PHPUnit\Framework\Test; -use PHPUnit\Framework\TestFailure; -use PHPUnit\Framework\TestSuite; -use PHPUnit\Runner\BaseTestRunner; use PHPUnit\TextUI\DefaultResultPrinter; -use PHPUnit\Util\Filter; class PrettyPrinterForPhpUnit9 extends DefaultResultPrinter { - protected $className; - protected $previousClassName; - - public function startTestSuite(TestSuite $suite): void - { - parent::startTestSuite($suite); - } - - public function startTest(Test $test): void - { - $this->className = get_class($test); - } - - public function endTest(Test $test, float $time): void - { - parent::endTest($test, $time); - - $testMethodName = \PHPUnit\Util\Test::describe($test); - - // Convert capitalized words to lowercase - $testMethodName[1] = preg_replace_callback('/([A-Z]{2,})/', function ($matches) { return strtolower($matches[0]); }, $testMethodName[1]); - - // Convert non-breaking method name to camelCase - $testMethodName[1] = str_replace(' ', '', ucwords($testMethodName[1], ' ')); - - // Convert snakeCase method name to camelCase - $testMethodName[1] = str_replace('_', '', ucwords($testMethodName[1], '_')); - - preg_match_all('/((?:^|[A-Z])[a-z0-9]+)/', $testMethodName[1], $matches); - - // Prepend all numbers with a space - $replaced = preg_replace('/(\d+)/', ' $1', $matches[0]); - - $testNameArray = array_map('strtolower', $replaced); - - $name = implode(' ', $testNameArray); - - // check if prefix is test remove it - $name = preg_replace('/^test /', '', $name, 1); - - // Get the data set name - $name = $this->handleDataSetName($name, $testMethodName[1]); - - $color = 'fg-green'; - if ($test->getStatus() !== 0) { - $color = 'fg-red'; - } - - $this->write(' '); - - switch ($test->getStatus()) { - case BaseTestRunner::STATUS_PASSED: - $this->writeWithColor('fg-green', $name, false); - - break; - case BaseTestRunner::STATUS_SKIPPED: - $this->writeWithColor('fg-yellow', $name, false); - - break; - case BaseTestRunner::STATUS_INCOMPLETE: - $this->writeWithColor('fg-blue', $name, false); - - break; - case BaseTestRunner::STATUS_FAILURE: - $this->writeWithColor('fg-red', $name, false); - - break; - case BaseTestRunner::STATUS_ERROR: - $this->writeWithColor('fg-red', $name, false); - - break; - case BaseTestRunner::STATUS_RISKY: - $this->writeWithColor('fg-magenta', $name, false); - - break; - case BaseTestRunner::STATUS_WARNING: - $this->writeWithColor('fg-yellow', $name, false); - - break; - case BaseTestRunner::STATUS_UNKNOWN: - default: - $this->writeWithColor('fg-cyan', $name, false); - - break; - } - - $this->write(' '); - - $timeColor = $time > 0.5 ? 'fg-yellow' : 'fg-white'; - $this->writeWithColor($timeColor, '[' . number_format($time, 3) . 's]', true); - } - - protected function writeProgress(string $progress): void - { - if ($this->previousClassName !== $this->className) { - $this->write("\n"); - $this->writeWithColor('bold', $this->className, false); - $this->writeNewLine(); - } - - $this->previousClassName = $this->className; - - $this->printProgress(); - - switch (strtoupper(preg_replace('#\\x1b[[][^A-Za-z]*[A-Za-z]#', '', $progress))) { - case '.': - $this->writeWithColor('fg-green', ' ✓', false); - - break; - case 'S': - $this->writeWithColor('fg-yellow', ' →', false); - - break; - case 'I': - $this->writeWithColor('fg-blue', ' ∅', false); - - break; - case 'F': - $this->writeWithColor('fg-red', ' x', false); - - break; - case 'E': - $this->writeWithColor('fg-red', ' ⚈', false); - - break; - case 'R': - $this->writeWithColor('fg-magenta', ' ⌽', false); - - break; - case 'W': - $this->writeWithColor('fg-yellow', ' ¤', false); - - break; - default: - $this->writeWithColor('fg-cyan', ' ≈', false); - - break; - } - } - - protected function printDefectTrace(TestFailure $defect): void - { - $this->write($this->formatExceptionMsg($defect->getExceptionAsString())); - $trace = Filter::getFilteredStacktrace( - $defect->thrownException() - ); - if (!empty($trace)) { - $this->write("\n" . $trace); - } - $exception = $defect->thrownException()->getPrevious(); - while ($exception) { - $this->write( - "\nCaused by\n" . - TestFailure::exceptionToString($exception) . "\n" . - Filter::getFilteredStacktrace($exception) - ); - $exception = $exception->getPrevious(); - } - } - - protected function formatExceptionMsg($exceptionMessage): string - { - $exceptionMessage = str_replace("+++ Actual\n", '', $exceptionMessage); - $exceptionMessage = str_replace("--- Expected\n", '', $exceptionMessage); - $exceptionMessage = str_replace('@@ @@', '', $exceptionMessage); - - if ($this->colors) { - $exceptionMessage = preg_replace('/^(Exception.*)$/m', "\033[01;31m$1\033[0m", $exceptionMessage); - $exceptionMessage = preg_replace('/(Failed.*)$/m', "\033[01;31m$1\033[0m", $exceptionMessage); - $exceptionMessage = preg_replace("/(\-+.*)$/m", "\033[01;32m$1\033[0m", $exceptionMessage); - $exceptionMessage = preg_replace("/(\++.*)$/m", "\033[01;31m$1\033[0m", $exceptionMessage); - } - - return $exceptionMessage; - } - - private function handleDataSetName($name, $testMethodName): string - { - preg_match('/\bwith data set "([^"]+)"/', $testMethodName, $dataSetMatch); - - if (empty($dataSetMatch)) { - return $name; - } - - return $name . ' [' . $dataSetMatch[1] . ']'; - } - - private function printProgress() - { - if (filter_var(getenv('PHPUNIT_PRETTY_PRINT_PROGRESS'), FILTER_VALIDATE_BOOLEAN)) { - $this->numTestsRun++; - - $total = $this->numTests; - $current = str_pad($this->numTestsRun, strlen($total), '0', STR_PAD_LEFT); - - $this->write("[{$current}/{$total}]"); - } - } + use PrettyPrinterTrait; } diff --git a/src/PrettyPrinterTrait.php b/src/PrettyPrinterTrait.php new file mode 100644 index 0000000..b66ae6d --- /dev/null +++ b/src/PrettyPrinterTrait.php @@ -0,0 +1,213 @@ +className = get_class($test); + } + + public function endTest(Test $test, float $time): void + { + parent::endTest($test, $time); + + $testMethodName = \PHPUnit\Util\Test::describe($test); + + // Convert capitalized words to lowercase + $testMethodName[1] = preg_replace_callback('/([A-Z]{2,})/', function ($matches) { return strtolower($matches[0]); }, $testMethodName[1]); + + // Convert non-breaking method name to camelCase + $testMethodName[1] = str_replace(' ', '', ucwords($testMethodName[1], ' ')); + + // Convert snakeCase method name to camelCase + $testMethodName[1] = str_replace('_', '', ucwords($testMethodName[1], '_')); + + preg_match_all('/((?:^|[A-Z])[a-z0-9]+)/', $testMethodName[1], $matches); + + // Prepend all numbers with a space + $replaced = preg_replace('/(\d+)/', ' $1', $matches[0]); + + $testNameArray = array_map('strtolower', $replaced); + + $name = implode(' ', $testNameArray); + + // check if prefix is test remove it + $name = preg_replace('/^test /', '', $name, 1); + + // Get the data set name + $name = $this->handleDataSetName($name, $testMethodName[1]); + + $color = 'fg-green'; + if ($test->getStatus() !== 0) { + $color = 'fg-red'; + } + + $this->write(' '); + + switch ($test->getStatus()) { + case BaseTestRunner::STATUS_PASSED: + $this->writeWithColor('fg-green', $name, false); + + break; + case BaseTestRunner::STATUS_SKIPPED: + $this->writeWithColor('fg-yellow', $name, false); + + break; + case BaseTestRunner::STATUS_INCOMPLETE: + $this->writeWithColor('fg-blue', $name, false); + + break; + case BaseTestRunner::STATUS_FAILURE: + $this->writeWithColor('fg-red', $name, false); + + break; + case BaseTestRunner::STATUS_ERROR: + $this->writeWithColor('fg-red', $name, false); + + break; + case BaseTestRunner::STATUS_RISKY: + $this->writeWithColor('fg-magenta', $name, false); + + break; + case BaseTestRunner::STATUS_WARNING: + $this->writeWithColor('fg-yellow', $name, false); + + break; + case BaseTestRunner::STATUS_UNKNOWN: + default: + $this->writeWithColor('fg-cyan', $name, false); + + break; + } + + $this->write(' '); + + $timeColor = $time > 0.5 ? 'fg-yellow' : 'fg-white'; + $this->writeWithColor($timeColor, '[' . number_format($time, 3) . 's]', true); + } + + protected function writeProgress(string $progress): void + { + if ($this->previousClassName !== $this->className) { + $this->write("\n"); + $this->writeWithColor('bold', $this->className, false); + $this->writeNewLine(); + } + + $this->previousClassName = $this->className; + + $this->printProgress(); + + switch (strtoupper(preg_replace('#\\x1b[[][^A-Za-z]*[A-Za-z]#', '', $progress))) { + case '.': + $this->writeWithColor('fg-green', ' ✓', false); + + break; + case 'S': + $this->writeWithColor('fg-yellow', ' →', false); + + break; + case 'I': + $this->writeWithColor('fg-blue', ' ∅', false); + + break; + case 'F': + $this->writeWithColor('fg-red', ' x', false); + + break; + case 'E': + $this->writeWithColor('fg-red', ' ⚈', false); + + break; + case 'R': + $this->writeWithColor('fg-magenta', ' ⌽', false); + + break; + case 'W': + $this->writeWithColor('fg-yellow', ' ¤', false); + + break; + default: + $this->writeWithColor('fg-cyan', ' ≈', false); + + break; + } + } + + protected function printDefectTrace(TestFailure $defect): void + { + $this->write($this->formatExceptionMsg($defect->getExceptionAsString())); + $trace = Filter::getFilteredStacktrace( + $defect->thrownException() + ); + if (!empty($trace)) { + $this->write("\n" . $trace); + } + $exception = $defect->thrownException()->getPrevious(); + while ($exception) { + $this->write( + "\nCaused by\n" . + TestFailure::exceptionToString($exception) . "\n" . + Filter::getFilteredStacktrace($exception) + ); + $exception = $exception->getPrevious(); + } + } + + protected function formatExceptionMsg($exceptionMessage): string + { + $exceptionMessage = str_replace("+++ Actual\n", '', $exceptionMessage); + $exceptionMessage = str_replace("--- Expected\n", '', $exceptionMessage); + $exceptionMessage = str_replace('@@ @@', '', $exceptionMessage); + + if ($this->colors) { + $exceptionMessage = preg_replace('/^(Exception.*)$/m', "\033[01;31m$1\033[0m", $exceptionMessage); + $exceptionMessage = preg_replace('/(Failed.*)$/m', "\033[01;31m$1\033[0m", $exceptionMessage); + $exceptionMessage = preg_replace("/(\-+.*)$/m", "\033[01;32m$1\033[0m", $exceptionMessage); + $exceptionMessage = preg_replace("/(\++.*)$/m", "\033[01;31m$1\033[0m", $exceptionMessage); + } + + return $exceptionMessage; + } + + private function handleDataSetName($name, $testMethodName): string + { + preg_match('/\bwith data set "([^"]+)"/', $testMethodName, $dataSetMatch); + + if (empty($dataSetMatch)) { + return $name; + } + + return $name . ' [' . $dataSetMatch[1] . ']'; + } + + private function printProgress() + { + if (filter_var(getenv('PHPUNIT_PRETTY_PRINT_PROGRESS'), FILTER_VALIDATE_BOOLEAN)) { + $this->numTestsRun++; + + $total = $this->numTests; + $current = str_pad($this->numTestsRun, strlen($total), '0', STR_PAD_LEFT); + + $this->write("[{$current}/{$total}]"); + } + } +} From 15e13fa2c9f25cc902d9b95f3cdfafe355025741 Mon Sep 17 00:00:00 2001 From: Gordon Forsythe Date: Sun, 24 May 2020 09:47:20 -0700 Subject: [PATCH 09/11] update php-cs-fixer so travis will succeed --- composer.json | 2 +- composer.lock | 47 ++++++++++++++++++++++++++++------------------- 2 files changed, 29 insertions(+), 20 deletions(-) diff --git a/composer.json b/composer.json index 391feaf..bf88272 100644 --- a/composer.json +++ b/composer.json @@ -16,6 +16,6 @@ } }, "require-dev": { - "friendsofphp/php-cs-fixer": "^2.15" + "friendsofphp/php-cs-fixer": "^2.16" } } diff --git a/composer.lock b/composer.lock index 9f8be45..e251ba0 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "40708f6c740c1edc7b168a4a3b7f95bd", + "content-hash": "98b2e824a5595c2b2c409c9d82ab6ea6", "packages": [ { "name": "doctrine/instantiator", @@ -1936,16 +1936,16 @@ }, { "name": "friendsofphp/php-cs-fixer", - "version": "v2.15.1", + "version": "v2.16.3", "source": { "type": "git", "url": "https://github.com/FriendsOfPHP/PHP-CS-Fixer.git", - "reference": "20064511ab796593a3990669eff5f5b535001f7c" + "reference": "83baf823a33a1cbd5416c8626935cf3f843c10b0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/zipball/20064511ab796593a3990669eff5f5b535001f7c", - "reference": "20064511ab796593a3990669eff5f5b535001f7c", + "url": "https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/zipball/83baf823a33a1cbd5416c8626935cf3f843c10b0", + "reference": "83baf823a33a1cbd5416c8626935cf3f843c10b0", "shasum": "" }, "require": { @@ -1956,15 +1956,15 @@ "ext-tokenizer": "*", "php": "^5.6 || ^7.0", "php-cs-fixer/diff": "^1.3", - "symfony/console": "^3.4.17 || ^4.1.6", - "symfony/event-dispatcher": "^3.0 || ^4.0", - "symfony/filesystem": "^3.0 || ^4.0", - "symfony/finder": "^3.0 || ^4.0", - "symfony/options-resolver": "^3.0 || ^4.0", + "symfony/console": "^3.4.17 || ^4.1.6 || ^5.0", + "symfony/event-dispatcher": "^3.0 || ^4.0 || ^5.0", + "symfony/filesystem": "^3.0 || ^4.0 || ^5.0", + "symfony/finder": "^3.0 || ^4.0 || ^5.0", + "symfony/options-resolver": "^3.0 || ^4.0 || ^5.0", "symfony/polyfill-php70": "^1.0", "symfony/polyfill-php72": "^1.4", - "symfony/process": "^3.0 || ^4.0", - "symfony/stopwatch": "^3.0 || ^4.0" + "symfony/process": "^3.0 || ^4.0 || ^5.0", + "symfony/stopwatch": "^3.0 || ^4.0 || ^5.0" }, "require-dev": { "johnkary/phpunit-speedtrap": "^1.1 || ^2.0 || ^3.0", @@ -1975,11 +1975,13 @@ "php-cs-fixer/accessible-object": "^1.0", "php-cs-fixer/phpunit-constraint-isidenticalstring": "^1.1", "php-cs-fixer/phpunit-constraint-xmlmatchesxsd": "^1.1", - "phpunit/phpunit": "^5.7.27 || ^6.5.8 || ^7.1", + "phpunit/phpunit": "^5.7.27 || ^6.5.14 || ^7.1", "phpunitgoodpractices/traits": "^1.8", - "symfony/phpunit-bridge": "^4.3" + "symfony/phpunit-bridge": "^4.3 || ^5.0", + "symfony/yaml": "^3.0 || ^4.0 || ^5.0" }, "suggest": { + "ext-dom": "For handling output formats in XML", "ext-mbstring": "For handling non-UTF8 characters in cache signature.", "php-cs-fixer/phpunit-constraint-isidenticalstring": "For IsIdenticalString constraint.", "php-cs-fixer/phpunit-constraint-xmlmatchesxsd": "For XmlMatchesXsd constraint.", @@ -2002,6 +2004,7 @@ "tests/Test/IntegrationCaseFactory.php", "tests/Test/IntegrationCaseFactoryInterface.php", "tests/Test/InternalIntegrationCaseFactory.php", + "tests/Test/IsIdenticalConstraint.php", "tests/TestCase.php" ] }, @@ -2010,17 +2013,23 @@ "MIT" ], "authors": [ - { - "name": "Dariusz Rumiński", - "email": "dariusz.ruminski@gmail.com" - }, { "name": "Fabien Potencier", "email": "fabien@symfony.com" + }, + { + "name": "Dariusz Rumiński", + "email": "dariusz.ruminski@gmail.com" } ], "description": "A tool to automatically fix PHP code style", - "time": "2019-06-01T10:32:12+00:00" + "funding": [ + { + "url": "https://github.com/keradus", + "type": "github" + } + ], + "time": "2020-04-15T18:51:10+00:00" }, { "name": "paragonie/random_compat", From 7993784a7dfb8e2f9861a8ae936480b1130fa717 Mon Sep 17 00:00:00 2001 From: Gordon Forsythe Date: Sun, 24 May 2020 09:47:37 -0700 Subject: [PATCH 10/11] php-cs-fixer fix for formatting --- src/PrettyPrinterTrait.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/PrettyPrinterTrait.php b/src/PrettyPrinterTrait.php index b66ae6d..01bfbf8 100644 --- a/src/PrettyPrinterTrait.php +++ b/src/PrettyPrinterTrait.php @@ -3,7 +3,6 @@ namespace Sempro\PHPUnitPrettyPrinter; - use PHPUnit\Framework\Test; use PHPUnit\Framework\TestFailure; use PHPUnit\Framework\TestSuite; @@ -32,7 +31,9 @@ public function endTest(Test $test, float $time): void $testMethodName = \PHPUnit\Util\Test::describe($test); // Convert capitalized words to lowercase - $testMethodName[1] = preg_replace_callback('/([A-Z]{2,})/', function ($matches) { return strtolower($matches[0]); }, $testMethodName[1]); + $testMethodName[1] = preg_replace_callback('/([A-Z]{2,})/', function ($matches) { + return strtolower($matches[0]); + }, $testMethodName[1]); // Convert non-breaking method name to camelCase $testMethodName[1] = str_replace(' ', '', ucwords($testMethodName[1], ' ')); From 716ba25095229350f20f853d1a4c7ff00340cd66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Runar=20J=C3=B8rgensen?= Date: Fri, 11 Sep 2020 15:37:52 +0200 Subject: [PATCH 11/11] Bumps version --- composer.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index bf88272..60d0fc1 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,6 @@ { "name": "sempro/phpunit-pretty-print", - "version": "1.2.2", + "version": "1.3.0", "description": "Prettify PHPUnit output", "type": "library", "license": "MIT", @@ -18,4 +18,4 @@ "require-dev": { "friendsofphp/php-cs-fixer": "^2.16" } -} +} \ No newline at end of file