From b59ee9b9362f49acdc26e01e6cca2ea7b9bbcb0b Mon Sep 17 00:00:00 2001 From: robiningelbrecht Date: Fri, 8 Sep 2023 15:29:44 +0200 Subject: [PATCH 1/2] Add runtime info --- .gitignore | 1 + composer.json | 7 +- composer.lock | 390 ++++++++---------- phpunit.xml.dist | 8 +- src/PhpUnitExtension.php | 2 + .../ApplicationStartedSubscriber.php | 20 + tests/OutputTest.php | 12 + tests/Unit/PhpUnitExtensionTest.php | 194 +++------ .../ApplicationFinishedSubscriberTest.php | 2 +- tests/bootstrap.php | 5 - 10 files changed, 256 insertions(+), 385 deletions(-) create mode 100644 src/Subscriber/Application/ApplicationStartedSubscriber.php delete mode 100644 tests/bootstrap.php diff --git a/.gitignore b/.gitignore index d2a5d13..b831083 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ vendor .phpunit.cache +.phpunit.result.cache .php-cs-fixer.cache \ No newline at end of file diff --git a/composer.json b/composer.json index aebb393..d445596 100644 --- a/composer.json +++ b/composer.json @@ -16,8 +16,8 @@ ], "require": { "php": "^8.1", - "nunomaduro/collision": "^7.5", - "phpunit/phpunit": "^10.1" + "nunomaduro/collision": "^7.8", + "phpunit/phpunit": "^10.3" }, "autoload": { "psr-4": { @@ -30,7 +30,6 @@ } }, "require-dev": { - "dg/bypass-finals": "^1.4", "friendsofphp/php-cs-fixer": "^3.15", "phpstan/phpstan": "^1.10", "spatie/phpunit-snapshot-assertions": "^5.0" @@ -40,6 +39,6 @@ }, "scripts": { "lint:fix": " ./vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.dist.php", - "phpunit:test": "vendor/bin/phpunit --configuration=tests/phpunit.test.xml --no-output" + "phpunit:test": "vendor/bin/phpunit --configuration=tests/phpunit.test.xml" } } diff --git a/composer.lock b/composer.lock index 98fbbc0..6b648c7 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": "f22c2fa285bdd82f1ffb0864a94f38f8", + "content-hash": "1a19f42d348b4f840c490f78a3204878", "packages": [ { "name": "filp/whoops", - "version": "2.15.2", + "version": "2.15.3", "source": { "type": "git", "url": "https://github.com/filp/whoops.git", - "reference": "aac9304c5ed61bf7b1b7a6064bf9806ab842ce73" + "reference": "c83e88a30524f9360b11f585f71e6b17313b7187" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/filp/whoops/zipball/aac9304c5ed61bf7b1b7a6064bf9806ab842ce73", - "reference": "aac9304c5ed61bf7b1b7a6064bf9806ab842ce73", + "url": "https://api.github.com/repos/filp/whoops/zipball/c83e88a30524f9360b11f585f71e6b17313b7187", + "reference": "c83e88a30524f9360b11f585f71e6b17313b7187", "shasum": "" }, "require": { @@ -67,7 +67,7 @@ ], "support": { "issues": "https://github.com/filp/whoops/issues", - "source": "https://github.com/filp/whoops/tree/2.15.2" + "source": "https://github.com/filp/whoops/tree/2.15.3" }, "funding": [ { @@ -75,7 +75,7 @@ "type": "github" } ], - "time": "2023-04-12T12:00:00+00:00" + "time": "2023-07-13T12:00:00+00:00" }, { "name": "myclabs/deep-copy", @@ -138,16 +138,16 @@ }, { "name": "nikic/php-parser", - "version": "v4.15.4", + "version": "v4.17.1", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "6bb5176bc4af8bcb7d926f88718db9b96a2d4290" + "reference": "a6303e50c90c355c7eeee2c4a8b27fe8dc8fef1d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/6bb5176bc4af8bcb7d926f88718db9b96a2d4290", - "reference": "6bb5176bc4af8bcb7d926f88718db9b96a2d4290", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/a6303e50c90c355c7eeee2c4a8b27fe8dc8fef1d", + "reference": "a6303e50c90c355c7eeee2c4a8b27fe8dc8fef1d", "shasum": "" }, "require": { @@ -188,46 +188,43 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v4.15.4" + "source": "https://github.com/nikic/PHP-Parser/tree/v4.17.1" }, - "time": "2023-03-05T19:49:14+00:00" + "time": "2023-08-13T19:53:39+00:00" }, { "name": "nunomaduro/collision", - "version": "v7.5.2", + "version": "v7.8.1", "source": { "type": "git", "url": "https://github.com/nunomaduro/collision.git", - "reference": "76b3cabda0aabda455fc3b9db6c3615f5a87c7ff" + "reference": "61553ad3260845d7e3e49121b7074619233d361b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nunomaduro/collision/zipball/76b3cabda0aabda455fc3b9db6c3615f5a87c7ff", - "reference": "76b3cabda0aabda455fc3b9db6c3615f5a87c7ff", + "url": "https://api.github.com/repos/nunomaduro/collision/zipball/61553ad3260845d7e3e49121b7074619233d361b", + "reference": "61553ad3260845d7e3e49121b7074619233d361b", "shasum": "" }, "require": { - "filp/whoops": "^2.15.2", + "filp/whoops": "^2.15.3", "nunomaduro/termwind": "^1.15.1", "php": "^8.1.0", - "symfony/console": "^6.2.8" - }, - "conflict": { - "phpunit/phpunit": "<10.1.2" + "symfony/console": "^6.3.2" }, "require-dev": { - "brianium/paratest": "^7.1.3", - "laravel/framework": "^10.8.0", - "laravel/pint": "^1.9.0", - "laravel/sail": "^1.21.4", - "laravel/sanctum": "^3.2.1", + "brianium/paratest": "^7.2.4", + "laravel/framework": "^10.17.1", + "laravel/pint": "^1.10.5", + "laravel/sail": "^1.23.1", + "laravel/sanctum": "^3.2.5", "laravel/tinker": "^2.8.1", - "nunomaduro/larastan": "^2.6.0", - "orchestra/testbench-core": "^8.5.0", - "pestphp/pest": "^2.5.2", - "phpunit/phpunit": "^10.1.1", + "nunomaduro/larastan": "^2.6.4", + "orchestra/testbench-core": "^8.5.9", + "pestphp/pest": "^2.12.1", + "phpunit/phpunit": "^10.3.1", "sebastian/environment": "^6.0.1", - "spatie/laravel-ignition": "^2.1.0" + "spatie/laravel-ignition": "^2.2.0" }, "type": "library", "extra": { @@ -286,7 +283,7 @@ "type": "patreon" } ], - "time": "2023-04-22T22:12:40+00:00" + "time": "2023-08-07T08:03:21+00:00" }, { "name": "nunomaduro/termwind", @@ -487,16 +484,16 @@ }, { "name": "phpunit/php-code-coverage", - "version": "10.1.1", + "version": "10.1.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "884a0da7f9f46f28b2cb69134217fd810b793974" + "reference": "cd59bb34756a16ca8253ce9b2909039c227fff71" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/884a0da7f9f46f28b2cb69134217fd810b793974", - "reference": "884a0da7f9f46f28b2cb69134217fd810b793974", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/cd59bb34756a16ca8253ce9b2909039c227fff71", + "reference": "cd59bb34756a16ca8253ce9b2909039c227fff71", "shasum": "" }, "require": { @@ -553,7 +550,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", "security": "https://github.com/sebastianbergmann/php-code-coverage/security/policy", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/10.1.1" + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/10.1.4" }, "funding": [ { @@ -561,20 +558,20 @@ "type": "github" } ], - "time": "2023-04-17T12:15:40+00:00" + "time": "2023-08-31T14:04:38+00:00" }, { "name": "phpunit/php-file-iterator", - "version": "4.0.1", + "version": "4.1.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "fd9329ab3368f59fe1fe808a189c51086bd4b6bd" + "reference": "a95037b6d9e608ba092da1b23931e537cadc3c3c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/fd9329ab3368f59fe1fe808a189c51086bd4b6bd", - "reference": "fd9329ab3368f59fe1fe808a189c51086bd4b6bd", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/a95037b6d9e608ba092da1b23931e537cadc3c3c", + "reference": "a95037b6d9e608ba092da1b23931e537cadc3c3c", "shasum": "" }, "require": { @@ -613,7 +610,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-file-iterator/issues", - "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/4.0.1" + "security": "https://github.com/sebastianbergmann/php-file-iterator/security/policy", + "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/4.1.0" }, "funding": [ { @@ -621,7 +619,7 @@ "type": "github" } ], - "time": "2023-02-10T16:53:14+00:00" + "time": "2023-08-31T06:24:48+00:00" }, { "name": "phpunit/php-invoker", @@ -688,16 +686,16 @@ }, { "name": "phpunit/php-text-template", - "version": "3.0.0", + "version": "3.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-text-template.git", - "reference": "9f3d3709577a527025f55bcf0f7ab8052c8bb37d" + "reference": "0c7b06ff49e3d5072f057eb1fa59258bf287a748" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/9f3d3709577a527025f55bcf0f7ab8052c8bb37d", - "reference": "9f3d3709577a527025f55bcf0f7ab8052c8bb37d", + "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/0c7b06ff49e3d5072f057eb1fa59258bf287a748", + "reference": "0c7b06ff49e3d5072f057eb1fa59258bf287a748", "shasum": "" }, "require": { @@ -735,7 +733,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-text-template/issues", - "source": "https://github.com/sebastianbergmann/php-text-template/tree/3.0.0" + "security": "https://github.com/sebastianbergmann/php-text-template/security/policy", + "source": "https://github.com/sebastianbergmann/php-text-template/tree/3.0.1" }, "funding": [ { @@ -743,7 +742,7 @@ "type": "github" } ], - "time": "2023-02-03T06:56:46+00:00" + "time": "2023-08-31T14:07:24+00:00" }, { "name": "phpunit/php-timer", @@ -806,16 +805,16 @@ }, { "name": "phpunit/phpunit", - "version": "10.1.2", + "version": "10.3.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "6f0cd95be71add539f8fd2be25b2a4a29789000b" + "reference": "241ed4dd0db1c096984e62d414c4e1ac8d5dbff4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/6f0cd95be71add539f8fd2be25b2a4a29789000b", - "reference": "6f0cd95be71add539f8fd2be25b2a4a29789000b", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/241ed4dd0db1c096984e62d414c4e1ac8d5dbff4", + "reference": "241ed4dd0db1c096984e62d414c4e1ac8d5dbff4", "shasum": "" }, "require": { @@ -840,7 +839,7 @@ "sebastian/diff": "^5.0", "sebastian/environment": "^6.0", "sebastian/exporter": "^5.0", - "sebastian/global-state": "^6.0", + "sebastian/global-state": "^6.0.1", "sebastian/object-enumerator": "^5.0", "sebastian/recursion-context": "^5.0", "sebastian/type": "^4.0", @@ -855,7 +854,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "10.1-dev" + "dev-main": "10.3-dev" } }, "autoload": { @@ -887,7 +886,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", "security": "https://github.com/sebastianbergmann/phpunit/security/policy", - "source": "https://github.com/sebastianbergmann/phpunit/tree/10.1.2" + "source": "https://github.com/sebastianbergmann/phpunit/tree/10.3.3" }, "funding": [ { @@ -903,7 +902,7 @@ "type": "tidelift" } ], - "time": "2023-04-22T07:38:19+00:00" + "time": "2023-09-05T04:34:51+00:00" }, { "name": "psr/container", @@ -1177,16 +1176,16 @@ }, { "name": "sebastian/comparator", - "version": "5.0.0", + "version": "5.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "72f01e6586e0caf6af81297897bd112eb7e9627c" + "reference": "2db5010a484d53ebf536087a70b4a5423c102372" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/72f01e6586e0caf6af81297897bd112eb7e9627c", - "reference": "72f01e6586e0caf6af81297897bd112eb7e9627c", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/2db5010a484d53ebf536087a70b4a5423c102372", + "reference": "2db5010a484d53ebf536087a70b4a5423c102372", "shasum": "" }, "require": { @@ -1197,7 +1196,7 @@ "sebastian/exporter": "^5.0" }, "require-dev": { - "phpunit/phpunit": "^10.0" + "phpunit/phpunit": "^10.3" }, "type": "library", "extra": { @@ -1241,7 +1240,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/comparator/issues", - "source": "https://github.com/sebastianbergmann/comparator/tree/5.0.0" + "security": "https://github.com/sebastianbergmann/comparator/security/policy", + "source": "https://github.com/sebastianbergmann/comparator/tree/5.0.1" }, "funding": [ { @@ -1249,20 +1249,20 @@ "type": "github" } ], - "time": "2023-02-03T07:07:16+00:00" + "time": "2023-08-14T13:18:12+00:00" }, { "name": "sebastian/complexity", - "version": "3.0.0", + "version": "3.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/complexity.git", - "reference": "e67d240970c9dc7ea7b2123a6d520e334dd61dc6" + "reference": "c70b73893e10757af9c6a48929fa6a333b56a97a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/e67d240970c9dc7ea7b2123a6d520e334dd61dc6", - "reference": "e67d240970c9dc7ea7b2123a6d520e334dd61dc6", + "url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/c70b73893e10757af9c6a48929fa6a333b56a97a", + "reference": "c70b73893e10757af9c6a48929fa6a333b56a97a", "shasum": "" }, "require": { @@ -1298,7 +1298,8 @@ "homepage": "https://github.com/sebastianbergmann/complexity", "support": { "issues": "https://github.com/sebastianbergmann/complexity/issues", - "source": "https://github.com/sebastianbergmann/complexity/tree/3.0.0" + "security": "https://github.com/sebastianbergmann/complexity/security/policy", + "source": "https://github.com/sebastianbergmann/complexity/tree/3.0.1" }, "funding": [ { @@ -1306,20 +1307,20 @@ "type": "github" } ], - "time": "2023-02-03T06:59:47+00:00" + "time": "2023-08-31T09:55:53+00:00" }, { "name": "sebastian/diff", - "version": "5.0.1", + "version": "5.0.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "aae9a0a43bff37bd5d8d0311426c87bf36153f02" + "reference": "912dc2fbe3e3c1e7873313cc801b100b6c68c87b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/aae9a0a43bff37bd5d8d0311426c87bf36153f02", - "reference": "aae9a0a43bff37bd5d8d0311426c87bf36153f02", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/912dc2fbe3e3c1e7873313cc801b100b6c68c87b", + "reference": "912dc2fbe3e3c1e7873313cc801b100b6c68c87b", "shasum": "" }, "require": { @@ -1365,7 +1366,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/diff/issues", "security": "https://github.com/sebastianbergmann/diff/security/policy", - "source": "https://github.com/sebastianbergmann/diff/tree/5.0.1" + "source": "https://github.com/sebastianbergmann/diff/tree/5.0.3" }, "funding": [ { @@ -1373,7 +1374,7 @@ "type": "github" } ], - "time": "2023-03-23T05:12:41+00:00" + "time": "2023-05-01T07:48:21+00:00" }, { "name": "sebastian/environment", @@ -1441,16 +1442,16 @@ }, { "name": "sebastian/exporter", - "version": "5.0.0", + "version": "5.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "f3ec4bf931c0b31e5b413f5b4fc970a7d03338c0" + "reference": "32ff03d078fed1279c4ec9a407d08c5e9febb480" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/f3ec4bf931c0b31e5b413f5b4fc970a7d03338c0", - "reference": "f3ec4bf931c0b31e5b413f5b4fc970a7d03338c0", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/32ff03d078fed1279c4ec9a407d08c5e9febb480", + "reference": "32ff03d078fed1279c4ec9a407d08c5e9febb480", "shasum": "" }, "require": { @@ -1506,7 +1507,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/exporter/issues", - "source": "https://github.com/sebastianbergmann/exporter/tree/5.0.0" + "security": "https://github.com/sebastianbergmann/exporter/security/policy", + "source": "https://github.com/sebastianbergmann/exporter/tree/5.0.1" }, "funding": [ { @@ -1514,20 +1516,20 @@ "type": "github" } ], - "time": "2023-02-03T07:06:49+00:00" + "time": "2023-09-08T04:46:58+00:00" }, { "name": "sebastian/global-state", - "version": "6.0.0", + "version": "6.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "aab257c712de87b90194febd52e4d184551c2d44" + "reference": "7ea9ead78f6d380d2a667864c132c2f7b83055e4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/aab257c712de87b90194febd52e4d184551c2d44", - "reference": "aab257c712de87b90194febd52e4d184551c2d44", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/7ea9ead78f6d380d2a667864c132c2f7b83055e4", + "reference": "7ea9ead78f6d380d2a667864c132c2f7b83055e4", "shasum": "" }, "require": { @@ -1567,7 +1569,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/global-state/issues", - "source": "https://github.com/sebastianbergmann/global-state/tree/6.0.0" + "security": "https://github.com/sebastianbergmann/global-state/security/policy", + "source": "https://github.com/sebastianbergmann/global-state/tree/6.0.1" }, "funding": [ { @@ -1575,20 +1578,20 @@ "type": "github" } ], - "time": "2023-02-03T07:07:38+00:00" + "time": "2023-07-19T07:19:23+00:00" }, { "name": "sebastian/lines-of-code", - "version": "2.0.0", + "version": "2.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/lines-of-code.git", - "reference": "17c4d940ecafb3d15d2cf916f4108f664e28b130" + "reference": "649e40d279e243d985aa8fb6e74dd5bb28dc185d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/17c4d940ecafb3d15d2cf916f4108f664e28b130", - "reference": "17c4d940ecafb3d15d2cf916f4108f664e28b130", + "url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/649e40d279e243d985aa8fb6e74dd5bb28dc185d", + "reference": "649e40d279e243d985aa8fb6e74dd5bb28dc185d", "shasum": "" }, "require": { @@ -1624,7 +1627,8 @@ "homepage": "https://github.com/sebastianbergmann/lines-of-code", "support": { "issues": "https://github.com/sebastianbergmann/lines-of-code/issues", - "source": "https://github.com/sebastianbergmann/lines-of-code/tree/2.0.0" + "security": "https://github.com/sebastianbergmann/lines-of-code/security/policy", + "source": "https://github.com/sebastianbergmann/lines-of-code/tree/2.0.1" }, "funding": [ { @@ -1632,7 +1636,7 @@ "type": "github" } ], - "time": "2023-02-03T07:08:02+00:00" + "time": "2023-08-31T09:25:50+00:00" }, { "name": "sebastian/object-enumerator", @@ -1920,23 +1924,23 @@ }, { "name": "symfony/console", - "version": "v6.2.8", + "version": "v6.3.4", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "3582d68a64a86ec25240aaa521ec8bc2342b369b" + "reference": "eca495f2ee845130855ddf1cf18460c38966c8b6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/3582d68a64a86ec25240aaa521ec8bc2342b369b", - "reference": "3582d68a64a86ec25240aaa521ec8bc2342b369b", + "url": "https://api.github.com/repos/symfony/console/zipball/eca495f2ee845130855ddf1cf18460c38966c8b6", + "reference": "eca495f2ee845130855ddf1cf18460c38966c8b6", "shasum": "" }, "require": { "php": ">=8.1", - "symfony/deprecation-contracts": "^2.1|^3", + "symfony/deprecation-contracts": "^2.5|^3", "symfony/polyfill-mbstring": "~1.0", - "symfony/service-contracts": "^1.1|^2|^3", + "symfony/service-contracts": "^2.5|^3", "symfony/string": "^5.4|^6.0" }, "conflict": { @@ -1958,12 +1962,6 @@ "symfony/process": "^5.4|^6.0", "symfony/var-dumper": "^5.4|^6.0" }, - "suggest": { - "psr/log": "For using the console logger", - "symfony/event-dispatcher": "", - "symfony/lock": "", - "symfony/process": "" - }, "type": "library", "autoload": { "psr-4": { @@ -1996,7 +1994,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v6.2.8" + "source": "https://github.com/symfony/console/tree/v6.3.4" }, "funding": [ { @@ -2012,20 +2010,20 @@ "type": "tidelift" } ], - "time": "2023-03-29T21:42:15+00:00" + "time": "2023-08-16T10:10:12+00:00" }, { "name": "symfony/deprecation-contracts", - "version": "v3.2.1", + "version": "v3.3.0", "source": { "type": "git", "url": "https://github.com/symfony/deprecation-contracts.git", - "reference": "e2d1534420bd723d0ef5aec58a22c5fe60ce6f5e" + "reference": "7c3aff79d10325257a001fcf92d991f24fc967cf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/e2d1534420bd723d0ef5aec58a22c5fe60ce6f5e", - "reference": "e2d1534420bd723d0ef5aec58a22c5fe60ce6f5e", + "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/7c3aff79d10325257a001fcf92d991f24fc967cf", + "reference": "7c3aff79d10325257a001fcf92d991f24fc967cf", "shasum": "" }, "require": { @@ -2034,7 +2032,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "3.3-dev" + "dev-main": "3.4-dev" }, "thanks": { "name": "symfony/contracts", @@ -2063,7 +2061,7 @@ "description": "A generic function and convention to trigger deprecation notices", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/deprecation-contracts/tree/v3.2.1" + "source": "https://github.com/symfony/deprecation-contracts/tree/v3.3.0" }, "funding": [ { @@ -2079,20 +2077,20 @@ "type": "tidelift" } ], - "time": "2023-03-01T10:25:55+00:00" + "time": "2023-05-23T14:45:45+00:00" }, { "name": "symfony/polyfill-ctype", - "version": "v1.27.0", + "version": "v1.28.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "5bbc823adecdae860bb64756d639ecfec17b050a" + "reference": "ea208ce43cbb04af6867b4fdddb1bdbf84cc28cb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/5bbc823adecdae860bb64756d639ecfec17b050a", - "reference": "5bbc823adecdae860bb64756d639ecfec17b050a", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/ea208ce43cbb04af6867b4fdddb1bdbf84cc28cb", + "reference": "ea208ce43cbb04af6867b4fdddb1bdbf84cc28cb", "shasum": "" }, "require": { @@ -2107,7 +2105,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.27-dev" + "dev-main": "1.28-dev" }, "thanks": { "name": "symfony/polyfill", @@ -2145,7 +2143,7 @@ "portable" ], "support": { - "source": "https://github.com/symfony/polyfill-ctype/tree/v1.27.0" + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.28.0" }, "funding": [ { @@ -2161,20 +2159,20 @@ "type": "tidelift" } ], - "time": "2022-11-03T14:55:06+00:00" + "time": "2023-01-26T09:26:14+00:00" }, { "name": "symfony/polyfill-intl-grapheme", - "version": "v1.27.0", + "version": "v1.28.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-grapheme.git", - "reference": "511a08c03c1960e08a883f4cffcacd219b758354" + "reference": "875e90aeea2777b6f135677f618529449334a612" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/511a08c03c1960e08a883f4cffcacd219b758354", - "reference": "511a08c03c1960e08a883f4cffcacd219b758354", + "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/875e90aeea2777b6f135677f618529449334a612", + "reference": "875e90aeea2777b6f135677f618529449334a612", "shasum": "" }, "require": { @@ -2186,7 +2184,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.27-dev" + "dev-main": "1.28-dev" }, "thanks": { "name": "symfony/polyfill", @@ -2226,7 +2224,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.27.0" + "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.28.0" }, "funding": [ { @@ -2242,20 +2240,20 @@ "type": "tidelift" } ], - "time": "2022-11-03T14:55:06+00:00" + "time": "2023-01-26T09:26:14+00:00" }, { "name": "symfony/polyfill-intl-normalizer", - "version": "v1.27.0", + "version": "v1.28.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-normalizer.git", - "reference": "19bd1e4fcd5b91116f14d8533c57831ed00571b6" + "reference": "8c4ad05dd0120b6a53c1ca374dca2ad0a1c4ed92" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/19bd1e4fcd5b91116f14d8533c57831ed00571b6", - "reference": "19bd1e4fcd5b91116f14d8533c57831ed00571b6", + "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/8c4ad05dd0120b6a53c1ca374dca2ad0a1c4ed92", + "reference": "8c4ad05dd0120b6a53c1ca374dca2ad0a1c4ed92", "shasum": "" }, "require": { @@ -2267,7 +2265,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.27-dev" + "dev-main": "1.28-dev" }, "thanks": { "name": "symfony/polyfill", @@ -2310,7 +2308,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.27.0" + "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.28.0" }, "funding": [ { @@ -2326,20 +2324,20 @@ "type": "tidelift" } ], - "time": "2022-11-03T14:55:06+00:00" + "time": "2023-01-26T09:26:14+00:00" }, { "name": "symfony/polyfill-mbstring", - "version": "v1.27.0", + "version": "v1.28.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "8ad114f6b39e2c98a8b0e3bd907732c207c2b534" + "reference": "42292d99c55abe617799667f454222c54c60e229" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/8ad114f6b39e2c98a8b0e3bd907732c207c2b534", - "reference": "8ad114f6b39e2c98a8b0e3bd907732c207c2b534", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/42292d99c55abe617799667f454222c54c60e229", + "reference": "42292d99c55abe617799667f454222c54c60e229", "shasum": "" }, "require": { @@ -2354,7 +2352,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.27-dev" + "dev-main": "1.28-dev" }, "thanks": { "name": "symfony/polyfill", @@ -2393,7 +2391,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.27.0" + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.28.0" }, "funding": [ { @@ -2409,20 +2407,20 @@ "type": "tidelift" } ], - "time": "2022-11-03T14:55:06+00:00" + "time": "2023-07-28T09:04:16+00:00" }, { "name": "symfony/service-contracts", - "version": "v3.2.1", + "version": "v3.3.0", "source": { "type": "git", "url": "https://github.com/symfony/service-contracts.git", - "reference": "a8c9cedf55f314f3a186041d19537303766df09a" + "reference": "40da9cc13ec349d9e4966ce18b5fbcd724ab10a4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/service-contracts/zipball/a8c9cedf55f314f3a186041d19537303766df09a", - "reference": "a8c9cedf55f314f3a186041d19537303766df09a", + "url": "https://api.github.com/repos/symfony/service-contracts/zipball/40da9cc13ec349d9e4966ce18b5fbcd724ab10a4", + "reference": "40da9cc13ec349d9e4966ce18b5fbcd724ab10a4", "shasum": "" }, "require": { @@ -2432,13 +2430,10 @@ "conflict": { "ext-psr": "<1.1|>=2" }, - "suggest": { - "symfony/service-implementation": "" - }, "type": "library", "extra": { "branch-alias": { - "dev-main": "3.3-dev" + "dev-main": "3.4-dev" }, "thanks": { "name": "symfony/contracts", @@ -2478,7 +2473,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/service-contracts/tree/v3.2.1" + "source": "https://github.com/symfony/service-contracts/tree/v3.3.0" }, "funding": [ { @@ -2494,20 +2489,20 @@ "type": "tidelift" } ], - "time": "2023-03-01T10:32:47+00:00" + "time": "2023-05-23T14:45:45+00:00" }, { "name": "symfony/string", - "version": "v6.2.8", + "version": "v6.3.2", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "193e83bbd6617d6b2151c37fff10fa7168ebddef" + "reference": "53d1a83225002635bca3482fcbf963001313fb68" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/193e83bbd6617d6b2151c37fff10fa7168ebddef", - "reference": "193e83bbd6617d6b2151c37fff10fa7168ebddef", + "url": "https://api.github.com/repos/symfony/string/zipball/53d1a83225002635bca3482fcbf963001313fb68", + "reference": "53d1a83225002635bca3482fcbf963001313fb68", "shasum": "" }, "require": { @@ -2518,13 +2513,13 @@ "symfony/polyfill-mbstring": "~1.0" }, "conflict": { - "symfony/translation-contracts": "<2.0" + "symfony/translation-contracts": "<2.5" }, "require-dev": { "symfony/error-handler": "^5.4|^6.0", "symfony/http-client": "^5.4|^6.0", "symfony/intl": "^6.2", - "symfony/translation-contracts": "^2.0|^3.0", + "symfony/translation-contracts": "^2.5|^3.0", "symfony/var-exporter": "^5.4|^6.0" }, "type": "library", @@ -2564,7 +2559,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v6.2.8" + "source": "https://github.com/symfony/string/tree/v6.3.2" }, "funding": [ { @@ -2580,7 +2575,7 @@ "type": "tidelift" } ], - "time": "2023-03-20T16:06:02+00:00" + "time": "2023-07-05T08:41:27+00:00" }, { "name": "theseer/tokenizer", @@ -2852,59 +2847,6 @@ ], "time": "2022-02-25T21:32:43+00:00" }, - { - "name": "dg/bypass-finals", - "version": "v1.4.1", - "source": { - "type": "git", - "url": "https://github.com/dg/bypass-finals.git", - "reference": "4c424c3ed359220fce044f35cdf9f48b0089b2ca" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/dg/bypass-finals/zipball/4c424c3ed359220fce044f35cdf9f48b0089b2ca", - "reference": "4c424c3ed359220fce044f35cdf9f48b0089b2ca", - "shasum": "" - }, - "require": { - "php": ">=7.1" - }, - "require-dev": { - "nette/tester": "^2.3", - "phpstan/phpstan": "^0.12" - }, - "type": "library", - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause", - "GPL-2.0", - "GPL-3.0" - ], - "authors": [ - { - "name": "David Grudl", - "homepage": "https://davidgrudl.com" - } - ], - "description": "Removes final keyword from source code on-the-fly and allows mocking of final methods and classes", - "keywords": [ - "finals", - "mocking", - "phpunit", - "testing", - "unit" - ], - "support": { - "issues": "https://github.com/dg/bypass-finals/issues", - "source": "https://github.com/dg/bypass-finals/tree/v1.4.1" - }, - "time": "2022-09-13T17:27:26+00:00" - }, { "name": "doctrine/annotations", "version": "2.0.1", @@ -3743,16 +3685,16 @@ }, { "name": "symfony/polyfill-php80", - "version": "v1.27.0", + "version": "v1.28.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php80.git", - "reference": "7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936" + "reference": "6caa57379c4aec19c0a12a38b59b26487dcfe4b5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936", - "reference": "7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936", + "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/6caa57379c4aec19c0a12a38b59b26487dcfe4b5", + "reference": "6caa57379c4aec19c0a12a38b59b26487dcfe4b5", "shasum": "" }, "require": { @@ -3761,7 +3703,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.27-dev" + "dev-main": "1.28-dev" }, "thanks": { "name": "symfony/polyfill", @@ -3806,7 +3748,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php80/tree/v1.27.0" + "source": "https://github.com/symfony/polyfill-php80/tree/v1.28.0" }, "funding": [ { @@ -3822,7 +3764,7 @@ "type": "tidelift" } ], - "time": "2022-11-03T14:55:06+00:00" + "time": "2023-01-26T09:26:14+00:00" }, { "name": "symfony/polyfill-php81", @@ -4377,7 +4319,7 @@ "prefer-stable": false, "prefer-lowest": false, "platform": { - "php": "^8.1 || ^8.2" + "php": "^8.1" }, "platform-dev": [], "plugin-api-version": "2.1.0" diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 956e2c6..5e6f5b6 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -6,13 +6,7 @@ colors="true" defaultTestSuite="unit" cacheDirectory=".phpunit.cache" - displayDetailsOnTestsThatTriggerWarnings="true" - bootstrap="tests/bootstrap.php"> - - - - - + displayDetailsOnTestsThatTriggerWarnings="true"> tests/OutputTest.php diff --git a/src/PhpUnitExtension.php b/src/PhpUnitExtension.php index a83972c..a41221a 100644 --- a/src/PhpUnitExtension.php +++ b/src/PhpUnitExtension.php @@ -8,6 +8,7 @@ use PHPUnit\Runner\Extension\ParameterCollection; use PHPUnit\TextUI\Configuration\Configuration as PHPUnitConfiguration; use RobinIngelbrecht\PHPUnitPrettyPrint\Subscriber\Application\ApplicationFinishedSubscriber; +use RobinIngelbrecht\PHPUnitPrettyPrint\Subscriber\Application\ApplicationStartedSubscriber; final class PhpUnitExtension implements Extension { @@ -33,6 +34,7 @@ public function bootstrap(PHPUnitConfiguration $configuration, Facade $facade, P EnsurePrinterIsRegisteredSubscriber::register(); + $facade->registerSubscriber(new ApplicationStartedSubscriber()); if (!$configuration->displayQuote()) { return; } diff --git a/src/Subscriber/Application/ApplicationStartedSubscriber.php b/src/Subscriber/Application/ApplicationStartedSubscriber.php new file mode 100644 index 0000000..82d133c --- /dev/null +++ b/src/Subscriber/Application/ApplicationStartedSubscriber.php @@ -0,0 +1,20 @@ +'); + render(sprintf( + '
  Runtime: %s
