From 3690457450982688391c7cab576169b36ca06533 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 10 Feb 2025 09:32:24 -0500 Subject: [PATCH] chore(deps): update dependency phpunit/phpunit to v12 (#275) * chore(deps): update dependency phpunit/phpunit to v12 * fix test * fix test part 2 --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Antoine Giasson --- composer.json | 2 +- composer.lock | 516 +++++++++++---------------- tests/LogLevelHelperTest.php | 5 +- tests/LoggerDecoratorTest.php | 5 +- tests/Traits/InterpolateTest.php | 26 +- tests/Traits/PrependContextTest.php | 25 +- tests/Traits/PrependDateTimeTest.php | 18 +- tests/Traits/PrependLogLevelTest.php | 17 +- tests/Writer/ConsoleTest.php | 4 +- 9 files changed, 239 insertions(+), 379 deletions(-) diff --git a/composer.json b/composer.json index c152b500..ea471add 100644 --- a/composer.json +++ b/composer.json @@ -32,7 +32,7 @@ "require-dev": { "guzzlehttp/guzzle": "7.9.2", "fluent/logger": "1.0.1", - "phpunit/phpunit": "11.5.7", + "phpunit/phpunit": "12.0.2", "vimeo/psalm": "6.5.0", "dealerdirect/phpcodesniffer-composer-installer": "1.0.0", "phpcompatibility/php-compatibility": "9.3.5", diff --git a/composer.lock b/composer.lock index 141cbfb2..88fb2d04 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": "853a7cf72be5021694b25c511cbea1c9", + "content-hash": "b42b76bac951f88b6989bbbd42315a94", "packages": [ { "name": "psr/log", @@ -3372,35 +3372,34 @@ }, { "name": "phpunit/php-code-coverage", - "version": "11.0.8", + "version": "12.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "418c59fd080954f8c4aa5631d9502ecda2387118" + "reference": "69dde560510151f7d04315fac6c72016cc5d7bc8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/418c59fd080954f8c4aa5631d9502ecda2387118", - "reference": "418c59fd080954f8c4aa5631d9502ecda2387118", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/69dde560510151f7d04315fac6c72016cc5d7bc8", + "reference": "69dde560510151f7d04315fac6c72016cc5d7bc8", "shasum": "" }, "require": { "ext-dom": "*", "ext-libxml": "*", "ext-xmlwriter": "*", - "nikic/php-parser": "^5.3.1", - "php": ">=8.2", - "phpunit/php-file-iterator": "^5.1.0", - "phpunit/php-text-template": "^4.0.1", - "sebastian/code-unit-reverse-lookup": "^4.0.1", - "sebastian/complexity": "^4.0.1", - "sebastian/environment": "^7.2.0", - "sebastian/lines-of-code": "^3.0.1", - "sebastian/version": "^5.0.2", + "nikic/php-parser": "^5.4.0", + "php": ">=8.3", + "phpunit/php-file-iterator": "^6.0", + "phpunit/php-text-template": "^5.0", + "sebastian/complexity": "^5.0", + "sebastian/environment": "^8.0", + "sebastian/lines-of-code": "^4.0", + "sebastian/version": "^6.0", "theseer/tokenizer": "^1.2.3" }, "require-dev": { - "phpunit/phpunit": "^11.5.0" + "phpunit/phpunit": "^12.0" }, "suggest": { "ext-pcov": "PHP extension that provides line coverage", @@ -3409,7 +3408,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "11.0.x-dev" + "dev-main": "12.0.x-dev" } }, "autoload": { @@ -3438,7 +3437,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/11.0.8" + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/12.0.2" }, "funding": [ { @@ -3446,32 +3445,32 @@ "type": "github" } ], - "time": "2024-12-11T12:34:27+00:00" + "time": "2025-02-08T09:08:00+00:00" }, { "name": "phpunit/php-file-iterator", - "version": "5.1.0", + "version": "6.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "118cfaaa8bc5aef3287bf315b6060b1174754af6" + "reference": "961bc913d42fe24a257bfff826a5068079ac7782" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/118cfaaa8bc5aef3287bf315b6060b1174754af6", - "reference": "118cfaaa8bc5aef3287bf315b6060b1174754af6", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/961bc913d42fe24a257bfff826a5068079ac7782", + "reference": "961bc913d42fe24a257bfff826a5068079ac7782", "shasum": "" }, "require": { - "php": ">=8.2" + "php": ">=8.3" }, "require-dev": { - "phpunit/phpunit": "^11.0" + "phpunit/phpunit": "^12.0" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "5.0-dev" + "dev-main": "6.0-dev" } }, "autoload": { @@ -3499,7 +3498,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/php-file-iterator/issues", "security": "https://github.com/sebastianbergmann/php-file-iterator/security/policy", - "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/5.1.0" + "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/6.0.0" }, "funding": [ { @@ -3507,28 +3506,28 @@ "type": "github" } ], - "time": "2024-08-27T05:02:59+00:00" + "time": "2025-02-07T04:58:37+00:00" }, { "name": "phpunit/php-invoker", - "version": "5.0.1", + "version": "6.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-invoker.git", - "reference": "c1ca3814734c07492b3d4c5f794f4b0995333da2" + "reference": "12b54e689b07a25a9b41e57736dfab6ec9ae5406" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-invoker/zipball/c1ca3814734c07492b3d4c5f794f4b0995333da2", - "reference": "c1ca3814734c07492b3d4c5f794f4b0995333da2", + "url": "https://api.github.com/repos/sebastianbergmann/php-invoker/zipball/12b54e689b07a25a9b41e57736dfab6ec9ae5406", + "reference": "12b54e689b07a25a9b41e57736dfab6ec9ae5406", "shasum": "" }, "require": { - "php": ">=8.2" + "php": ">=8.3" }, "require-dev": { "ext-pcntl": "*", - "phpunit/phpunit": "^11.0" + "phpunit/phpunit": "^12.0" }, "suggest": { "ext-pcntl": "*" @@ -3536,7 +3535,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "5.0-dev" + "dev-main": "6.0-dev" } }, "autoload": { @@ -3563,7 +3562,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/php-invoker/issues", "security": "https://github.com/sebastianbergmann/php-invoker/security/policy", - "source": "https://github.com/sebastianbergmann/php-invoker/tree/5.0.1" + "source": "https://github.com/sebastianbergmann/php-invoker/tree/6.0.0" }, "funding": [ { @@ -3571,32 +3570,32 @@ "type": "github" } ], - "time": "2024-07-03T05:07:44+00:00" + "time": "2025-02-07T04:58:58+00:00" }, { "name": "phpunit/php-text-template", - "version": "4.0.1", + "version": "5.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-text-template.git", - "reference": "3e0404dc6b300e6bf56415467ebcb3fe4f33e964" + "reference": "e1367a453f0eda562eedb4f659e13aa900d66c53" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/3e0404dc6b300e6bf56415467ebcb3fe4f33e964", - "reference": "3e0404dc6b300e6bf56415467ebcb3fe4f33e964", + "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/e1367a453f0eda562eedb4f659e13aa900d66c53", + "reference": "e1367a453f0eda562eedb4f659e13aa900d66c53", "shasum": "" }, "require": { - "php": ">=8.2" + "php": ">=8.3" }, "require-dev": { - "phpunit/phpunit": "^11.0" + "phpunit/phpunit": "^12.0" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "4.0-dev" + "dev-main": "5.0-dev" } }, "autoload": { @@ -3623,7 +3622,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/php-text-template/issues", "security": "https://github.com/sebastianbergmann/php-text-template/security/policy", - "source": "https://github.com/sebastianbergmann/php-text-template/tree/4.0.1" + "source": "https://github.com/sebastianbergmann/php-text-template/tree/5.0.0" }, "funding": [ { @@ -3631,32 +3630,32 @@ "type": "github" } ], - "time": "2024-07-03T05:08:43+00:00" + "time": "2025-02-07T04:59:16+00:00" }, { "name": "phpunit/php-timer", - "version": "7.0.1", + "version": "8.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-timer.git", - "reference": "3b415def83fbcb41f991d9ebf16ae4ad8b7837b3" + "reference": "f258ce36aa457f3aa3339f9ed4c81fc66dc8c2cc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/3b415def83fbcb41f991d9ebf16ae4ad8b7837b3", - "reference": "3b415def83fbcb41f991d9ebf16ae4ad8b7837b3", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/f258ce36aa457f3aa3339f9ed4c81fc66dc8c2cc", + "reference": "f258ce36aa457f3aa3339f9ed4c81fc66dc8c2cc", "shasum": "" }, "require": { - "php": ">=8.2" + "php": ">=8.3" }, "require-dev": { - "phpunit/phpunit": "^11.0" + "phpunit/phpunit": "^12.0" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "7.0-dev" + "dev-main": "8.0-dev" } }, "autoload": { @@ -3683,7 +3682,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/php-timer/issues", "security": "https://github.com/sebastianbergmann/php-timer/security/policy", - "source": "https://github.com/sebastianbergmann/php-timer/tree/7.0.1" + "source": "https://github.com/sebastianbergmann/php-timer/tree/8.0.0" }, "funding": [ { @@ -3691,20 +3690,20 @@ "type": "github" } ], - "time": "2024-07-03T05:09:35+00:00" + "time": "2025-02-07T04:59:38+00:00" }, { "name": "phpunit/phpunit", - "version": "11.5.7", + "version": "12.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "e1cb706f019e2547039ca2c839898cd5f557ee5d" + "reference": "6301fe5c1f5f34192ffd650a87fe055677a32212" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/e1cb706f019e2547039ca2c839898cd5f557ee5d", - "reference": "e1cb706f019e2547039ca2c839898cd5f557ee5d", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/6301fe5c1f5f34192ffd650a87fe055677a32212", + "reference": "6301fe5c1f5f34192ffd650a87fe055677a32212", "shasum": "" }, "require": { @@ -3717,34 +3716,30 @@ "myclabs/deep-copy": "^1.12.1", "phar-io/manifest": "^2.0.4", "phar-io/version": "^3.2.1", - "php": ">=8.2", - "phpunit/php-code-coverage": "^11.0.8", - "phpunit/php-file-iterator": "^5.1.0", - "phpunit/php-invoker": "^5.0.1", - "phpunit/php-text-template": "^4.0.1", - "phpunit/php-timer": "^7.0.1", - "sebastian/cli-parser": "^3.0.2", - "sebastian/code-unit": "^3.0.2", - "sebastian/comparator": "^6.3.0", - "sebastian/diff": "^6.0.2", - "sebastian/environment": "^7.2.0", - "sebastian/exporter": "^6.3.0", - "sebastian/global-state": "^7.0.2", - "sebastian/object-enumerator": "^6.0.1", - "sebastian/type": "^5.1.0", - "sebastian/version": "^5.0.2", + "php": ">=8.3", + "phpunit/php-code-coverage": "^12.0.2", + "phpunit/php-file-iterator": "^6.0.0", + "phpunit/php-invoker": "^6.0.0", + "phpunit/php-text-template": "^5.0.0", + "phpunit/php-timer": "^8.0.0", + "sebastian/cli-parser": "^4.0.0", + "sebastian/comparator": "^7.0.0", + "sebastian/diff": "^7.0.0", + "sebastian/environment": "^8.0.0", + "sebastian/exporter": "^7.0.0", + "sebastian/global-state": "^8.0.0", + "sebastian/object-enumerator": "^7.0.0", + "sebastian/type": "^6.0.0", + "sebastian/version": "^6.0.0", "staabm/side-effects-detector": "^1.0.5" }, - "suggest": { - "ext-soap": "To be able to generate mocks based on WSDL files" - }, "bin": [ "phpunit" ], "type": "library", "extra": { "branch-alias": { - "dev-main": "11.5-dev" + "dev-main": "12.0-dev" } }, "autoload": { @@ -3776,7 +3771,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", "security": "https://github.com/sebastianbergmann/phpunit/security/policy", - "source": "https://github.com/sebastianbergmann/phpunit/tree/11.5.7" + "source": "https://github.com/sebastianbergmann/phpunit/tree/12.0.2" }, "funding": [ { @@ -3792,7 +3787,7 @@ "type": "tidelift" } ], - "time": "2025-02-06T16:10:05+00:00" + "time": "2025-02-08T09:18:47+00:00" }, { "name": "psr/container", @@ -4125,28 +4120,28 @@ }, { "name": "sebastian/cli-parser", - "version": "3.0.2", + "version": "4.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/cli-parser.git", - "reference": "15c5dd40dc4f38794d383bb95465193f5e0ae180" + "reference": "6d584c727d9114bcdc14c86711cd1cad51778e7c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/15c5dd40dc4f38794d383bb95465193f5e0ae180", - "reference": "15c5dd40dc4f38794d383bb95465193f5e0ae180", + "url": "https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/6d584c727d9114bcdc14c86711cd1cad51778e7c", + "reference": "6d584c727d9114bcdc14c86711cd1cad51778e7c", "shasum": "" }, "require": { - "php": ">=8.2" + "php": ">=8.3" }, "require-dev": { - "phpunit/phpunit": "^11.0" + "phpunit/phpunit": "^12.0" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "3.0-dev" + "dev-main": "4.0-dev" } }, "autoload": { @@ -4170,64 +4165,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/cli-parser/issues", "security": "https://github.com/sebastianbergmann/cli-parser/security/policy", - "source": "https://github.com/sebastianbergmann/cli-parser/tree/3.0.2" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2024-07-03T04:41:36+00:00" - }, - { - "name": "sebastian/code-unit", - "version": "3.0.2", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/code-unit.git", - "reference": "ee88b0cdbe74cf8dd3b54940ff17643c0d6543ca" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/code-unit/zipball/ee88b0cdbe74cf8dd3b54940ff17643c0d6543ca", - "reference": "ee88b0cdbe74cf8dd3b54940ff17643c0d6543ca", - "shasum": "" - }, - "require": { - "php": ">=8.2" - }, - "require-dev": { - "phpunit/phpunit": "^11.5" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "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": "Collection of value objects that represent the PHP code units", - "homepage": "https://github.com/sebastianbergmann/code-unit", - "support": { - "issues": "https://github.com/sebastianbergmann/code-unit/issues", - "security": "https://github.com/sebastianbergmann/code-unit/security/policy", - "source": "https://github.com/sebastianbergmann/code-unit/tree/3.0.2" + "source": "https://github.com/sebastianbergmann/cli-parser/tree/4.0.0" }, "funding": [ { @@ -4235,87 +4173,31 @@ "type": "github" } ], - "time": "2024-12-12T09:59:06+00:00" - }, - { - "name": "sebastian/code-unit-reverse-lookup", - "version": "4.0.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", - "reference": "183a9b2632194febd219bb9246eee421dad8d45e" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/183a9b2632194febd219bb9246eee421dad8d45e", - "reference": "183a9b2632194febd219bb9246eee421dad8d45e", - "shasum": "" - }, - "require": { - "php": ">=8.2" - }, - "require-dev": { - "phpunit/phpunit": "^11.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "4.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Looks up which function or method a line of code belongs to", - "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", - "support": { - "issues": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/issues", - "security": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/security/policy", - "source": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/tree/4.0.1" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2024-07-03T04:45:54+00:00" + "time": "2025-02-07T04:53:50+00:00" }, { "name": "sebastian/comparator", - "version": "6.3.0", + "version": "7.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "d4e47a769525c4dd38cea90e5dcd435ddbbc7115" + "reference": "18eb5a4f854dbd1d6512c459b605de2edb5a0b47" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/d4e47a769525c4dd38cea90e5dcd435ddbbc7115", - "reference": "d4e47a769525c4dd38cea90e5dcd435ddbbc7115", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/18eb5a4f854dbd1d6512c459b605de2edb5a0b47", + "reference": "18eb5a4f854dbd1d6512c459b605de2edb5a0b47", "shasum": "" }, "require": { "ext-dom": "*", "ext-mbstring": "*", - "php": ">=8.2", - "sebastian/diff": "^6.0", - "sebastian/exporter": "^6.0" + "php": ">=8.3", + "sebastian/diff": "^7.0", + "sebastian/exporter": "^7.0" }, "require-dev": { - "phpunit/phpunit": "^11.4" + "phpunit/phpunit": "^12.0" }, "suggest": { "ext-bcmath": "For comparing BcMath\\Number objects" @@ -4323,7 +4205,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "6.2-dev" + "dev-main": "7.0-dev" } }, "autoload": { @@ -4363,7 +4245,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/comparator/issues", "security": "https://github.com/sebastianbergmann/comparator/security/policy", - "source": "https://github.com/sebastianbergmann/comparator/tree/6.3.0" + "source": "https://github.com/sebastianbergmann/comparator/tree/7.0.0" }, "funding": [ { @@ -4371,33 +4253,33 @@ "type": "github" } ], - "time": "2025-01-06T10:28:19+00:00" + "time": "2025-02-07T04:54:52+00:00" }, { "name": "sebastian/complexity", - "version": "4.0.1", + "version": "5.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/complexity.git", - "reference": "ee41d384ab1906c68852636b6de493846e13e5a0" + "reference": "bad4316aba5303d0221f43f8cee37eb58d384bbb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/ee41d384ab1906c68852636b6de493846e13e5a0", - "reference": "ee41d384ab1906c68852636b6de493846e13e5a0", + "url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/bad4316aba5303d0221f43f8cee37eb58d384bbb", + "reference": "bad4316aba5303d0221f43f8cee37eb58d384bbb", "shasum": "" }, "require": { "nikic/php-parser": "^5.0", - "php": ">=8.2" + "php": ">=8.3" }, "require-dev": { - "phpunit/phpunit": "^11.0" + "phpunit/phpunit": "^12.0" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "4.0-dev" + "dev-main": "5.0-dev" } }, "autoload": { @@ -4421,7 +4303,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/complexity/issues", "security": "https://github.com/sebastianbergmann/complexity/security/policy", - "source": "https://github.com/sebastianbergmann/complexity/tree/4.0.1" + "source": "https://github.com/sebastianbergmann/complexity/tree/5.0.0" }, "funding": [ { @@ -4429,33 +4311,33 @@ "type": "github" } ], - "time": "2024-07-03T04:49:50+00:00" + "time": "2025-02-07T04:55:25+00:00" }, { "name": "sebastian/diff", - "version": "6.0.2", + "version": "7.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "b4ccd857127db5d41a5b676f24b51371d76d8544" + "reference": "7ab1ea946c012266ca32390913653d844ecd085f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/b4ccd857127db5d41a5b676f24b51371d76d8544", - "reference": "b4ccd857127db5d41a5b676f24b51371d76d8544", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/7ab1ea946c012266ca32390913653d844ecd085f", + "reference": "7ab1ea946c012266ca32390913653d844ecd085f", "shasum": "" }, "require": { - "php": ">=8.2" + "php": ">=8.3" }, "require-dev": { - "phpunit/phpunit": "^11.0", - "symfony/process": "^4.2 || ^5" + "phpunit/phpunit": "^12.0", + "symfony/process": "^7.2" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "6.0-dev" + "dev-main": "7.0-dev" } }, "autoload": { @@ -4488,7 +4370,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/diff/issues", "security": "https://github.com/sebastianbergmann/diff/security/policy", - "source": "https://github.com/sebastianbergmann/diff/tree/6.0.2" + "source": "https://github.com/sebastianbergmann/diff/tree/7.0.0" }, "funding": [ { @@ -4496,27 +4378,27 @@ "type": "github" } ], - "time": "2024-07-03T04:53:05+00:00" + "time": "2025-02-07T04:55:46+00:00" }, { "name": "sebastian/environment", - "version": "7.2.0", + "version": "8.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "855f3ae0ab316bbafe1ba4e16e9f3c078d24a0c5" + "reference": "8afe311eca49171bf95405cc0078be9a3821f9f2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/855f3ae0ab316bbafe1ba4e16e9f3c078d24a0c5", - "reference": "855f3ae0ab316bbafe1ba4e16e9f3c078d24a0c5", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/8afe311eca49171bf95405cc0078be9a3821f9f2", + "reference": "8afe311eca49171bf95405cc0078be9a3821f9f2", "shasum": "" }, "require": { - "php": ">=8.2" + "php": ">=8.3" }, "require-dev": { - "phpunit/phpunit": "^11.0" + "phpunit/phpunit": "^12.0" }, "suggest": { "ext-posix": "*" @@ -4524,7 +4406,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "7.2-dev" + "dev-main": "8.0-dev" } }, "autoload": { @@ -4552,7 +4434,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/environment/issues", "security": "https://github.com/sebastianbergmann/environment/security/policy", - "source": "https://github.com/sebastianbergmann/environment/tree/7.2.0" + "source": "https://github.com/sebastianbergmann/environment/tree/8.0.0" }, "funding": [ { @@ -4560,34 +4442,34 @@ "type": "github" } ], - "time": "2024-07-03T04:54:44+00:00" + "time": "2025-02-07T04:56:08+00:00" }, { "name": "sebastian/exporter", - "version": "6.3.0", + "version": "7.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "3473f61172093b2da7de1fb5782e1f24cc036dc3" + "reference": "76432aafc58d50691a00d86d0632f1217a47b688" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/3473f61172093b2da7de1fb5782e1f24cc036dc3", - "reference": "3473f61172093b2da7de1fb5782e1f24cc036dc3", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/76432aafc58d50691a00d86d0632f1217a47b688", + "reference": "76432aafc58d50691a00d86d0632f1217a47b688", "shasum": "" }, "require": { "ext-mbstring": "*", - "php": ">=8.2", - "sebastian/recursion-context": "^6.0" + "php": ">=8.3", + "sebastian/recursion-context": "^7.0" }, "require-dev": { - "phpunit/phpunit": "^11.3" + "phpunit/phpunit": "^12.0" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "6.1-dev" + "dev-main": "7.0-dev" } }, "autoload": { @@ -4630,7 +4512,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/exporter/issues", "security": "https://github.com/sebastianbergmann/exporter/security/policy", - "source": "https://github.com/sebastianbergmann/exporter/tree/6.3.0" + "source": "https://github.com/sebastianbergmann/exporter/tree/7.0.0" }, "funding": [ { @@ -4638,35 +4520,35 @@ "type": "github" } ], - "time": "2024-12-05T09:17:50+00:00" + "time": "2025-02-07T04:56:42+00:00" }, { "name": "sebastian/global-state", - "version": "7.0.2", + "version": "8.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "3be331570a721f9a4b5917f4209773de17f747d7" + "reference": "570a2aeb26d40f057af686d63c4e99b075fb6cbc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/3be331570a721f9a4b5917f4209773de17f747d7", - "reference": "3be331570a721f9a4b5917f4209773de17f747d7", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/570a2aeb26d40f057af686d63c4e99b075fb6cbc", + "reference": "570a2aeb26d40f057af686d63c4e99b075fb6cbc", "shasum": "" }, "require": { - "php": ">=8.2", - "sebastian/object-reflector": "^4.0", - "sebastian/recursion-context": "^6.0" + "php": ">=8.3", + "sebastian/object-reflector": "^5.0", + "sebastian/recursion-context": "^7.0" }, "require-dev": { "ext-dom": "*", - "phpunit/phpunit": "^11.0" + "phpunit/phpunit": "^12.0" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "7.0-dev" + "dev-main": "8.0-dev" } }, "autoload": { @@ -4692,7 +4574,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/global-state/issues", "security": "https://github.com/sebastianbergmann/global-state/security/policy", - "source": "https://github.com/sebastianbergmann/global-state/tree/7.0.2" + "source": "https://github.com/sebastianbergmann/global-state/tree/8.0.0" }, "funding": [ { @@ -4700,33 +4582,33 @@ "type": "github" } ], - "time": "2024-07-03T04:57:36+00:00" + "time": "2025-02-07T04:56:59+00:00" }, { "name": "sebastian/lines-of-code", - "version": "3.0.1", + "version": "4.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/lines-of-code.git", - "reference": "d36ad0d782e5756913e42ad87cb2890f4ffe467a" + "reference": "97ffee3bcfb5805568d6af7f0f893678fc076d2f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/d36ad0d782e5756913e42ad87cb2890f4ffe467a", - "reference": "d36ad0d782e5756913e42ad87cb2890f4ffe467a", + "url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/97ffee3bcfb5805568d6af7f0f893678fc076d2f", + "reference": "97ffee3bcfb5805568d6af7f0f893678fc076d2f", "shasum": "" }, "require": { "nikic/php-parser": "^5.0", - "php": ">=8.2" + "php": ">=8.3" }, "require-dev": { - "phpunit/phpunit": "^11.0" + "phpunit/phpunit": "^12.0" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "3.0-dev" + "dev-main": "4.0-dev" } }, "autoload": { @@ -4750,7 +4632,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/lines-of-code/issues", "security": "https://github.com/sebastianbergmann/lines-of-code/security/policy", - "source": "https://github.com/sebastianbergmann/lines-of-code/tree/3.0.1" + "source": "https://github.com/sebastianbergmann/lines-of-code/tree/4.0.0" }, "funding": [ { @@ -4758,34 +4640,34 @@ "type": "github" } ], - "time": "2024-07-03T04:58:38+00:00" + "time": "2025-02-07T04:57:28+00:00" }, { "name": "sebastian/object-enumerator", - "version": "6.0.1", + "version": "7.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/object-enumerator.git", - "reference": "f5b498e631a74204185071eb41f33f38d64608aa" + "reference": "1effe8e9b8e068e9ae228e542d5d11b5d16db894" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/f5b498e631a74204185071eb41f33f38d64608aa", - "reference": "f5b498e631a74204185071eb41f33f38d64608aa", + "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/1effe8e9b8e068e9ae228e542d5d11b5d16db894", + "reference": "1effe8e9b8e068e9ae228e542d5d11b5d16db894", "shasum": "" }, "require": { - "php": ">=8.2", - "sebastian/object-reflector": "^4.0", - "sebastian/recursion-context": "^6.0" + "php": ">=8.3", + "sebastian/object-reflector": "^5.0", + "sebastian/recursion-context": "^7.0" }, "require-dev": { - "phpunit/phpunit": "^11.0" + "phpunit/phpunit": "^12.0" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "6.0-dev" + "dev-main": "7.0-dev" } }, "autoload": { @@ -4808,7 +4690,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/object-enumerator/issues", "security": "https://github.com/sebastianbergmann/object-enumerator/security/policy", - "source": "https://github.com/sebastianbergmann/object-enumerator/tree/6.0.1" + "source": "https://github.com/sebastianbergmann/object-enumerator/tree/7.0.0" }, "funding": [ { @@ -4816,32 +4698,32 @@ "type": "github" } ], - "time": "2024-07-03T05:00:13+00:00" + "time": "2025-02-07T04:57:48+00:00" }, { "name": "sebastian/object-reflector", - "version": "4.0.1", + "version": "5.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/object-reflector.git", - "reference": "6e1a43b411b2ad34146dee7524cb13a068bb35f9" + "reference": "4bfa827c969c98be1e527abd576533293c634f6a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/6e1a43b411b2ad34146dee7524cb13a068bb35f9", - "reference": "6e1a43b411b2ad34146dee7524cb13a068bb35f9", + "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/4bfa827c969c98be1e527abd576533293c634f6a", + "reference": "4bfa827c969c98be1e527abd576533293c634f6a", "shasum": "" }, "require": { - "php": ">=8.2" + "php": ">=8.3" }, "require-dev": { - "phpunit/phpunit": "^11.0" + "phpunit/phpunit": "^12.0" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "4.0-dev" + "dev-main": "5.0-dev" } }, "autoload": { @@ -4864,7 +4746,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/object-reflector/issues", "security": "https://github.com/sebastianbergmann/object-reflector/security/policy", - "source": "https://github.com/sebastianbergmann/object-reflector/tree/4.0.1" + "source": "https://github.com/sebastianbergmann/object-reflector/tree/5.0.0" }, "funding": [ { @@ -4872,32 +4754,32 @@ "type": "github" } ], - "time": "2024-07-03T05:01:32+00:00" + "time": "2025-02-07T04:58:17+00:00" }, { "name": "sebastian/recursion-context", - "version": "6.0.2", + "version": "7.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/recursion-context.git", - "reference": "694d156164372abbd149a4b85ccda2e4670c0e16" + "reference": "c405ae3a63e01b32eb71577f8ec1604e39858a7c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/694d156164372abbd149a4b85ccda2e4670c0e16", - "reference": "694d156164372abbd149a4b85ccda2e4670c0e16", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/c405ae3a63e01b32eb71577f8ec1604e39858a7c", + "reference": "c405ae3a63e01b32eb71577f8ec1604e39858a7c", "shasum": "" }, "require": { - "php": ">=8.2" + "php": ">=8.3" }, "require-dev": { - "phpunit/phpunit": "^11.0" + "phpunit/phpunit": "^12.0" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "6.0-dev" + "dev-main": "7.0-dev" } }, "autoload": { @@ -4928,7 +4810,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/recursion-context/issues", "security": "https://github.com/sebastianbergmann/recursion-context/security/policy", - "source": "https://github.com/sebastianbergmann/recursion-context/tree/6.0.2" + "source": "https://github.com/sebastianbergmann/recursion-context/tree/7.0.0" }, "funding": [ { @@ -4936,32 +4818,32 @@ "type": "github" } ], - "time": "2024-07-03T05:10:34+00:00" + "time": "2025-02-07T05:00:01+00:00" }, { "name": "sebastian/type", - "version": "5.1.0", + "version": "6.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/type.git", - "reference": "461b9c5da241511a2a0e8f240814fb23ce5c0aac" + "reference": "533fe082889a616f330bcba6f50965135f4f2fab" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/461b9c5da241511a2a0e8f240814fb23ce5c0aac", - "reference": "461b9c5da241511a2a0e8f240814fb23ce5c0aac", + "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/533fe082889a616f330bcba6f50965135f4f2fab", + "reference": "533fe082889a616f330bcba6f50965135f4f2fab", "shasum": "" }, "require": { - "php": ">=8.2" + "php": ">=8.3" }, "require-dev": { - "phpunit/phpunit": "^11.3" + "phpunit/phpunit": "^12.0" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "5.1-dev" + "dev-main": "6.0-dev" } }, "autoload": { @@ -4985,7 +4867,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/type/issues", "security": "https://github.com/sebastianbergmann/type/security/policy", - "source": "https://github.com/sebastianbergmann/type/tree/5.1.0" + "source": "https://github.com/sebastianbergmann/type/tree/6.0.0" }, "funding": [ { @@ -4993,29 +4875,29 @@ "type": "github" } ], - "time": "2024-09-17T13:12:04+00:00" + "time": "2025-02-07T05:00:19+00:00" }, { "name": "sebastian/version", - "version": "5.0.2", + "version": "6.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/version.git", - "reference": "c687e3387b99f5b03b6caa64c74b63e2936ff874" + "reference": "3e6ccf7657d4f0a59200564b08cead899313b53c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/c687e3387b99f5b03b6caa64c74b63e2936ff874", - "reference": "c687e3387b99f5b03b6caa64c74b63e2936ff874", + "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/3e6ccf7657d4f0a59200564b08cead899313b53c", + "reference": "3e6ccf7657d4f0a59200564b08cead899313b53c", "shasum": "" }, "require": { - "php": ">=8.2" + "php": ">=8.3" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "5.0-dev" + "dev-main": "6.0-dev" } }, "autoload": { @@ -5039,7 +4921,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/version/issues", "security": "https://github.com/sebastianbergmann/version/security/policy", - "source": "https://github.com/sebastianbergmann/version/tree/5.0.2" + "source": "https://github.com/sebastianbergmann/version/tree/6.0.0" }, "funding": [ { @@ -5047,7 +4929,7 @@ "type": "github" } ], - "time": "2024-10-09T05:16:32+00:00" + "time": "2025-02-07T05:00:38+00:00" }, { "name": "sentry/sentry", diff --git a/tests/LogLevelHelperTest.php b/tests/LogLevelHelperTest.php index 2f6e43e5..d45eb0a2 100644 --- a/tests/LogLevelHelperTest.php +++ b/tests/LogLevelHelperTest.php @@ -2,6 +2,7 @@ use Kronos\Log\Exception\InvalidLogLevel; use Kronos\Log\LogLevelHelper; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Psr\Log\LogLevel; @@ -14,9 +15,7 @@ public function test_isLower_shouldReturnFalseWhenLevelIsEqual(): void self::assertFalse($isLower); } - /** - * @dataProvider provideLevels - */ + #[DataProvider('provideLevels')] public function test_isLower_shouldReturnFalseWhenLevelIsHigher($baseLevel, $toCompare): void { $isLower = LogLevelHelper::isLower($baseLevel, $toCompare); diff --git a/tests/LoggerDecoratorTest.php b/tests/LoggerDecoratorTest.php index f010b45a..157c3c4e 100644 --- a/tests/LoggerDecoratorTest.php +++ b/tests/LoggerDecoratorTest.php @@ -3,6 +3,7 @@ use Kronos\Log\Logger; use Kronos\Log\LoggerDecorator; use Kronos\Log\LoggerInterface; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use Psr\Log\LoggerInterface as PsrLoggerInterface; @@ -28,9 +29,7 @@ public function test_shouldLogWhenMessageLevelIsHigherThanLogger(): void $decorator->log(LogLevel::WARNING, 'a message'); } - /** - * @dataProvider provideLowerLogLevels - */ + #[DataProvider('provideLowerLogLevels')] public function test_shouldNotLogWhenLoggerLevelIsHigherThanMessage($loggerLevel, $levelOfMessage): void { $decorator = $this->givenDecoratorForPsrLoggerInterface(); diff --git a/tests/Traits/InterpolateTest.php b/tests/Traits/InterpolateTest.php index 1c8d3532..b27ad952 100644 --- a/tests/Traits/InterpolateTest.php +++ b/tests/Traits/InterpolateTest.php @@ -1,32 +1,26 @@ interpolator = $this->getMockForTrait(Interpolate::class); - } - public function test_MessageWithPlaceholder_Interpolate_ShouldReplacePlaceholderWithContextValue() { $original_message = self::A_MESSAGE; - $interpolated_message = $this->interpolator->interpolate($original_message, [self::KEY => self::VALUE]); + $interpolated_message = $this->interpolate($original_message, [self::KEY => self::VALUE]); $this->assertEquals(self::INTERPOLATED_MESSAGE, $interpolated_message); } @@ -35,7 +29,7 @@ public function test_ContextWithoutMessagePlaceholder_Interpolate_ShouldReplaceP { $original_message = self::A_MESSAGE; - $interpolated_message = $this->interpolator->interpolate($original_message, []); + $interpolated_message = $this->interpolate($original_message, []); $this->assertEquals(self::MESSAGE_WITH_UNDEFINED, $interpolated_message); } @@ -46,7 +40,7 @@ public function test_ObjectInContext_Interpolate_ShouldReplaceWithUndefined() $object = new ObjectWithoutToString(); $object->property = 'value'; - $interpolated_message = $this->interpolator->interpolate($original_message, [self::KEY => $object]); + $interpolated_message = $this->interpolate($original_message, [self::KEY => $object]); $this->assertEquals(self::MESSAGE_WITH_UNDEFINED, $interpolated_message); } @@ -58,7 +52,7 @@ public function test_ObjectWithToStringInContext_Interpolate_ShouldReplacePlaceh $object->property = 'value'; $expectedMessage = str_replace('{' . self::KEY . '}', (string)$object, self::A_MESSAGE); - $interpolated_message = $this->interpolator->interpolate($original_message, [self::KEY => $object]); + $interpolated_message = $this->interpolate($original_message, [self::KEY => $object]); $this->assertEquals($expectedMessage, $interpolated_message); } @@ -68,7 +62,7 @@ public function test_ArrayInContext_Interpolate_ShouldReplaceWithUndefined() $original_message = self::A_MESSAGE; $array = ['index' => 'value']; - $interpolated_message = $this->interpolator->interpolate($original_message, [self::KEY => $array]); + $interpolated_message = $this->interpolate($original_message, [self::KEY => $array]); $this->assertEquals(self::MESSAGE_WITH_UNDEFINED, $interpolated_message); } @@ -79,7 +73,7 @@ public function test_ZeroInContext_Interpolate_ShouldReplaceWithZero() $value = 0; $expectedMessage = str_replace('{' . self::KEY . '}', $value, self::A_MESSAGE); - $interpolated_message = $this->interpolator->interpolate($original_message, [self::KEY => $value]); + $interpolated_message = $this->interpolate($original_message, [self::KEY => $value]); $this->assertEquals($expectedMessage, $interpolated_message); } diff --git a/tests/Traits/PrependContextTest.php b/tests/Traits/PrependContextTest.php index 174b0051..82ad391f 100644 --- a/tests/Traits/PrependContextTest.php +++ b/tests/Traits/PrependContextTest.php @@ -3,9 +3,11 @@ namespace Kronos\Tests\Log\Traits; use Kronos\Log\Traits\PrependContext; +use PHPUnit\Framework\TestCase; -class PrependContextTest extends \PHPUnit\Framework\TestCase +class PrependContextTest extends TestCase { + use PrependContext; const A_MESSAGE = 'a message'; const CONTEXT_KEY = 'key'; @@ -18,14 +20,9 @@ class PrependContextTest extends \PHPUnit\Framework\TestCase private $context_prepender; - public function setUp(): void - { - $this->context_prepender = $this->getMockForTrait(PrependContext::class); - } - public function test_NewPrependContext_PrependContext_ShouldReturnMessageUnchanged() { - $returned_message = $this->context_prepender->prependContext(self::A_MESSAGE, []); + $returned_message = $this->prependContext(self::A_MESSAGE, []); $this->assertEquals(self::A_MESSAGE, $returned_message); } @@ -35,9 +32,9 @@ public function test_ContextKeyToPrepend_PrependContext_ShouldReturnMessagePrepe $context = [ self::CONTEXT_KEY => self::CONTEXT_VALUE ]; - $this->context_prepender->addContextKeyToPrepend(self::CONTEXT_KEY); + $this->addContextKeyToPrepend(self::CONTEXT_KEY); - $returned_message = $this->context_prepender->prependContext(self::A_MESSAGE, $context); + $returned_message = $this->prependContext(self::A_MESSAGE, $context); $this->assertEquals(self::CONTEXT_VALUE . ' ' . self::A_MESSAGE, $returned_message); } @@ -47,9 +44,9 @@ public function test_UnknownContextKeyToPrepend_PrependContext_ShouldReturnMessa $context = [ self::CONTEXT_KEY => self::CONTEXT_VALUE ]; - $this->context_prepender->addContextKeyToPrepend(self::ANOTHER_CONTEXT_KEY); + $this->addContextKeyToPrepend(self::ANOTHER_CONTEXT_KEY); - $returned_message = $this->context_prepender->prependContext(self::A_MESSAGE, $context); + $returned_message = $this->prependContext(self::A_MESSAGE, $context); $this->assertEquals(self::A_MESSAGE, $returned_message); } @@ -60,10 +57,10 @@ public function test_MoreThanOneKeyToPrepend_PrependContext_ShouldPrependThemInO self::FIRST_KEY => self::FIRST_VALUE, self::SECOND_KEY => self::SECOND_VALUE ]; - $this->context_prepender->addContextKeyToPrepend(self::FIRST_KEY); - $this->context_prepender->addContextKeyToPrepend(self::SECOND_KEY); + $this->addContextKeyToPrepend(self::FIRST_KEY); + $this->addContextKeyToPrepend(self::SECOND_KEY); - $returned_message = $this->context_prepender->prependContext(self::A_MESSAGE, $context); + $returned_message = $this->prependContext(self::A_MESSAGE, $context); $expected_message = self::FIRST_VALUE . ' ' . self::SECOND_VALUE . ' ' . self::A_MESSAGE; $this->assertEquals($expected_message, $returned_message); diff --git a/tests/Traits/PrependDateTimeTest.php b/tests/Traits/PrependDateTimeTest.php index 864b30fa..11ecde27 100644 --- a/tests/Traits/PrependDateTimeTest.php +++ b/tests/Traits/PrependDateTimeTest.php @@ -3,32 +3,26 @@ namespace Kronos\Tests\Log\Traits; use Kronos\Log\Traits\PrependDateTime; +use PHPUnit\Framework\TestCase; -class PrependDateTimeTest extends \PHPUnit\Framework\TestCase +class PrependDateTimeTest extends TestCase { - + use PrependDateTime; const A_MESSAGE = ' a message'; const DATETIME_REGEX = '\[\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}\]'; - private $datetime_prepender; - - public function setUp(): void - { - $this->datetime_prepender = $this->getMockForTrait(PrependDateTime::class); - } - public function test_NewPrepender_PrependDateTime_ShouldReturnGivenMessage() { - $returned_message = $this->datetime_prepender->prependDateTime(self::A_MESSAGE); + $returned_message = $this->prependDateTime(self::A_MESSAGE); $this->assertSame(self::A_MESSAGE, $returned_message); } public function test_PrependerSetPrependDateTime_PrependDateTime_ShouldReturnGivenMessagePrependedWithTime() { - $this->datetime_prepender->setPrependDateTime(); + $this->setPrependDateTime(); - $returned_message = $this->datetime_prepender->prependDateTime(self::A_MESSAGE); + $returned_message = $this->prependDateTime(self::A_MESSAGE); $this->assertMatchesRegularExpression('/' . self::DATETIME_REGEX . '' . self::A_MESSAGE . '/', $returned_message); } diff --git a/tests/Traits/PrependLogLevelTest.php b/tests/Traits/PrependLogLevelTest.php index 48a9f08e..c3488fdf 100644 --- a/tests/Traits/PrependLogLevelTest.php +++ b/tests/Traits/PrependLogLevelTest.php @@ -3,33 +3,28 @@ namespace Kronos\Tests\Log\Traits; use Kronos\Log\Traits\PrependLogLevel; +use PHPUnit\Framework\TestCase; use Psr\Log\LogLevel; -class PrependLogLevelTest extends \PHPUnit\Framework\TestCase +class PrependLogLevelTest extends TestCase { + use PrependLogLevel; const A_MESSAGE = 'a message'; const ANY_LOG_LEVEL = LogLevel::INFO; - private $loglevel_prepender; - - public function setUp(): void - { - $this->loglevel_prepender = $this->getMockForTrait(PrependLogLevel::class); - } - public function test_NewPrepender_PrependLogLevel_ShouldReturnGivenMessage() { - $returned_message = $this->loglevel_prepender->prependLogLevel(self::ANY_LOG_LEVEL, self::A_MESSAGE); + $returned_message = $this->prependLogLevel(self::ANY_LOG_LEVEL, self::A_MESSAGE); $this->assertEquals(self::A_MESSAGE, $returned_message); } public function test_PrependerSetPrependLogLevel_PrependLogLevel_ShouldPrependMessageWithLogLevelInUpperCase() { - $this->loglevel_prepender->setPrependLogLevel(); + $this->setPrependLogLevel(); - $returned_message = $this->loglevel_prepender->prependLogLevel(self::ANY_LOG_LEVEL, self::A_MESSAGE); + $returned_message = $this->prependLogLevel(self::ANY_LOG_LEVEL, self::A_MESSAGE); $this->assertEquals(strtoupper(self::ANY_LOG_LEVEL) . ' : ' . self::A_MESSAGE, $returned_message); } diff --git a/tests/Writer/ConsoleTest.php b/tests/Writer/ConsoleTest.php index 26523e0f..643e9bde 100644 --- a/tests/Writer/ConsoleTest.php +++ b/tests/Writer/ConsoleTest.php @@ -242,10 +242,10 @@ private function givenFactoryReturnFileAdaptors() $this->fileFactory ->method('createTTYAdaptor') - ->will(self::returnValueMap([ + ->willReturnMap([ [Console::STDOUT, $this->stdout], [Console::STDERR, $this->stderr], - ])); + ]); } private function expectsWriteToBeCalled(TTY&MockObject $file, $message, $text_color = null, $background_color = null)