', + $event->runtime()->asString() + )); + } +} diff --git a/tests/OutputTest.php b/tests/OutputTest.php index 228c2aa..0676083 100644 --- a/tests/OutputTest.php +++ b/tests/OutputTest.php @@ -30,6 +30,8 @@ public function testWithProfiling(): void exec(implode(' ', $command), $out); $output = implode(PHP_EOL, $out); + + $this->assertMatchesRegularExpression('/Runtime: PHPUnit [\s\S]+ using PHP [\s\S]+ on [\s\S]+/', $output); $this->assertStringContainsString('Tests: 2 passed (4 assertions)', $output); $this->assertStringContainsString('Top 10 slowest tests', $output); } @@ -44,6 +46,8 @@ public function testWithProfilingAtRunTime(): void ]; exec(implode(' ', $command), $out); $output = implode(PHP_EOL, $out); + + $this->assertMatchesRegularExpression('/Runtime: PHPUnit [\s\S]+ using PHP [\s\S]+ on [\s\S]+/', $output); $this->assertStringContainsString('Tests: 2 passed (4 assertions)', $output); $this->assertStringContainsString('Top 10 slowest tests', $output); } @@ -57,6 +61,8 @@ public function testPrintCompactMode(): void exec(implode(' ', $command), $out); $output = implode(PHP_EOL, $out); + + $this->assertMatchesRegularExpression('/Runtime: PHPUnit [\s\S]+ using PHP [\s\S]+ on [\s\S]+/', $output); $this->assertStringContainsString('.⨯⨯⨯!si..', $output); $this->assertStringContainsString('Tests: 3 failed, 1 risky, 1 incomplete, 1 skipped, 3 passed (7 assertions)', $output); } @@ -70,6 +76,8 @@ public function testPrintCompactModeAtRunTime(): void ]; exec(implode(' ', $command), $out); $output = implode(PHP_EOL, $out); + + $this->assertMatchesRegularExpression('/Runtime: PHPUnit [\s\S]+ using PHP [\s\S]+ on [\s\S]+/', $output); $this->assertStringContainsString('.⨯⨯⨯!si..', $output); $this->assertStringContainsString('Tests: 3 failed, 1 risky, 1 incomplete, 1 skipped, 3 passed (7 assertions)', $output); } @@ -137,6 +145,8 @@ public function testItShouldBeEnabled(): void ]; exec(implode(' ', $command), $out); $output = implode(PHP_EOL, $out); + + $this->assertMatchesRegularExpression('/Runtime: PHPUnit [\s\S]+ using PHP [\s\S]+ on [\s\S]+/', $output); $this->assertStringContainsString('Tests: 2 passed (4 assertions)', $output); } @@ -149,6 +159,8 @@ public function testItShouldBeDisabled(): void ]; exec(implode(' ', $command), $out); $output = implode(PHP_EOL, $out); + + $this->assertDoesNotMatchRegularExpression('/Runtime: PHPUnit [\s\S]+ using PHP [\s\S]+ on [\s\S]+/', $output); $this->assertStringContainsString('OK (2 tests, 4 assertions)', $output); } } diff --git a/tests/Unit/PhpUnitExtensionTest.php b/tests/Unit/PhpUnitExtensionTest.php index 13b4c53..1dada27 100644 --- a/tests/Unit/PhpUnitExtensionTest.php +++ b/tests/Unit/PhpUnitExtensionTest.php @@ -2,12 +2,12 @@ namespace Tests\Unit; +use PHPUnit\Event\Facade as EventFacade; use PHPUnit\Framework\TestCase; use PHPUnit\Runner\Extension\Facade; use PHPUnit\Runner\Extension\ParameterCollection; use PHPUnit\TextUI\Configuration\Builder; use RobinIngelbrecht\PHPUnitPrettyPrint\PhpUnitExtension; -use RobinIngelbrecht\PHPUnitPrettyPrint\Subscriber\Application\ApplicationFinishedSubscriber; class PhpUnitExtensionTest extends TestCase { @@ -18,6 +18,13 @@ protected function setUp(): void parent::setUp(); $this->originalServer = $_SERVER; + + // We need to do some reflection magic here because of pour decisions in PHPUnit + $eventFacade = EventFacade::instance(); + $reflection = new \ReflectionClass($eventFacade); + $sealed = $reflection->getProperty('sealed'); + $sealed->setAccessible(true); + $sealed->setValue($eventFacade, false); } protected function tearDown(): void @@ -29,7 +36,8 @@ protected function tearDown(): void public function testBootstrapWithAllOptions(): void { - $facade = $this->createMock(Facade::class); + $facade = new Facade(); + $configuration = (new Builder())->build([]); $parameters = ParameterCollection::fromArray([ 'displayProfiling' => 'true', @@ -39,36 +47,23 @@ public function testBootstrapWithAllOptions(): void $extension = new PhpUnitExtension(); - $facade - ->expects($this->once()) - ->method('replaceOutput'); - - $facade - ->expects($this->once()) - ->method('replaceProgressOutput'); - - $facade - ->expects($this->once()) - ->method('replaceResultOutput'); - - $facade - ->expects($this->once()) - ->method('registerSubscriber') - ->with(new ApplicationFinishedSubscriber()); - $extension->bootstrap( $configuration, $facade, $parameters ); + $this->assertTrue($facade->replacesOutput()); + $this->assertTrue($facade->replacesProgressOutput()); + $this->assertTrue($facade->replacesResultOutput()); + $this->assertContains('COLLISION_PRINTER_COMPACT', array_keys($_SERVER)); $this->assertContains('COLLISION_PRINTER_PROFILE', array_keys($_SERVER)); } - public function testBootstrapInCompatMode(): void + public function testBootstrapInCompactMode(): void { - $facade = $this->createMock(Facade::class); + $facade = new Facade(); $configuration = (new Builder())->build([]); $parameters = ParameterCollection::fromArray([ 'useCompactMode' => 'true', @@ -76,35 +71,23 @@ public function testBootstrapInCompatMode(): void $extension = new PhpUnitExtension(); - $facade - ->expects($this->once()) - ->method('replaceOutput'); - - $facade - ->expects($this->once()) - ->method('replaceProgressOutput'); - - $facade - ->expects($this->once()) - ->method('replaceResultOutput'); - - $facade - ->expects($this->never()) - ->method('registerSubscriber'); - $extension->bootstrap( $configuration, $facade, $parameters ); + $this->assertTrue($facade->replacesOutput()); + $this->assertTrue($facade->replacesProgressOutput()); + $this->assertTrue($facade->replacesResultOutput()); + $this->assertContains('COLLISION_PRINTER_COMPACT', array_keys($_SERVER)); $this->assertNotContains('COLLISION_PRINTER_PROFILE', array_keys($_SERVER)); } public function testBootstrapWithDisplayProfiling(): void { - $facade = $this->createMock(Facade::class); + $facade = new Facade(); $configuration = (new Builder())->build([]); $parameters = ParameterCollection::fromArray([ 'displayProfiling' => 'true', @@ -112,35 +95,23 @@ public function testBootstrapWithDisplayProfiling(): void $extension = new PhpUnitExtension(); - $facade - ->expects($this->once()) - ->method('replaceOutput'); - - $facade - ->expects($this->once()) - ->method('replaceProgressOutput'); - - $facade - ->expects($this->once()) - ->method('replaceResultOutput'); - - $facade - ->expects($this->never()) - ->method('registerSubscriber'); - $extension->bootstrap( $configuration, $facade, $parameters ); + $this->assertTrue($facade->replacesOutput()); + $this->assertTrue($facade->replacesProgressOutput()); + $this->assertTrue($facade->replacesResultOutput()); + $this->assertNotContains('COLLISION_PRINTER_COMPACT', array_keys($_SERVER)); $this->assertContains('COLLISION_PRINTER_PROFILE', array_keys($_SERVER)); } public function testBootstrapWithDisplayQuote(): void { - $facade = $this->createMock(Facade::class); + $facade = new Facade(); $configuration = (new Builder())->build([]); $parameters = ParameterCollection::fromArray([ 'displayQuote' => 'true', @@ -148,36 +119,23 @@ public function testBootstrapWithDisplayQuote(): void $extension = new PhpUnitExtension(); - $facade - ->expects($this->once()) - ->method('replaceOutput'); - - $facade - ->expects($this->once()) - ->method('replaceProgressOutput'); - - $facade - ->expects($this->once()) - ->method('replaceResultOutput'); - - $facade - ->expects($this->once()) - ->method('registerSubscriber') - ->with(new ApplicationFinishedSubscriber()); - $extension->bootstrap( $configuration, $facade, $parameters ); + $this->assertTrue($facade->replacesOutput()); + $this->assertTrue($facade->replacesProgressOutput()); + $this->assertTrue($facade->replacesResultOutput()); + $this->assertNotContains('COLLISION_PRINTER_COMPACT', array_keys($_SERVER)); $this->assertNotContains('COLLISION_PRINTER_PROFILE', array_keys($_SERVER)); } public function testItShouldBeEnabledThroughCli(): void { - $facade = $this->createMock(Facade::class); + $facade = new Facade(); $configuration = (new Builder())->build([]); $parameters = ParameterCollection::fromArray([ 'displayProfiling' => 'true', @@ -188,23 +146,6 @@ public function testItShouldBeEnabledThroughCli(): void $extension = new PhpUnitExtension(); - $facade - ->expects($this->once()) - ->method('replaceOutput'); - - $facade - ->expects($this->once()) - ->method('replaceProgressOutput'); - - $facade - ->expects($this->once()) - ->method('replaceResultOutput'); - - $facade - ->expects($this->once()) - ->method('registerSubscriber') - ->with(new ApplicationFinishedSubscriber()); - $_SERVER['argv'][] = '--enable-pretty-print'; $extension->bootstrap( @@ -213,13 +154,17 @@ public function testItShouldBeEnabledThroughCli(): void $parameters ); + $this->assertTrue($facade->replacesOutput()); + $this->assertTrue($facade->replacesProgressOutput()); + $this->assertTrue($facade->replacesResultOutput()); + $this->assertContains('COLLISION_PRINTER_COMPACT', array_keys($_SERVER)); $this->assertContains('COLLISION_PRINTER_PROFILE', array_keys($_SERVER)); } public function testItShouldBeDisabledThroughCli(): void { - $facade = $this->createMock(Facade::class); + $facade = new Facade(); $configuration = (new Builder())->build([]); $parameters = ParameterCollection::fromArray([ 'displayProfiling' => 'true', @@ -229,23 +174,6 @@ public function testItShouldBeDisabledThroughCli(): void $extension = new PhpUnitExtension(); - $facade - ->expects($this->never()) - ->method('replaceOutput'); - - $facade - ->expects($this->never()) - ->method('replaceProgressOutput'); - - $facade - ->expects($this->never()) - ->method('replaceResultOutput'); - - $facade - ->expects($this->never()) - ->method('registerSubscriber') - ->with(new ApplicationFinishedSubscriber()); - $_SERVER['argv'][] = '--disable-pretty-print'; $extension->bootstrap( @@ -254,13 +182,17 @@ public function testItShouldBeDisabledThroughCli(): void $parameters ); + $this->assertFalse($facade->replacesOutput()); + $this->assertFalse($facade->replacesProgressOutput()); + $this->assertFalse($facade->replacesResultOutput()); + $this->assertNotContains('COLLISION_PRINTER_COMPACT', array_keys($_SERVER)); $this->assertNotContains('COLLISION_PRINTER_PROFILE', array_keys($_SERVER)); } public function testItShouldBeEnabledWithParameter(): void { - $facade = $this->createMock(Facade::class); + $facade = new Facade(); $configuration = (new Builder())->build([]); $parameters = ParameterCollection::fromArray([ 'displayProfiling' => 'true', @@ -271,36 +203,23 @@ public function testItShouldBeEnabledWithParameter(): void $extension = new PhpUnitExtension(); - $facade - ->expects($this->once()) - ->method('replaceOutput'); - - $facade - ->expects($this->once()) - ->method('replaceProgressOutput'); - - $facade - ->expects($this->once()) - ->method('replaceResultOutput'); - - $facade - ->expects($this->once()) - ->method('registerSubscriber') - ->with(new ApplicationFinishedSubscriber()); - $extension->bootstrap( $configuration, $facade, $parameters ); + $this->assertTrue($facade->replacesOutput()); + $this->assertTrue($facade->replacesProgressOutput()); + $this->assertTrue($facade->replacesResultOutput()); + $this->assertContains('COLLISION_PRINTER_COMPACT', array_keys($_SERVER)); $this->assertContains('COLLISION_PRINTER_PROFILE', array_keys($_SERVER)); } public function testItShouldBeDisabledWithParameter(): void { - $facade = $this->createMock(Facade::class); + $facade = new Facade(); $configuration = (new Builder())->build([]); $parameters = ParameterCollection::fromArray([ 'displayProfiling' => 'true', @@ -311,29 +230,16 @@ public function testItShouldBeDisabledWithParameter(): void $extension = new PhpUnitExtension(); - $facade - ->expects($this->never()) - ->method('replaceOutput'); - - $facade - ->expects($this->never()) - ->method('replaceProgressOutput'); - - $facade - ->expects($this->never()) - ->method('replaceResultOutput'); - - $facade - ->expects($this->never()) - ->method('registerSubscriber') - ->with(new ApplicationFinishedSubscriber()); - $extension->bootstrap( $configuration, $facade, $parameters ); + $this->assertFalse($facade->replacesOutput()); + $this->assertFalse($facade->replacesProgressOutput()); + $this->assertFalse($facade->replacesResultOutput()); + $this->assertNotContains('COLLISION_PRINTER_COMPACT', array_keys($_SERVER)); $this->assertNotContains('COLLISION_PRINTER_PROFILE', array_keys($_SERVER)); } diff --git a/tests/Unit/Subscriber/Application/ApplicationFinishedSubscriberTest.php b/tests/Unit/Subscriber/Application/ApplicationFinishedSubscriberTest.php index f42b23b..e448037 100644 --- a/tests/Unit/Subscriber/Application/ApplicationFinishedSubscriberTest.php +++ b/tests/Unit/Subscriber/Application/ApplicationFinishedSubscriberTest.php @@ -32,7 +32,7 @@ public function testNotify(): void HRTime::fromSecondsAndNanoseconds(1, 0), MemoryUsage::fromBytes(100), MemoryUsage::fromBytes(100), - new GarbageCollectorStatus(0, 0, 0, 0, null, null, null, null) + new GarbageCollectorStatus(0, 0, 0, 0, null, null, null, null, null, null, null, null) ), Duration::fromSecondsAndNanoseconds(1, 0), MemoryUsage::fromBytes(100), diff --git a/tests/bootstrap.php b/tests/bootstrap.php deleted file mode 100644 index b7a30ed..0000000 --- a/tests/bootstrap.php +++ /dev/null @@ -1,5 +0,0 @@ - Date: Fri, 8 Sep 2023 15:34:13 +0200 Subject: [PATCH 2/2] Added extra unit test --- .../ApplicationStartedSubscriberTest.php | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 tests/Unit/Subscriber/Application/ApplicationStartedSubscriberTest.php diff --git a/tests/Unit/Subscriber/Application/ApplicationStartedSubscriberTest.php b/tests/Unit/Subscriber/Application/ApplicationStartedSubscriberTest.php new file mode 100644 index 0000000..4e72710 --- /dev/null +++ b/tests/Unit/Subscriber/Application/ApplicationStartedSubscriberTest.php @@ -0,0 +1,48 @@ +notify(new Started( + new Info( + new Snapshot( + HRTime::fromSecondsAndNanoseconds(1, 0), + MemoryUsage::fromBytes(100), + MemoryUsage::fromBytes(100), + new GarbageCollectorStatus(0, 0, 0, 0, null, null, null, null, null, null, null, null) + ), + Duration::fromSecondsAndNanoseconds(1, 0), + MemoryUsage::fromBytes(100), + Duration::fromSecondsAndNanoseconds(1, 0), + MemoryUsage::fromBytes(100), + ), + new Runtime() + )); + + $this->assertMatchesRegularExpression('/Runtime: PHPUnit [\s\S]+ using PHP [\s\S]+ on [\s\S]+/', $spyOutput); + } +}