Skip to content

EspoCRM – Open Source CRM Application

phpunit update

Yuri Kuznetsova468c423476c
diff --git a/composer.json b/composer.json
index 6255a47692..7961ee6b58 100644
--- a/composer.json
+++ b/composer.json
@@ -58,7 +58,7 @@
"psr/clock": "^1.0"
},
"require-dev": {
- "phpunit/phpunit": "^9.5",
+ "phpunit/phpunit": "^11.5",
"phpstan/phpstan": "^2.1"
},
"suggest": {
diff --git a/composer.lock b/composer.lock
index ea52d60359..d2b7f0d535 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": "60833a543fd7f0ed10be53d868d984bf",
+ "content-hash": "6d5fe3b3c8776218dbb0b02e45ff4cde",
"packages": [
{
"name": "async-aws/core",
@@ -8035,88 +8035,18 @@
}
],
"packages-dev": [
- {
- "name": "doctrine/instantiator",
- "version": "2.0.0",
- "source": {
- "type": "git",
- "url": "https://github.com/doctrine/instantiator.git",
- "reference": "c6222283fa3f4ac679f8b9ced9a4e23f163e80d0"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/doctrine/instantiator/zipball/c6222283fa3f4ac679f8b9ced9a4e23f163e80d0",
- "reference": "c6222283fa3f4ac679f8b9ced9a4e23f163e80d0",
- "shasum": ""
- },
- "require": {
- "php": "^8.1"
- },
- "require-dev": {
- "doctrine/coding-standard": "^11",
- "ext-pdo": "*",
- "ext-phar": "*",
- "phpbench/phpbench": "^1.2",
- "phpstan/phpstan": "^1.9.4",
- "phpstan/phpstan-phpunit": "^1.3",
- "phpunit/phpunit": "^9.5.27",
- "vimeo/psalm": "^5.4"
- },
- "type": "library",
- "autoload": {
- "psr-4": {
- "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/"
- }
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "MIT"
- ],
- "authors": [
- {
- "name": "Marco Pivetta",
- "email": "[email protected]",
- "homepage": "https://ocramius.github.io/"
- }
- ],
- "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors",
- "homepage": "https://www.doctrine-project.org/projects/instantiator.html",
- "keywords": [
- "constructor",
- "instantiate"
- ],
- "support": {
- "issues": "https://github.com/doctrine/instantiator/issues",
- "source": "https://github.com/doctrine/instantiator/tree/2.0.0"
- },
- "funding": [
- {
- "url": "https://www.doctrine-project.org/sponsorship.html",
- "type": "custom"
- },
- {
- "url": "https://www.patreon.com/phpdoctrine",
- "type": "patreon"
- },
- {
- "url": "https://tidelift.com/funding/github/packagist/doctrine%2Finstantiator",
- "type": "tidelift"
- }
- ],
- "time": "2022-12-30T00:23:10+00:00"
- },
{
"name": "myclabs/deep-copy",
- "version": "1.12.1",
+ "version": "1.13.3",
"source": {
"type": "git",
"url": "https://github.com/myclabs/DeepCopy.git",
- "reference": "123267b2c49fbf30d78a7b2d333f6be754b94845"
+ "reference": "faed855a7b5f4d4637717c2b3863e277116beb36"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/123267b2c49fbf30d78a7b2d333f6be754b94845",
- "reference": "123267b2c49fbf30d78a7b2d333f6be754b94845",
+ "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/faed855a7b5f4d4637717c2b3863e277116beb36",
+ "reference": "faed855a7b5f4d4637717c2b3863e277116beb36",
"shasum": ""
},
"require": {
@@ -8155,7 +8085,7 @@
],
"support": {
"issues": "https://github.com/myclabs/DeepCopy/issues",
- "source": "https://github.com/myclabs/DeepCopy/tree/1.12.1"
+ "source": "https://github.com/myclabs/DeepCopy/tree/1.13.3"
},
"funding": [
{
@@ -8163,20 +8093,20 @@
"type": "tidelift"
}
],
- "time": "2024-11-08T17:47:46+00:00"
+ "time": "2025-07-05T12:25:42+00:00"
},
{
"name": "nikic/php-parser",
- "version": "v5.4.0",
+ "version": "v5.5.0",
"source": {
"type": "git",
"url": "https://github.com/nikic/PHP-Parser.git",
- "reference": "447a020a1f875a434d62f2a401f53b82a396e494"
+ "reference": "ae59794362fe85e051a58ad36b289443f57be7a9"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/447a020a1f875a434d62f2a401f53b82a396e494",
- "reference": "447a020a1f875a434d62f2a401f53b82a396e494",
+ "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/ae59794362fe85e051a58ad36b289443f57be7a9",
+ "reference": "ae59794362fe85e051a58ad36b289443f57be7a9",
"shasum": ""
},
"require": {
@@ -8219,9 +8149,9 @@
],
"support": {
"issues": "https://github.com/nikic/PHP-Parser/issues",
- "source": "https://github.com/nikic/PHP-Parser/tree/v5.4.0"
+ "source": "https://github.com/nikic/PHP-Parser/tree/v5.5.0"
},
- "time": "2024-12-30T11:07:19+00:00"
+ "time": "2025-05-31T08:24:38+00:00"
},
{
"name": "phar-io/manifest",
@@ -8401,35 +8331,35 @@
},
{
"name": "phpunit/php-code-coverage",
- "version": "9.2.32",
+ "version": "11.0.10",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-code-coverage.git",
- "reference": "85402a822d1ecf1db1096959413d35e1c37cf1a5"
+ "reference": "1a800a7446add2d79cc6b3c01c45381810367d76"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/85402a822d1ecf1db1096959413d35e1c37cf1a5",
- "reference": "85402a822d1ecf1db1096959413d35e1c37cf1a5",
+ "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/1a800a7446add2d79cc6b3c01c45381810367d76",
+ "reference": "1a800a7446add2d79cc6b3c01c45381810367d76",
"shasum": ""
},
"require": {
"ext-dom": "*",
"ext-libxml": "*",
"ext-xmlwriter": "*",
- "nikic/php-parser": "^4.19.1 || ^5.1.0",
- "php": ">=7.3",
- "phpunit/php-file-iterator": "^3.0.6",
- "phpunit/php-text-template": "^2.0.4",
- "sebastian/code-unit-reverse-lookup": "^2.0.3",
- "sebastian/complexity": "^2.0.3",
- "sebastian/environment": "^5.1.5",
- "sebastian/lines-of-code": "^1.0.4",
- "sebastian/version": "^3.0.2",
+ "nikic/php-parser": "^5.4.0",
+ "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",
"theseer/tokenizer": "^1.2.3"
},
"require-dev": {
- "phpunit/phpunit": "^9.6"
+ "phpunit/phpunit": "^11.5.2"
},
"suggest": {
"ext-pcov": "PHP extension that provides line coverage",
@@ -8438,7 +8368,7 @@
"type": "library",
"extra": {
"branch-alias": {
- "dev-main": "9.2.x-dev"
+ "dev-main": "11.0.x-dev"
}
},
"autoload": {
@@ -8467,40 +8397,52 @@
"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/9.2.32"
+ "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/show"
},
"funding": [
{
"url": "https://github.com/sebastianbergmann",
"type": "github"
+ },
+ {
+ "url": "https://liberapay.com/sebastianbergmann",
+ "type": "liberapay"
+ },
+ {
+ "url": "https://thanks.dev/u/gh/sebastianbergmann",
+ "type": "thanks_dev"
+ },
+ {
+ "url": "https://tidelift.com/funding/github/packagist/phpunit/php-code-coverage",
+ "type": "tidelift"
}
],
- "time": "2024-08-22T04:23:01+00:00"
+ "time": "2025-06-18T08:56:18+00:00"
},
{
"name": "phpunit/php-file-iterator",
- "version": "3.0.6",
+ "version": "5.1.0",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-file-iterator.git",
- "reference": "cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf"
+ "reference": "118cfaaa8bc5aef3287bf315b6060b1174754af6"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf",
- "reference": "cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf",
+ "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/118cfaaa8bc5aef3287bf315b6060b1174754af6",
+ "reference": "118cfaaa8bc5aef3287bf315b6060b1174754af6",
"shasum": ""
},
"require": {
- "php": ">=7.3"
+ "php": ">=8.2"
},
"require-dev": {
- "phpunit/phpunit": "^9.3"
+ "phpunit/phpunit": "^11.0"
},
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "3.0-dev"
+ "dev-main": "5.0-dev"
}
},
"autoload": {
@@ -8527,7 +8469,8 @@
],
"support": {
"issues": "https://github.com/sebastianbergmann/php-file-iterator/issues",
- "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/3.0.6"
+ "security": "https://github.com/sebastianbergmann/php-file-iterator/security/policy",
+ "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/5.1.0"
},
"funding": [
{
@@ -8535,28 +8478,28 @@
"type": "github"
}
],
- "time": "2021-12-02T12:48:52+00:00"
+ "time": "2024-08-27T05:02:59+00:00"
},
{
"name": "phpunit/php-invoker",
- "version": "3.1.1",
+ "version": "5.0.1",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-invoker.git",
- "reference": "5a10147d0aaf65b58940a0b72f71c9ac0423cc67"
+ "reference": "c1ca3814734c07492b3d4c5f794f4b0995333da2"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/php-invoker/zipball/5a10147d0aaf65b58940a0b72f71c9ac0423cc67",
- "reference": "5a10147d0aaf65b58940a0b72f71c9ac0423cc67",
+ "url": "https://api.github.com/repos/sebastianbergmann/php-invoker/zipball/c1ca3814734c07492b3d4c5f794f4b0995333da2",
+ "reference": "c1ca3814734c07492b3d4c5f794f4b0995333da2",
"shasum": ""
},
"require": {
- "php": ">=7.3"
+ "php": ">=8.2"
},
"require-dev": {
"ext-pcntl": "*",
- "phpunit/phpunit": "^9.3"
+ "phpunit/phpunit": "^11.0"
},
"suggest": {
"ext-pcntl": "*"
@@ -8564,7 +8507,7 @@
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "3.1-dev"
+ "dev-main": "5.0-dev"
}
},
"autoload": {
@@ -8590,7 +8533,8 @@
],
"support": {
"issues": "https://github.com/sebastianbergmann/php-invoker/issues",
- "source": "https://github.com/sebastianbergmann/php-invoker/tree/3.1.1"
+ "security": "https://github.com/sebastianbergmann/php-invoker/security/policy",
+ "source": "https://github.com/sebastianbergmann/php-invoker/tree/5.0.1"
},
"funding": [
{
@@ -8598,32 +8542,32 @@
"type": "github"
}
],
- "time": "2020-09-28T05:58:55+00:00"
+ "time": "2024-07-03T05:07:44+00:00"
},
{
"name": "phpunit/php-text-template",
- "version": "2.0.4",
+ "version": "4.0.1",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-text-template.git",
- "reference": "5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28"
+ "reference": "3e0404dc6b300e6bf56415467ebcb3fe4f33e964"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28",
- "reference": "5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28",
+ "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/3e0404dc6b300e6bf56415467ebcb3fe4f33e964",
+ "reference": "3e0404dc6b300e6bf56415467ebcb3fe4f33e964",
"shasum": ""
},
"require": {
- "php": ">=7.3"
+ "php": ">=8.2"
},
"require-dev": {
- "phpunit/phpunit": "^9.3"
+ "phpunit/phpunit": "^11.0"
},
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "2.0-dev"
+ "dev-main": "4.0-dev"
}
},
"autoload": {
@@ -8649,7 +8593,8 @@
],
"support": {
"issues": "https://github.com/sebastianbergmann/php-text-template/issues",
- "source": "https://github.com/sebastianbergmann/php-text-template/tree/2.0.4"
+ "security": "https://github.com/sebastianbergmann/php-text-template/security/policy",
+ "source": "https://github.com/sebastianbergmann/php-text-template/tree/4.0.1"
},
"funding": [
{
@@ -8657,32 +8602,32 @@
"type": "github"
}
],
- "time": "2020-10-26T05:33:50+00:00"
+ "time": "2024-07-03T05:08:43+00:00"
},
{
"name": "phpunit/php-timer",
- "version": "5.0.3",
+ "version": "7.0.1",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-timer.git",
- "reference": "5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2"
+ "reference": "3b415def83fbcb41f991d9ebf16ae4ad8b7837b3"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2",
- "reference": "5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2",
+ "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/3b415def83fbcb41f991d9ebf16ae4ad8b7837b3",
+ "reference": "3b415def83fbcb41f991d9ebf16ae4ad8b7837b3",
"shasum": ""
},
"require": {
- "php": ">=7.3"
+ "php": ">=8.2"
},
"require-dev": {
- "phpunit/phpunit": "^9.3"
+ "phpunit/phpunit": "^11.0"
},
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "5.0-dev"
+ "dev-main": "7.0-dev"
}
},
"autoload": {
@@ -8708,7 +8653,8 @@
],
"support": {
"issues": "https://github.com/sebastianbergmann/php-timer/issues",
- "source": "https://github.com/sebastianbergmann/php-timer/tree/5.0.3"
+ "security": "https://github.com/sebastianbergmann/php-timer/security/policy",
+ "source": "https://github.com/sebastianbergmann/php-timer/tree/7.0.1"
},
"funding": [
{
@@ -8716,54 +8662,52 @@
"type": "github"
}
],
- "time": "2020-10-26T13:16:10+00:00"
+ "time": "2024-07-03T05:09:35+00:00"
},
{
"name": "phpunit/phpunit",
- "version": "9.6.21",
+ "version": "11.5.26",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/phpunit.git",
- "reference": "de6abf3b6f8dd955fac3caad3af7a9504e8c2ffa"
+ "reference": "4ad8fe263a0b55b54a8028c38a18e3c5bef312e0"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/de6abf3b6f8dd955fac3caad3af7a9504e8c2ffa",
- "reference": "de6abf3b6f8dd955fac3caad3af7a9504e8c2ffa",
+ "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/4ad8fe263a0b55b54a8028c38a18e3c5bef312e0",
+ "reference": "4ad8fe263a0b55b54a8028c38a18e3c5bef312e0",
"shasum": ""
},
"require": {
- "doctrine/instantiator": "^1.5.0 || ^2",
"ext-dom": "*",
"ext-json": "*",
"ext-libxml": "*",
"ext-mbstring": "*",
"ext-xml": "*",
"ext-xmlwriter": "*",
- "myclabs/deep-copy": "^1.12.0",
+ "myclabs/deep-copy": "^1.13.1",
"phar-io/manifest": "^2.0.4",
"phar-io/version": "^3.2.1",
- "php": ">=7.3",
- "phpunit/php-code-coverage": "^9.2.32",
- "phpunit/php-file-iterator": "^3.0.6",
- "phpunit/php-invoker": "^3.1.1",
- "phpunit/php-text-template": "^2.0.4",
- "phpunit/php-timer": "^5.0.3",
- "sebastian/cli-parser": "^1.0.2",
- "sebastian/code-unit": "^1.0.8",
- "sebastian/comparator": "^4.0.8",
- "sebastian/diff": "^4.0.6",
- "sebastian/environment": "^5.1.5",
- "sebastian/exporter": "^4.0.6",
- "sebastian/global-state": "^5.0.7",
- "sebastian/object-enumerator": "^4.0.4",
- "sebastian/resource-operations": "^3.0.4",
- "sebastian/type": "^3.2.1",
- "sebastian/version": "^3.0.2"
+ "php": ">=8.2",
+ "phpunit/php-code-coverage": "^11.0.10",
+ "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.3",
+ "sebastian/comparator": "^6.3.1",
+ "sebastian/diff": "^6.0.2",
+ "sebastian/environment": "^7.2.1",
+ "sebastian/exporter": "^6.3.0",
+ "sebastian/global-state": "^7.0.2",
+ "sebastian/object-enumerator": "^6.0.1",
+ "sebastian/type": "^5.1.2",
+ "sebastian/version": "^5.0.2",
+ "staabm/side-effects-detector": "^1.0.5"
},
"suggest": {
- "ext-soap": "To be able to generate mocks based on WSDL files",
- "ext-xdebug": "PHP extension that provides line coverage as well as branch and path coverage"
+ "ext-soap": "To be able to generate mocks based on WSDL files"
},
"bin": [
"phpunit"
@@ -8771,7 +8715,7 @@
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "9.6-dev"
+ "dev-main": "11.5-dev"
}
},
"autoload": {
@@ -8803,7 +8747,7 @@
"support": {
"issues": "https://github.com/sebastianbergmann/phpunit/issues",
"security": "https://github.com/sebastianbergmann/phpunit/security/policy",
- "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.21"
+ "source": "https://github.com/sebastianbergmann/phpunit/tree/11.5.26"
},
"funding": [
{
@@ -8814,37 +8758,45 @@
"url": "https://github.com/sebastianbergmann",
"type": "github"
},
+ {
+ "url": "https://liberapay.com/sebastianbergmann",
+ "type": "liberapay"
+ },
+ {
+ "url": "https://thanks.dev/u/gh/sebastianbergmann",
+ "type": "thanks_dev"
+ },
{
"url": "https://tidelift.com/funding/github/packagist/phpunit/phpunit",
"type": "tidelift"
}
],
- "time": "2024-09-19T10:50:18+00:00"
+ "time": "2025-07-04T05:58:21+00:00"
},
{
"name": "sebastian/cli-parser",
- "version": "1.0.2",
+ "version": "3.0.2",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/cli-parser.git",
- "reference": "2b56bea83a09de3ac06bb18b92f068e60cc6f50b"
+ "reference": "15c5dd40dc4f38794d383bb95465193f5e0ae180"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/2b56bea83a09de3ac06bb18b92f068e60cc6f50b",
- "reference": "2b56bea83a09de3ac06bb18b92f068e60cc6f50b",
+ "url": "https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/15c5dd40dc4f38794d383bb95465193f5e0ae180",
+ "reference": "15c5dd40dc4f38794d383bb95465193f5e0ae180",
"shasum": ""
},
"require": {
- "php": ">=7.3"
+ "php": ">=8.2"
},
"require-dev": {
- "phpunit/phpunit": "^9.3"
+ "phpunit/phpunit": "^11.0"
},
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "1.0-dev"
+ "dev-main": "3.0-dev"
}
},
"autoload": {
@@ -8867,7 +8819,8 @@
"homepage": "https://github.com/sebastianbergmann/cli-parser",
"support": {
"issues": "https://github.com/sebastianbergmann/cli-parser/issues",
- "source": "https://github.com/sebastianbergmann/cli-parser/tree/1.0.2"
+ "security": "https://github.com/sebastianbergmann/cli-parser/security/policy",
+ "source": "https://github.com/sebastianbergmann/cli-parser/tree/3.0.2"
},
"funding": [
{
@@ -8875,32 +8828,32 @@
"type": "github"
}
],
- "time": "2024-03-02T06:27:43+00:00"
+ "time": "2024-07-03T04:41:36+00:00"
},
{
"name": "sebastian/code-unit",
- "version": "1.0.8",
+ "version": "3.0.3",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/code-unit.git",
- "reference": "1fc9f64c0927627ef78ba436c9b17d967e68e120"
+ "reference": "54391c61e4af8078e5b276ab082b6d3c54c9ad64"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/code-unit/zipball/1fc9f64c0927627ef78ba436c9b17d967e68e120",
- "reference": "1fc9f64c0927627ef78ba436c9b17d967e68e120",
+ "url": "https://api.github.com/repos/sebastianbergmann/code-unit/zipball/54391c61e4af8078e5b276ab082b6d3c54c9ad64",
+ "reference": "54391c61e4af8078e5b276ab082b6d3c54c9ad64",
"shasum": ""
},
"require": {
- "php": ">=7.3"
+ "php": ">=8.2"
},
"require-dev": {
- "phpunit/phpunit": "^9.3"
+ "phpunit/phpunit": "^11.5"
},
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "1.0-dev"
+ "dev-main": "3.0-dev"
}
},
"autoload": {
@@ -8923,7 +8876,8 @@
"homepage": "https://github.com/sebastianbergmann/code-unit",
"support": {
"issues": "https://github.com/sebastianbergmann/code-unit/issues",
- "source": "https://github.com/sebastianbergmann/code-unit/tree/1.0.8"
+ "security": "https://github.com/sebastianbergmann/code-unit/security/policy",
+ "source": "https://github.com/sebastianbergmann/code-unit/tree/3.0.3"
},
"funding": [
{
@@ -8931,32 +8885,32 @@
"type": "github"
}
],
- "time": "2020-10-26T13:08:54+00:00"
+ "time": "2025-03-19T07:56:08+00:00"
},
{
"name": "sebastian/code-unit-reverse-lookup",
- "version": "2.0.3",
+ "version": "4.0.1",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git",
- "reference": "ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5"
+ "reference": "183a9b2632194febd219bb9246eee421dad8d45e"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5",
- "reference": "ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5",
+ "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/183a9b2632194febd219bb9246eee421dad8d45e",
+ "reference": "183a9b2632194febd219bb9246eee421dad8d45e",
"shasum": ""
},
"require": {
- "php": ">=7.3"
+ "php": ">=8.2"
},
"require-dev": {
- "phpunit/phpunit": "^9.3"
+ "phpunit/phpunit": "^11.0"
},
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "2.0-dev"
+ "dev-main": "4.0-dev"
}
},
"autoload": {
@@ -8978,7 +8932,8 @@
"homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/",
"support": {
"issues": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/issues",
- "source": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/tree/2.0.3"
+ "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": [
{
@@ -8986,34 +8941,39 @@
"type": "github"
}
],
- "time": "2020-09-28T05:30:19+00:00"
+ "time": "2024-07-03T04:45:54+00:00"
},
{
"name": "sebastian/comparator",
- "version": "4.0.8",
+ "version": "6.3.1",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/comparator.git",
- "reference": "fa0f136dd2334583309d32b62544682ee972b51a"
+ "reference": "24b8fbc2c8e201bb1308e7b05148d6ab393b6959"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/fa0f136dd2334583309d32b62544682ee972b51a",
- "reference": "fa0f136dd2334583309d32b62544682ee972b51a",
+ "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/24b8fbc2c8e201bb1308e7b05148d6ab393b6959",
+ "reference": "24b8fbc2c8e201bb1308e7b05148d6ab393b6959",
"shasum": ""
},
"require": {
- "php": ">=7.3",
- "sebastian/diff": "^4.0",
- "sebastian/exporter": "^4.0"
+ "ext-dom": "*",
+ "ext-mbstring": "*",
+ "php": ">=8.2",
+ "sebastian/diff": "^6.0",
+ "sebastian/exporter": "^6.0"
},
"require-dev": {
- "phpunit/phpunit": "^9.3"
+ "phpunit/phpunit": "^11.4"
+ },
+ "suggest": {
+ "ext-bcmath": "For comparing BcMath\\Number objects"
},
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "4.0-dev"
+ "dev-main": "6.3-dev"
}
},
"autoload": {
@@ -9052,7 +9012,8 @@
],
"support": {
"issues": "https://github.com/sebastianbergmann/comparator/issues",
- "source": "https://github.com/sebastianbergmann/comparator/tree/4.0.8"
+ "security": "https://github.com/sebastianbergmann/comparator/security/policy",
+ "source": "https://github.com/sebastianbergmann/comparator/tree/6.3.1"
},
"funding": [
{
@@ -9060,33 +9021,33 @@
"type": "github"
}
],
- "time": "2022-09-14T12:41:17+00:00"
+ "time": "2025-03-07T06:57:01+00:00"
},
{
"name": "sebastian/complexity",
- "version": "2.0.3",
+ "version": "4.0.1",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/complexity.git",
- "reference": "25f207c40d62b8b7aa32f5ab026c53561964053a"
+ "reference": "ee41d384ab1906c68852636b6de493846e13e5a0"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/25f207c40d62b8b7aa32f5ab026c53561964053a",
- "reference": "25f207c40d62b8b7aa32f5ab026c53561964053a",
+ "url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/ee41d384ab1906c68852636b6de493846e13e5a0",
+ "reference": "ee41d384ab1906c68852636b6de493846e13e5a0",
"shasum": ""
},
"require": {
- "nikic/php-parser": "^4.18 || ^5.0",
- "php": ">=7.3"
+ "nikic/php-parser": "^5.0",
+ "php": ">=8.2"
},
"require-dev": {
- "phpunit/phpunit": "^9.3"
+ "phpunit/phpunit": "^11.0"
},
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "2.0-dev"
+ "dev-main": "4.0-dev"
}
},
"autoload": {
@@ -9109,7 +9070,8 @@
"homepage": "https://github.com/sebastianbergmann/complexity",
"support": {
"issues": "https://github.com/sebastianbergmann/complexity/issues",
- "source": "https://github.com/sebastianbergmann/complexity/tree/2.0.3"
+ "security": "https://github.com/sebastianbergmann/complexity/security/policy",
+ "source": "https://github.com/sebastianbergmann/complexity/tree/4.0.1"
},
"funding": [
{
@@ -9117,33 +9079,33 @@
"type": "github"
}
],
- "time": "2023-12-22T06:19:30+00:00"
+ "time": "2024-07-03T04:49:50+00:00"
},
{
"name": "sebastian/diff",
- "version": "4.0.6",
+ "version": "6.0.2",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/diff.git",
- "reference": "ba01945089c3a293b01ba9badc29ad55b106b0bc"
+ "reference": "b4ccd857127db5d41a5b676f24b51371d76d8544"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/ba01945089c3a293b01ba9badc29ad55b106b0bc",
- "reference": "ba01945089c3a293b01ba9badc29ad55b106b0bc",
+ "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/b4ccd857127db5d41a5b676f24b51371d76d8544",
+ "reference": "b4ccd857127db5d41a5b676f24b51371d76d8544",
"shasum": ""
},
"require": {
- "php": ">=7.3"
+ "php": ">=8.2"
},
"require-dev": {
- "phpunit/phpunit": "^9.3",
+ "phpunit/phpunit": "^11.0",
"symfony/process": "^4.2 || ^5"
},
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "4.0-dev"
+ "dev-main": "6.0-dev"
}
},
"autoload": {
@@ -9175,7 +9137,8 @@
],
"support": {
"issues": "https://github.com/sebastianbergmann/diff/issues",
- "source": "https://github.com/sebastianbergmann/diff/tree/4.0.6"
+ "security": "https://github.com/sebastianbergmann/diff/security/policy",
+ "source": "https://github.com/sebastianbergmann/diff/tree/6.0.2"
},
"funding": [
{
@@ -9183,27 +9146,27 @@
"type": "github"
}
],
- "time": "2024-03-02T06:30:58+00:00"
+ "time": "2024-07-03T04:53:05+00:00"
},
{
"name": "sebastian/environment",
- "version": "5.1.5",
+ "version": "7.2.1",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/environment.git",
- "reference": "830c43a844f1f8d5b7a1f6d6076b784454d8b7ed"
+ "reference": "a5c75038693ad2e8d4b6c15ba2403532647830c4"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/830c43a844f1f8d5b7a1f6d6076b784454d8b7ed",
- "reference": "830c43a844f1f8d5b7a1f6d6076b784454d8b7ed",
+ "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/a5c75038693ad2e8d4b6c15ba2403532647830c4",
+ "reference": "a5c75038693ad2e8d4b6c15ba2403532647830c4",
"shasum": ""
},
"require": {
- "php": ">=7.3"
+ "php": ">=8.2"
},
"require-dev": {
- "phpunit/phpunit": "^9.3"
+ "phpunit/phpunit": "^11.3"
},
"suggest": {
"ext-posix": "*"
@@ -9211,7 +9174,7 @@
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "5.1-dev"
+ "dev-main": "7.2-dev"
}
},
"autoload": {
@@ -9230,7 +9193,7 @@
}
],
"description": "Provides functionality to handle HHVM/PHP environments",
- "homepage": "http://www.github.com/sebastianbergmann/environment",
+ "homepage": "https://github.com/sebastianbergmann/environment",
"keywords": [
"Xdebug",
"environment",
@@ -9238,42 +9201,55 @@
],
"support": {
"issues": "https://github.com/sebastianbergmann/environment/issues",
- "source": "https://github.com/sebastianbergmann/environment/tree/5.1.5"
+ "security": "https://github.com/sebastianbergmann/environment/security/policy",
+ "source": "https://github.com/sebastianbergmann/environment/tree/7.2.1"
},
"funding": [
{
"url": "https://github.com/sebastianbergmann",
"type": "github"
+ },
+ {
+ "url": "https://liberapay.com/sebastianbergmann",
+ "type": "liberapay"
+ },
+ {
+ "url": "https://thanks.dev/u/gh/sebastianbergmann",
+ "type": "thanks_dev"
+ },
+ {
+ "url": "https://tidelift.com/funding/github/packagist/sebastian/environment",
+ "type": "tidelift"
}
],
- "time": "2023-02-03T06:03:51+00:00"
+ "time": "2025-05-21T11:55:47+00:00"
},
{
"name": "sebastian/exporter",
- "version": "4.0.6",
+ "version": "6.3.0",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/exporter.git",
- "reference": "78c00df8f170e02473b682df15bfcdacc3d32d72"
+ "reference": "3473f61172093b2da7de1fb5782e1f24cc036dc3"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/78c00df8f170e02473b682df15bfcdacc3d32d72",
- "reference": "78c00df8f170e02473b682df15bfcdacc3d32d72",
+ "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/3473f61172093b2da7de1fb5782e1f24cc036dc3",
+ "reference": "3473f61172093b2da7de1fb5782e1f24cc036dc3",
"shasum": ""
},
"require": {
- "php": ">=7.3",
- "sebastian/recursion-context": "^4.0"
+ "ext-mbstring": "*",
+ "php": ">=8.2",
+ "sebastian/recursion-context": "^6.0"
},
"require-dev": {
- "ext-mbstring": "*",
- "phpunit/phpunit": "^9.3"
+ "phpunit/phpunit": "^11.3"
},
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "4.0-dev"
+ "dev-main": "6.1-dev"
}
},
"autoload": {
@@ -9315,7 +9291,8 @@
],
"support": {
"issues": "https://github.com/sebastianbergmann/exporter/issues",
- "source": "https://github.com/sebastianbergmann/exporter/tree/4.0.6"
+ "security": "https://github.com/sebastianbergmann/exporter/security/policy",
+ "source": "https://github.com/sebastianbergmann/exporter/tree/6.3.0"
},
"funding": [
{
@@ -9323,38 +9300,35 @@
"type": "github"
}
],
- "time": "2024-03-02T06:33:00+00:00"
+ "time": "2024-12-05T09:17:50+00:00"
},
{
"name": "sebastian/global-state",
- "version": "5.0.7",
+ "version": "7.0.2",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/global-state.git",
- "reference": "bca7df1f32ee6fe93b4d4a9abbf69e13a4ada2c9"
+ "reference": "3be331570a721f9a4b5917f4209773de17f747d7"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/bca7df1f32ee6fe93b4d4a9abbf69e13a4ada2c9",
- "reference": "bca7df1f32ee6fe93b4d4a9abbf69e13a4ada2c9",
+ "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/3be331570a721f9a4b5917f4209773de17f747d7",
+ "reference": "3be331570a721f9a4b5917f4209773de17f747d7",
"shasum": ""
},
"require": {
- "php": ">=7.3",
- "sebastian/object-reflector": "^2.0",
- "sebastian/recursion-context": "^4.0"
+ "php": ">=8.2",
+ "sebastian/object-reflector": "^4.0",
+ "sebastian/recursion-context": "^6.0"
},
"require-dev": {
"ext-dom": "*",
- "phpunit/phpunit": "^9.3"
- },
- "suggest": {
- "ext-uopz": "*"
+ "phpunit/phpunit": "^11.0"
},
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "5.0-dev"
+ "dev-main": "7.0-dev"
}
},
"autoload": {
@@ -9373,13 +9347,14 @@
}
],
"description": "Snapshotting of global state",
- "homepage": "http://www.github.com/sebastianbergmann/global-state",
+ "homepage": "https://www.github.com/sebastianbergmann/global-state",
"keywords": [
"global state"
],
"support": {
"issues": "https://github.com/sebastianbergmann/global-state/issues",
- "source": "https://github.com/sebastianbergmann/global-state/tree/5.0.7"
+ "security": "https://github.com/sebastianbergmann/global-state/security/policy",
+ "source": "https://github.com/sebastianbergmann/global-state/tree/7.0.2"
},
"funding": [
{
@@ -9387,33 +9362,33 @@
"type": "github"
}
],
- "time": "2024-03-02T06:35:11+00:00"
+ "time": "2024-07-03T04:57:36+00:00"
},
{
"name": "sebastian/lines-of-code",
- "version": "1.0.4",
+ "version": "3.0.1",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/lines-of-code.git",
- "reference": "e1e4a170560925c26d424b6a03aed157e7dcc5c5"
+ "reference": "d36ad0d782e5756913e42ad87cb2890f4ffe467a"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/e1e4a170560925c26d424b6a03aed157e7dcc5c5",
- "reference": "e1e4a170560925c26d424b6a03aed157e7dcc5c5",
+ "url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/d36ad0d782e5756913e42ad87cb2890f4ffe467a",
+ "reference": "d36ad0d782e5756913e42ad87cb2890f4ffe467a",
"shasum": ""
},
"require": {
- "nikic/php-parser": "^4.18 || ^5.0",
- "php": ">=7.3"
+ "nikic/php-parser": "^5.0",
+ "php": ">=8.2"
},
"require-dev": {
- "phpunit/phpunit": "^9.3"
+ "phpunit/phpunit": "^11.0"
},
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "1.0-dev"
+ "dev-main": "3.0-dev"
}
},
"autoload": {
@@ -9436,7 +9411,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/1.0.4"
+ "security": "https://github.com/sebastianbergmann/lines-of-code/security/policy",
+ "source": "https://github.com/sebastianbergmann/lines-of-code/tree/3.0.1"
},
"funding": [
{
@@ -9444,34 +9420,34 @@
"type": "github"
}
],
- "time": "2023-12-22T06:20:34+00:00"
+ "time": "2024-07-03T04:58:38+00:00"
},
{
"name": "sebastian/object-enumerator",
- "version": "4.0.4",
+ "version": "6.0.1",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/object-enumerator.git",
- "reference": "5c9eeac41b290a3712d88851518825ad78f45c71"
+ "reference": "f5b498e631a74204185071eb41f33f38d64608aa"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/5c9eeac41b290a3712d88851518825ad78f45c71",
- "reference": "5c9eeac41b290a3712d88851518825ad78f45c71",
+ "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/f5b498e631a74204185071eb41f33f38d64608aa",
+ "reference": "f5b498e631a74204185071eb41f33f38d64608aa",
"shasum": ""
},
"require": {
- "php": ">=7.3",
- "sebastian/object-reflector": "^2.0",
- "sebastian/recursion-context": "^4.0"
+ "php": ">=8.2",
+ "sebastian/object-reflector": "^4.0",
+ "sebastian/recursion-context": "^6.0"
},
"require-dev": {
- "phpunit/phpunit": "^9.3"
+ "phpunit/phpunit": "^11.0"
},
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "4.0-dev"
+ "dev-main": "6.0-dev"
}
},
"autoload": {
@@ -9493,7 +9469,8 @@
"homepage": "https://github.com/sebastianbergmann/object-enumerator/",
"support": {
"issues": "https://github.com/sebastianbergmann/object-enumerator/issues",
- "source": "https://github.com/sebastianbergmann/object-enumerator/tree/4.0.4"
+ "security": "https://github.com/sebastianbergmann/object-enumerator/security/policy",
+ "source": "https://github.com/sebastianbergmann/object-enumerator/tree/6.0.1"
},
"funding": [
{
@@ -9501,32 +9478,32 @@
"type": "github"
}
],
- "time": "2020-10-26T13:12:34+00:00"
+ "time": "2024-07-03T05:00:13+00:00"
},
{
"name": "sebastian/object-reflector",
- "version": "2.0.4",
+ "version": "4.0.1",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/object-reflector.git",
- "reference": "b4f479ebdbf63ac605d183ece17d8d7fe49c15c7"
+ "reference": "6e1a43b411b2ad34146dee7524cb13a068bb35f9"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/b4f479ebdbf63ac605d183ece17d8d7fe49c15c7",
- "reference": "b4f479ebdbf63ac605d183ece17d8d7fe49c15c7",
+ "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/6e1a43b411b2ad34146dee7524cb13a068bb35f9",
+ "reference": "6e1a43b411b2ad34146dee7524cb13a068bb35f9",
"shasum": ""
},
"require": {
- "php": ">=7.3"
+ "php": ">=8.2"
},
"require-dev": {
- "phpunit/phpunit": "^9.3"
+ "phpunit/phpunit": "^11.0"
},
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "2.0-dev"
+ "dev-main": "4.0-dev"
}
},
"autoload": {
@@ -9548,7 +9525,8 @@
"homepage": "https://github.com/sebastianbergmann/object-reflector/",
"support": {
"issues": "https://github.com/sebastianbergmann/object-reflector/issues",
- "source": "https://github.com/sebastianbergmann/object-reflector/tree/2.0.4"
+ "security": "https://github.com/sebastianbergmann/object-reflector/security/policy",
+ "source": "https://github.com/sebastianbergmann/object-reflector/tree/4.0.1"
},
"funding": [
{
@@ -9556,32 +9534,32 @@
"type": "github"
}
],
- "time": "2020-10-26T13:14:26+00:00"
+ "time": "2024-07-03T05:01:32+00:00"
},
{
"name": "sebastian/recursion-context",
- "version": "4.0.5",
+ "version": "6.0.2",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/recursion-context.git",
- "reference": "e75bd0f07204fec2a0af9b0f3cfe97d05f92efc1"
+ "reference": "694d156164372abbd149a4b85ccda2e4670c0e16"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/e75bd0f07204fec2a0af9b0f3cfe97d05f92efc1",
- "reference": "e75bd0f07204fec2a0af9b0f3cfe97d05f92efc1",
+ "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/694d156164372abbd149a4b85ccda2e4670c0e16",
+ "reference": "694d156164372abbd149a4b85ccda2e4670c0e16",
"shasum": ""
},
"require": {
- "php": ">=7.3"
+ "php": ">=8.2"
},
"require-dev": {
- "phpunit/phpunit": "^9.3"
+ "phpunit/phpunit": "^11.0"
},
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "4.0-dev"
+ "dev-main": "6.0-dev"
}
},
"autoload": {
@@ -9611,7 +9589,8 @@
"homepage": "https://github.com/sebastianbergmann/recursion-context",
"support": {
"issues": "https://github.com/sebastianbergmann/recursion-context/issues",
- "source": "https://github.com/sebastianbergmann/recursion-context/tree/4.0.5"
+ "security": "https://github.com/sebastianbergmann/recursion-context/security/policy",
+ "source": "https://github.com/sebastianbergmann/recursion-context/tree/6.0.2"
},
"funding": [
{
@@ -9619,32 +9598,32 @@
"type": "github"
}
],
- "time": "2023-02-03T06:07:39+00:00"
+ "time": "2024-07-03T05:10:34+00:00"
},
{
- "name": "sebastian/resource-operations",
- "version": "3.0.4",
+ "name": "sebastian/type",
+ "version": "5.1.2",
"source": {
"type": "git",
- "url": "https://github.com/sebastianbergmann/resource-operations.git",
- "reference": "05d5692a7993ecccd56a03e40cd7e5b09b1d404e"
+ "url": "https://github.com/sebastianbergmann/type.git",
+ "reference": "a8a7e30534b0eb0c77cd9d07e82de1a114389f5e"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/05d5692a7993ecccd56a03e40cd7e5b09b1d404e",
- "reference": "05d5692a7993ecccd56a03e40cd7e5b09b1d404e",
+ "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/a8a7e30534b0eb0c77cd9d07e82de1a114389f5e",
+ "reference": "a8a7e30534b0eb0c77cd9d07e82de1a114389f5e",
"shasum": ""
},
"require": {
- "php": ">=7.3"
+ "php": ">=8.2"
},
"require-dev": {
- "phpunit/phpunit": "^9.0"
+ "phpunit/phpunit": "^11.3"
},
"type": "library",
"extra": {
"branch-alias": {
- "dev-main": "3.0-dev"
+ "dev-main": "5.1-dev"
}
},
"autoload": {
@@ -9659,13 +9638,16 @@
"authors": [
{
"name": "Sebastian Bergmann",
- "email": "[email protected]"
+ "email": "[email protected]",
+ "role": "lead"
}
],
- "description": "Provides a list of PHP built-in functions that operate on resources",
- "homepage": "https://www.github.com/sebastianbergmann/resource-operations",
+ "description": "Collection of value objects that represent the types of the PHP type system",
+ "homepage": "https://github.com/sebastianbergmann/type",
"support": {
- "source": "https://github.com/sebastianbergmann/resource-operations/tree/3.0.4"
+ "issues": "https://github.com/sebastianbergmann/type/issues",
+ "security": "https://github.com/sebastianbergmann/type/security/policy",
+ "source": "https://github.com/sebastianbergmann/type/tree/5.1.2"
},
"funding": [
{
@@ -9673,32 +9655,29 @@
"type": "github"
}
],
- "time": "2024-03-14T16:00:52+00:00"
+ "time": "2025-03-18T13:35:50+00:00"
},
{
- "name": "sebastian/type",
- "version": "3.2.1",
+ "name": "sebastian/version",
+ "version": "5.0.2",
"source": {
"type": "git",
- "url": "https://github.com/sebastianbergmann/type.git",
- "reference": "75e2c2a32f5e0b3aef905b9ed0b179b953b3d7c7"
+ "url": "https://github.com/sebastianbergmann/version.git",
+ "reference": "c687e3387b99f5b03b6caa64c74b63e2936ff874"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/75e2c2a32f5e0b3aef905b9ed0b179b953b3d7c7",
- "reference": "75e2c2a32f5e0b3aef905b9ed0b179b953b3d7c7",
+ "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/c687e3387b99f5b03b6caa64c74b63e2936ff874",
+ "reference": "c687e3387b99f5b03b6caa64c74b63e2936ff874",
"shasum": ""
},
"require": {
- "php": ">=7.3"
- },
- "require-dev": {
- "phpunit/phpunit": "^9.5"
+ "php": ">=8.2"
},
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "3.2-dev"
+ "dev-main": "5.0-dev"
}
},
"autoload": {
@@ -9717,11 +9696,12 @@
"role": "lead"
}
],
- "description": "Collection of value objects that represent the types of the PHP type system",
- "homepage": "https://github.com/sebastianbergmann/type",
+ "description": "Library that helps with managing the version number of Git-hosted PHP projects",
+ "homepage": "https://github.com/sebastianbergmann/version",
"support": {
- "issues": "https://github.com/sebastianbergmann/type/issues",
- "source": "https://github.com/sebastianbergmann/type/tree/3.2.1"
+ "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"
},
"funding": [
{
@@ -9729,60 +9709,59 @@
"type": "github"
}
],
- "time": "2023-02-03T06:13:03+00:00"
+ "time": "2024-10-09T05:16:32+00:00"
},
{
- "name": "sebastian/version",
- "version": "3.0.2",
+ "name": "staabm/side-effects-detector",
+ "version": "1.0.5",
"source": {
"type": "git",
- "url": "https://github.com/sebastianbergmann/version.git",
- "reference": "c6c1022351a901512170118436c764e473f6de8c"
+ "url": "https://github.com/staabm/side-effects-detector.git",
+ "reference": "d8334211a140ce329c13726d4a715adbddd0a163"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/c6c1022351a901512170118436c764e473f6de8c",
- "reference": "c6c1022351a901512170118436c764e473f6de8c",
+ "url": "https://api.github.com/repos/staabm/side-effects-detector/zipball/d8334211a140ce329c13726d4a715adbddd0a163",
+ "reference": "d8334211a140ce329c13726d4a715adbddd0a163",
"shasum": ""
},
"require": {
- "php": ">=7.3"
+ "ext-tokenizer": "*",
+ "php": "^7.4 || ^8.0"
},
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-master": "3.0-dev"
- }
+ "require-dev": {
+ "phpstan/extension-installer": "^1.4.3",
+ "phpstan/phpstan": "^1.12.6",
+ "phpunit/phpunit": "^9.6.21",
+ "symfony/var-dumper": "^5.4.43",
+ "tomasvotruba/type-coverage": "1.0.0",
+ "tomasvotruba/unused-public": "1.0.0"
},
+ "type": "library",
"autoload": {
"classmap": [
- "src/"
+ "lib/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
- "BSD-3-Clause"
+ "MIT"
],
- "authors": [
- {
- "name": "Sebastian Bergmann",
- "email": "[email protected]",
- "role": "lead"
- }
+ "description": "A static analysis tool to detect side effects in PHP code",
+ "keywords": [
+ "static analysis"
],
- "description": "Library that helps with managing the version number of Git-hosted PHP projects",
- "homepage": "https://github.com/sebastianbergmann/version",
"support": {
- "issues": "https://github.com/sebastianbergmann/version/issues",
- "source": "https://github.com/sebastianbergmann/version/tree/3.0.2"
+ "issues": "https://github.com/staabm/side-effects-detector/issues",
+ "source": "https://github.com/staabm/side-effects-detector/tree/1.0.5"
},
"funding": [
{
- "url": "https://github.com/sebastianbergmann",
+ "url": "https://github.com/staabm",
"type": "github"
}
],
- "time": "2020-09-28T06:39:44+00:00"
+ "time": "2024-10-20T05:08:20+00:00"
},
{
"name": "theseer/tokenizer",
diff --git a/tests/unit/ContainerMocker.php b/tests/unit/ContainerMocker.php
index 4e6184750c..c90b551b5e 100644
--- a/tests/unit/ContainerMocker.php
+++ b/tests/unit/ContainerMocker.php
@@ -31,6 +31,8 @@ namespace tests\unit;
use Espo\Core\Container;
+use PHPUnit\Framework\MockObject\MockBuilder;
+use PHPUnit\Framework\MockObject\Rule\AnyInvokedCount as AnyInvokedCountMatcher;
use PHPUnit\Framework\TestCase;
use ReflectionClass;
@@ -46,7 +48,7 @@ class ContainerMocker
public function create(array $serviceMap) : Container
{
- $container = $this->test->getMockBuilder(Container::class)->disableOriginalConstructor()->getMock();
+ $container = (new MockBuilder($this->test, Container::class))->disableOriginalConstructor()->getMock();
$map = $serviceMap;
@@ -67,19 +69,19 @@ class ContainerMocker
}
$container
- ->expects($this->test->any())
+ ->expects(new AnyInvokedCountMatcher)
->method('get')
- ->will($this->test->returnValueMap($valueMap));
+ ->willReturnMap($valueMap);
$container
- ->expects($this->test->any())
+ ->expects(new AnyInvokedCountMatcher)
->method('has')
- ->will($this->test->returnValueMap($hasMap));
+ ->willReturnMap($hasMap);
$container
- ->expects($this->test->any())
+ ->expects(new AnyInvokedCountMatcher)
->method('getClass')
- ->will($this->test->returnValueMap($classMap));
+ ->willReturnMap($classMap);
return $container;
}
diff --git a/tests/unit/Espo/Core/Field/Currency/CurrencyConfigDataProviderTest.php b/tests/unit/Espo/Core/Field/Currency/CurrencyConfigDataProviderTest.php
index f519cd964a..4a3528d67d 100644
--- a/tests/unit/Espo/Core/Field/Currency/CurrencyConfigDataProviderTest.php
+++ b/tests/unit/Espo/Core/Field/Currency/CurrencyConfigDataProviderTest.php
@@ -29,12 +29,12 @@
namespace tests\unit\Espo\Core\Field\Currency;
-use Espo\Core\{
- Currency\ConfigDataProvider as CurrencyConfigDataProvider,
- Utils\Config,
-};
+use Espo\Core\Currency\ConfigDataProvider as CurrencyConfigDataProvider;
+use Espo\Core\Utils\Config;
+use PHPUnit\Framework\TestCase;
+use RuntimeException;
-class CurrencyConfigDataProviderTest extends \PHPUnit\Framework\TestCase
+class CurrencyConfigDataProviderTest extends TestCase
{
protected function setUp() : void
{
@@ -97,19 +97,28 @@ class CurrencyConfigDataProviderTest extends \PHPUnit\Framework\TestCase
public function testCurrencyRate1()
{
+ $invokedCount = $this->exactly(2);
+
$this->config
- ->expects($this->exactly(2))
+ ->expects($invokedCount)
->method('get')
- ->withConsecutive(
- ['currencyRates'],
- ['currencyList'],
- )
- ->willReturnOnConsecutiveCalls(
- [
- 'EUR' => 1.2,
- ],
- ['USD', 'EUR'],
- );
+ ->willReturnCallback(function ($param) use ($invokedCount) {
+ if ($invokedCount->numberOfInvocations() === 1) {
+ $this->assertEquals('currencyRates', $param);
+
+ return [
+ 'EUR' => 1.2,
+ ];
+ }
+
+ if ($invokedCount->numberOfInvocations() === 2) {
+ $this->assertEquals('currencyList', $param);
+
+ return ['USD', 'EUR'];
+ }
+
+ throw new RuntimeException();
+ });
$result = $this->provider->getCurrencyRate('EUR');
@@ -118,19 +127,28 @@ class CurrencyConfigDataProviderTest extends \PHPUnit\Framework\TestCase
public function testCurrencyRate2()
{
+ $invokedCount = $this->exactly(2);
+
$this->config
- ->expects($this->exactly(2))
+ ->expects($invokedCount)
->method('get')
- ->withConsecutive(
- ['currencyRates'],
- ['currencyList'],
- )
- ->willReturnOnConsecutiveCalls(
- [
- 'EUR' => 1.2,
- ],
- ['USD', 'EUR'],
- );
+ ->willReturnCallback(function ($param) use ($invokedCount) {
+ if ($invokedCount->numberOfInvocations() === 1) {
+ $this->assertEquals('currencyRates', $param);
+
+ return [
+ 'EUR' => 1.2,
+ ];
+ }
+
+ if ($invokedCount->numberOfInvocations() === 2) {
+ $this->assertEquals('currencyList', $param);
+
+ return ['USD', 'EUR'];
+ }
+
+ throw new RuntimeException();
+ });
$result = $this->provider->getCurrencyRate('USD');
diff --git a/tests/unit/Espo/Core/Formula/EvaluatorTest.php b/tests/unit/Espo/Core/Formula/EvaluatorTest.php
index 5a50cedf0e..235670f138 100644
--- a/tests/unit/Espo/Core/Formula/EvaluatorTest.php
+++ b/tests/unit/Espo/Core/Formula/EvaluatorTest.php
@@ -51,7 +51,7 @@ class EvaluatorTest extends TestCase
*/
private $evaluator;
- protected function setUp() : void
+ protected function setUp(): void
{
$log = $this->createMock(Log::class);
$entityManager = $this->createMock(EntityManager::class);
diff --git a/tests/unit/Espo/Core/Select/Applier/Appliers/AccessControlFilterApplierTest.php b/tests/unit/Espo/Core/Select/Applier/Appliers/AccessControlFilterApplierTest.php
index 85851e1453..7cb2dc9b1c 100644
--- a/tests/unit/Espo/Core/Select/Applier/Appliers/AccessControlFilterApplierTest.php
+++ b/tests/unit/Espo/Core/Select/Applier/Appliers/AccessControlFilterApplierTest.php
@@ -29,21 +29,18 @@
namespace tests\unit\Espo\Core\Select\Applier\Appliers;
-use Espo\Core\{
- Select\AccessControl\Applier as AccessControlFilterApplier,
- Select\SelectManager,
- Select\AccessControl\FilterFactory as AccessControlFilterFactory,
- Select\AccessControl\FilterResolverFactory as AccessControlFilterResolverFactory,
- Select\AccessControl\FilterResolver,
- Select\AccessControl\Filter as AccessControlFilter,
-};
-
-use Espo\{
- ORM\Query\SelectBuilder as QueryBuilder,
- Entities\User,
-};
-
-class AccessControlFilterApplierTest extends \PHPUnit\Framework\TestCase
+use Espo\Core\Select\AccessControl\Applier as AccessControlFilterApplier;
+use Espo\Core\Select\AccessControl\Filter as AccessControlFilter;
+use Espo\Core\Select\AccessControl\FilterFactory as AccessControlFilterFactory;
+use Espo\Core\Select\AccessControl\FilterResolver;
+use Espo\Core\Select\AccessControl\FilterResolverFactory as AccessControlFilterResolverFactory;
+use Espo\Core\Select\SelectManager;
+
+use Espo\Entities\User;
+use Espo\ORM\Query\SelectBuilder as QueryBuilder;
+use PHPUnit\Framework\TestCase;
+
+class AccessControlFilterApplierTest extends TestCase
{
protected function setUp() : void
{
@@ -141,14 +138,10 @@ class AccessControlFilterApplierTest extends \PHPUnit\Framework\TestCase
$this->filterFactory
->expects($this->exactly(2))
->method('create')
- ->withConsecutive(
- [$this->entityType, $this->user, 'mandatory'],
- [$this->entityType, $this->user, $filterName],
- )
- ->willReturnOnConsecutiveCalls(
- $this->mandatoryFilter,
- $this->filter
- );
+ ->willReturnMap([
+ [$this->entityType, $this->user, 'mandatory', $this->mandatoryFilter],
+ [$this->entityType, $this->user, $filterName, $this->filter],
+ ]);
$this->filter
->expects($this->once())
diff --git a/tests/unit/Espo/Core/Select/Applier/Appliers/TextFilterApplierTest.php b/tests/unit/Espo/Core/Select/Applier/Appliers/TextFilterApplierTest.php
index 71a182ac67..93cbb55446 100644
--- a/tests/unit/Espo/Core/Select/Applier/Appliers/TextFilterApplierTest.php
+++ b/tests/unit/Espo/Core/Select/Applier/Appliers/TextFilterApplierTest.php
@@ -208,13 +208,22 @@ class TextFilterApplierTest extends TestCase
->method('where')
->with(OrGroup::fromRaw($expectedWhere));
+ $c = $this->exactly(2);
+
$this->queryBuilder
- ->expects($this->exactly(2))
+ ->expects($c)
->method('leftJoin')
- ->withConsecutive(
- ['link1'],
- ['link2']
- );
+ ->willReturnCallback(function ($link) use ($c) {
+ if ($c->numberOfInvocations() === 1) {
+ $this->assertEquals('link1', $link);
+ }
+
+ if ($c->numberOfInvocations() === 2) {
+ $this->assertEquals('link2', $link);
+ }
+
+ return $this->queryBuilder;
+ });
$this->queryBuilder
->expects($this->once())
diff --git a/tests/unit/Espo/Core/Select/Bool/FilterFactoryTest.php b/tests/unit/Espo/Core/Select/Bool/FilterFactoryTest.php
index 507186c853..076b3ba4e7 100644
--- a/tests/unit/Espo/Core/Select/Bool/FilterFactoryTest.php
+++ b/tests/unit/Espo/Core/Select/Bool/FilterFactoryTest.php
@@ -113,20 +113,25 @@ class FilterFactoryTest extends TestCase
);
$this->metadata
+ ->expects(self::any())
->method('get')
- ->withConsecutive(
- [[
- 'selectDefs',
- $entityType,
- 'boolFilterClassNameMap',
- 'badName',
- ]],
- [['app', 'select', 'boolFilterClassNameMap', 'badName']],
- )
- ->willReturnOnConsecutiveCalls(
- null,
- null
- );
+ ->willReturnMap([
+ [
+ [
+ 'selectDefs',
+ $entityType,
+ 'boolFilterClassNameMap',
+ 'badName',
+ ],
+ null,
+ null
+ ],
+ [
+ ['app', 'select', 'boolFilterClassNameMap', 'badName'],
+ null,
+ null
+ ],
+ ]);
$this->assertFalse(
$this->factory->has($entityType, 'badName')
diff --git a/tests/unit/Espo/Core/Select/Where/CheckerTest.php b/tests/unit/Espo/Core/Select/Where/CheckerTest.php
index 193ffbe1e0..199139e421 100644
--- a/tests/unit/Espo/Core/Select/Where/CheckerTest.php
+++ b/tests/unit/Espo/Core/Select/Where/CheckerTest.php
@@ -114,15 +114,12 @@ class CheckerTest extends TestCase
]);
$this->entity
+ ->expects(self::any())
->method('hasAttribute')
- ->withConsecutive(
- ['test1'],
- ['test2']
- )
- ->willReturnOnConsecutiveCalls(
- true,
- true
- );
+ ->willReturnMap([
+ ['test1', true],
+ ['test2', true],
+ ]);
$this->entity
->expects($this->once())
@@ -158,13 +155,11 @@ class CheckerTest extends TestCase
]);
$this->entity
+ ->expects(self::any())
->method('hasAttribute')
- ->withConsecutive(
- ['test1']
- )
- ->willReturnOnConsecutiveCalls(
- false
- );
+ ->willReturnMap([
+ ['test1', false]
+ ]);
$this->expectException(BadRequest::class);
diff --git a/tests/unit/Espo/Core/Select/Where/ConverterFactoryTest.php b/tests/unit/Espo/Core/Select/Where/ConverterFactoryTest.php
index a7f0fb3676..5ddedde5e5 100644
--- a/tests/unit/Espo/Core/Select/Where/ConverterFactoryTest.php
+++ b/tests/unit/Espo/Core/Select/Where/ConverterFactoryTest.php
@@ -42,9 +42,18 @@ use Espo\Core\Select\Where\ItemGeneralConverter;
use Espo\Core\Utils\Metadata;
use Espo\Entities\User;
+use PHPUnit\Framework\TestCase;
+use RuntimeException;
-class ConverterFactoryTest extends \PHPUnit\Framework\TestCase
+class ConverterFactoryTest extends TestCase
{
+ private $injectableFactory;
+ private $metadata;
+ private $user;
+ private $factory;
+ private $itemConverter;
+ private $dateTimeItemTransformer;
+
protected function setUp(): void
{
$this->injectableFactory = $this->createMock(InjectableFactory::class);
@@ -92,19 +101,16 @@ class ConverterFactoryTest extends \PHPUnit\Framework\TestCase
$bindingData1 = new BindingData();
$binder1 = new Binder($bindingData1);
-
$binder1
->bindInstance(User::class, $this->user);
-
$binder1
->for($className1)
->bindValue('$entityType', $entityType);
-
$binder1
->for(DefaultDateTimeItemTransformer::class)
->bindValue('$entityType', $entityType);
- $bindingContainer1 = new BindingContainer($bindingData1);
+ $bc1 = new BindingContainer($bindingData1);
$bindingData2 = new BindingData();
@@ -112,18 +118,16 @@ class ConverterFactoryTest extends \PHPUnit\Framework\TestCase
$binder2
->bindInstance(User::class, $this->user);
-
$binder2
->for($className2)
->bindValue('$entityType', $entityType)
->bindInstance(DateTimeItemTransformer::class, $this->dateTimeItemTransformer);
-
$binder2
->for(ItemGeneralConverter::class)
->bindValue('$entityType', $entityType)
->bindInstance(DateTimeItemTransformer::class, $this->dateTimeItemTransformer);
- $bindingContainer2 = new BindingContainer($bindingData2);
+ $bc2 = new BindingContainer($bindingData2);
$bindingData3 = new BindingData();
@@ -135,30 +139,39 @@ class ConverterFactoryTest extends \PHPUnit\Framework\TestCase
->bindValue('$entityType', $entityType)
->bindInstance(ItemConverter::class, $this->itemConverter);
- $bindingContainer = new BindingContainer($bindingData3);
+ $bc3 = new BindingContainer($bindingData3);
+
+ $c = $this->exactly(3);
$this->injectableFactory
- ->expects($this->exactly(3))
+ ->expects($c)
->method('createWithBinding')
- ->withConsecutive(
- [
- $className1,
- $bindingContainer1,
- ],
- [
- $className2,
- $bindingContainer2,
- ],
- [
- $className3,
- $bindingContainer,
- ]
- )
- ->willReturnOnConsecutiveCalls(
- $this->dateTimeItemTransformer,
- $this->itemConverter,
- $object
- );
+ ->willReturnCallback(function ($className, $bc) use
+ ($c, $object, $className1, $className2, $className3, $bc1, $bc2, $bc3) {
+
+ if ($c->numberOfInvocations() === 1) {
+ $this->assertEquals($className1, $className);
+ $this->assertEquals($bc1, $bc);
+
+ return $this->dateTimeItemTransformer;
+ }
+
+ if ($c->numberOfInvocations() === 2) {
+ $this->assertEquals($className2, $className);
+ $this->assertEquals($bc2, $bc);
+
+ return $this->itemConverter;
+ }
+
+ if ($c->numberOfInvocations() === 3) {
+ $this->assertEquals($className3, $className);
+ $this->assertEquals($bc3, $bc);
+
+ return $object;
+ }
+
+ throw new RuntimeException();
+ });
$resultObject = $this->factory->create($entityType, $this->user);
diff --git a/tests/unit/Espo/Core/Select/Where/ConverterTest.php b/tests/unit/Espo/Core/Select/Where/ConverterTest.php
index d8cf7982f8..f3409347a9 100644
--- a/tests/unit/Espo/Core/Select/Where/ConverterTest.php
+++ b/tests/unit/Espo/Core/Select/Where/ConverterTest.php
@@ -278,12 +278,20 @@ class ConverterTest extends TestCase
],
]);
+ $c = $this->exactly(2);
+
$this->scanner
+ ->expects($c)
->method('apply')
- ->withConsecutive(
- [$this->isInstanceOf(QueryBuilder::class), $sqItem],
- [$this->queryBuilder, $item]
- );
+ ->willReturnCallback(function ($qb, $it) use ($c, $sqItem, $item) {
+ if ($c->numberOfInvocations() === 1) {
+ $this->assertEquals($sqItem, $it);
+ }
+
+ if ($c->numberOfInvocations() === 2) {
+ $this->assertEquals($item, $it);
+ }
+ });
$whereClause = $this->converter->convert($this->queryBuilder, $item);
@@ -347,14 +355,6 @@ class ConverterTest extends TestCase
->expects($this->never())
->method('distinct');
- $this->queryBuilder
- ->method('leftJoin')
- ->withConsecutive(
- [
- $link,
- $alias,
- ]
- );
$expected = [
'id=s' => Select::fromRaw([
diff --git a/tests/unit/Espo/Core/Select/Where/ScannerTest.php b/tests/unit/Espo/Core/Select/Where/ScannerTest.php
index dd69e686ce..5a7bffe906 100644
--- a/tests/unit/Espo/Core/Select/Where/ScannerTest.php
+++ b/tests/unit/Espo/Core/Select/Where/ScannerTest.php
@@ -111,14 +111,26 @@ class ScannerTest extends TestCase
])
);
+ $c = $this->exactly(3);
+
$this->queryBuilder
- ->expects($this->exactly(3))
+ ->expects($c)
->method('leftJoin')
- ->withConsecutive(
- ['link2'],
- ['link3'],
- ['link4'],
- );
+ ->willReturnCallback(function ($link) use ($c) {
+ if ($c->numberOfInvocations() === 1) {
+ $this->assertEquals('link2', $link);
+ }
+
+ if ($c->numberOfInvocations() === 2) {
+ $this->assertEquals('link3', $link);
+ }
+
+ if ($c->numberOfInvocations() === 3) {
+ $this->assertEquals('link4', $link);
+ }
+
+ return $this->queryBuilder;
+ });
/*$this->queryBuilder
->expects($this->once())
diff --git a/tests/unit/Espo/Core/Upgrades/Actions/BaseTest.php b/tests/unit/Espo/Core/Upgrades/Actions/BaseTest.php
index 00d7e37369..a640913399 100644
--- a/tests/unit/Espo/Core/Upgrades/Actions/BaseTest.php
+++ b/tests/unit/Espo/Core/Upgrades/Actions/BaseTest.php
@@ -210,7 +210,7 @@ class BaseTest extends TestCase
$this->assertEquals( json_decode($manifest,true), $this->reflection->invokeMethod('getManifest') );
}
- public function acceptableVersions()
+ static public function acceptableVersions()
{
return [
['11.5.2'],
@@ -243,7 +243,7 @@ class BaseTest extends TestCase
);
}
- public function unacceptableVersions()
+ static public function unacceptableVersions()
{
return [
['1.*',],
diff --git a/tests/unit/Espo/Core/Utils/Config/ConfigWriterTest.php b/tests/unit/Espo/Core/Utils/Config/ConfigWriterTest.php
index a29c2e8381..d1eb714e80 100644
--- a/tests/unit/Espo/Core/Utils/Config/ConfigWriterTest.php
+++ b/tests/unit/Espo/Core/Utils/Config/ConfigWriterTest.php
@@ -29,16 +29,21 @@
namespace tests\unit\Espo\Core\Utils\Config;
-use Espo\Core\{
- Utils\Config,
- Utils\Config\ConfigWriter,
- Utils\Config\ConfigWriterFileManager,
- Utils\Config\ConfigWriterHelper,
- Utils\Config\InternalConfigHelper,
-};
-
-class ConfigWriterTest extends \PHPUnit\Framework\TestCase
+use Espo\Core\Utils\Config;
+use Espo\Core\Utils\Config\ConfigWriter;
+use Espo\Core\Utils\Config\ConfigWriterFileManager;
+use Espo\Core\Utils\Config\ConfigWriterHelper;
+use Espo\Core\Utils\Config\InternalConfigHelper;
+use PHPUnit\Framework\TestCase;
+
+class ConfigWriterTest extends TestCase
{
+ private $fileManager;
+ private $config;
+ private $helper;
+ private $internalConfigHelper;
+ private $configWriter;
+
protected function setUp(): void
{
$this->fileManager = $this->createMock(ConfigWriterFileManager::class);
@@ -111,15 +116,12 @@ class ConfigWriterTest extends \PHPUnit\Framework\TestCase
->method('update');
$this->fileManager
+ ->expects($this->any())
->method('isFile')
- ->withConsecutive(
- [$this->configPath],
- [$this->internalConfigPath],
- )
- ->willReturnOnConsecutiveCalls(
- true,
- false
- );
+ ->willReturnMap([
+ [$this->configPath, true],
+ [$this->internalConfigPath, false],
+ ]);
$this->fileManager
->expects($this->once())
@@ -129,11 +131,10 @@ class ConfigWriterTest extends \PHPUnit\Framework\TestCase
$this->fileManager
->expects($this->exactly(2))
->method('getPhpContents')
- ->withConsecutive(
- [$this->configPath],
- [$this->configPath],
- )
- ->willReturnOnConsecutiveCalls($previousData, $previousData);
+ ->willReturnMap([
+ [$this->configPath, $previousData],
+ [$this->configPath, $previousData],
+ ]);
$this->configWriter->save();
}
@@ -145,12 +146,12 @@ class ConfigWriterTest extends \PHPUnit\Framework\TestCase
$this->internalConfigHelper
->method('isParamForInternalConfig')
- ->will(
- $this->returnValueMap([
+ ->willReturnMap(
+ [
['k1', false],
['k2', true],
['cacheTimestamp', false],
- ])
+ ]
);
$this->helper
@@ -164,36 +165,36 @@ class ConfigWriterTest extends \PHPUnit\Framework\TestCase
->willReturn(1);
$this->fileManager
+ ->expects(self::any())
->method('isFile')
- ->withConsecutive(
- [$this->configPath],
- [$this->internalConfigPath],
- )
- ->willReturnOnConsecutiveCalls(
- true,
- true
- );
+ ->willReturnMap([
+ [$this->configPath, true],
+ [$this->internalConfigPath, true],
+ ]);
$this->fileManager
->expects($this->exactly(4))
->method('getPhpContents')
- ->withConsecutive(
- [$this->configPath],
- [$this->internalConfigPath],
- [$this->internalConfigPath],
- [$this->configPath],
- )
- ->willReturnOnConsecutiveCalls(
- [],
- [],
- );
+ ->willReturnMap([
+ [$this->configPath, []],
+ [$this->internalConfigPath, []],
+ [$this->internalConfigPath, []],
+ [$this->configPath, []],
+ ]);
$this->fileManager
- ->method('putPhpcontents')
- ->withConsecutive(
- [$this->internalConfigPath, ['k2' => 'v2', 'microtimeInternal' => 1.0]],
- [$this->configPath, ['k1' => 'v1', 'cacheTimestamp' => 1, 'microtime' => 1.0]],
- );
+ ->expects(self::any())
+ ->method('putPhpContents')
+ ->willReturnMap([
+ [
+ $this->internalConfigPath,
+ ['k2' => 'v2', 'microtimeInternal' => 1.0]
+ ],
+ [
+ $this->configPath,
+ ['k1' => 'v1', 'cacheTimestamp' => 1, 'microtime' => 1.0]
+ ],
+ ]);
$this->configWriter->save();
}
diff --git a/tests/unit/Espo/Core/Utils/File/ManagerTest.php b/tests/unit/Espo/Core/Utils/File/ManagerTest.php
index 5ce88962eb..3dd6a04bae 100644
--- a/tests/unit/Espo/Core/Utils/File/ManagerTest.php
+++ b/tests/unit/Espo/Core/Utils/File/ManagerTest.php
@@ -29,12 +29,12 @@
namespace tests\unit\Espo\Core\Utils\File;
+use PHPUnit\Framework\TestCase;
use tests\unit\ReflectionHelper;
-
use Espo\Core\Utils\Util;
use Espo\Core\Utils\File\Manager as FileManager;
-class ManagerTest extends \PHPUnit\Framework\TestCase
+class ManagerTest extends TestCase
{
/**
* @var FileManager
@@ -42,9 +42,7 @@ class ManagerTest extends \PHPUnit\Framework\TestCase
private $fileManager;
protected $filesPath = 'tests/unit/testData/FileManager';
-
- protected $cachePath = 'tests/unit/testData/cache/FileManager';
-
+ protected const CACHE_PATH = 'tests/unit/testData/cache/FileManager';
protected $reflection;
protected function setUp(): void
@@ -77,7 +75,7 @@ class ManagerTest extends \PHPUnit\Framework\TestCase
public function testPutContents()
{
- $testPath = $this->cachePath;
+ $testPath = self::CACHE_PATH;
$result= 'next value';
@@ -159,7 +157,7 @@ class ManagerTest extends \PHPUnit\Framework\TestCase
public function testUnsetContents()
{
- $testPath = $this->cachePath.'/unsets.json';
+ $testPath = self::CACHE_PATH.'/unsets.json';
$initData = '{"fields":{"someName":{"type":"varchar","maxLength":40},"someName2":{"type":"varchar","maxLength":36}}}';
$this->fileManager->putContents($testPath, $initData);
@@ -314,10 +312,10 @@ class ManagerTest extends \PHPUnit\Framework\TestCase
$this->assertEquals($result, $this->reflection->invokeMethod('getSingleFileList', array($input, false)));
}
- public function fileListSets()
+ static public function fileListSets()
{
- return array(
- array( 'Set1', array(
+ return [
+ ['Set1', [
'custom',
'custom/Espo',
'custom/Espo/Custom',
@@ -325,10 +323,10 @@ class ManagerTest extends \PHPUnit\Framework\TestCase
'custom/Espo/Custom/Modules/TestModule',
'custom/Espo/Custom/Modules/TestModule/SubFolder',
'custom/Espo/Custom/Modules/TestModule/SubFolder/Tester.txt',
- )
- ),
+ ]
+ ],
- array( 'Set2', array(
+ ['Set2', [
'custom',
'custom/Espo',
'custom/Espo/Custom',
@@ -336,15 +334,15 @@ class ManagerTest extends \PHPUnit\Framework\TestCase
'custom/Espo/Custom/Resources/metadata',
'custom/Espo/Custom/Resources/metadata/entityDefs',
'custom/Espo/Custom/Resources/metadata/entityDefs/Account.json',
- )
- ),
+ ]
+ ],
- array( 'Set3', array(
+ ['Set3', [
'custom',
'custom/test.file',
- )
- ),
- );
+ ]
+ ],
+ ];
}
/**
@@ -353,7 +351,7 @@ class ManagerTest extends \PHPUnit\Framework\TestCase
public function testRemoveWithEmptyDirs($name, $result)
{
$path = Util::fixPath($this->filesPath . '/Remove/' . $name);
- $cachePath = Util::fixPath($this->cachePath . '/' . $name);
+ $cachePath = Util::fixPath(self::CACHE_PATH . '/' . $name);
$result = array_map('\Espo\Core\Utils\Util::fixPath', $result);
$fileList = array (
@@ -370,15 +368,15 @@ class ManagerTest extends \PHPUnit\Framework\TestCase
}
}
- public function existsPathSet()
+ static public function existsPathSet()
{
- return array(
- array( 'application/Espo/Core/Application.php', 'application/Espo/Core/Application.php', ),
- array( 'application/Espo/Core/NotRealApplication.php', 'application/Espo/Core'),
- array( 'application/Espo/Core/NotRealApplication.php', 'application/Espo/Core'),
- array( 'application/NoEspo/Core/Application.php', 'application'),
- array( 'notRealPath/Espo/Core/Application.php', '.'),
- );
+ return [
+ ['application/Espo/Core/Application.php', 'application/Espo/Core/Application.php',],
+ ['application/Espo/Core/NotRealApplication.php', 'application/Espo/Core'],
+ ['application/Espo/Core/NotRealApplication.php', 'application/Espo/Core'],
+ ['application/NoEspo/Core/Application.php', 'application'],
+ ['notRealPath/Espo/Core/Application.php', '.'],
+ ];
}
/**
@@ -395,7 +393,7 @@ class ManagerTest extends \PHPUnit\Framework\TestCase
public function testCopyTestCase1()
{
$path = Util::fixPath($this->filesPath . '/copy/testCase1');
- $cachePath = Util::fixPath($this->cachePath . '/copy/testCase1');
+ $cachePath = Util::fixPath(self::CACHE_PATH . '/copy/testCase1');
$expectedResult = [
'custom/Espo/Custom/Modules/ExtensionTest/File.json',
@@ -416,7 +414,7 @@ class ManagerTest extends \PHPUnit\Framework\TestCase
public function testCopyTestCase2()
{
$path = Util::fixPath($this->filesPath . '/copy/testCase2');
- $cachePath = Util::fixPath($this->cachePath . '/copy/testCase2');
+ $cachePath = Util::fixPath(self::CACHE_PATH . '/copy/testCase2');
$expectedResult = [
'custom/Espo/Custom/test1.php',
@@ -438,7 +436,7 @@ class ManagerTest extends \PHPUnit\Framework\TestCase
public function testCopyTestCase3()
{
$path = Util::fixPath($this->filesPath . '/copy/testCase3');
- $cachePath = Util::fixPath($this->cachePath . '/copy/testCase3');
+ $cachePath = Util::fixPath(self::CACHE_PATH . '/copy/testCase3');
$expectedResult = [
'custom/Espo/Custom/test1.php',
@@ -469,7 +467,7 @@ class ManagerTest extends \PHPUnit\Framework\TestCase
public function testCopyTestCase4()
{
$path = Util::fixPath($this->filesPath . '/copy/testCase4');
- $cachePath = Util::fixPath($this->cachePath . '/copy/testCase4');
+ $cachePath = Util::fixPath(self::CACHE_PATH . '/copy/testCase4');
$expectedResult = [
'custom',
@@ -502,9 +500,9 @@ class ManagerTest extends \PHPUnit\Framework\TestCase
}
}
- public function relativePathData()
+ static public function relativePathData()
{
- $tmpPath = $this->cachePath;
+ $tmpPath = self::CACHE_PATH;
if (!file_exists($tmpPath)) {
mkdir($tmpPath, 0775, true);
diff --git a/tests/unit/Espo/Core/Utils/File/PermissionTest.php b/tests/unit/Espo/Core/Utils/File/PermissionTest.php
index 596251db75..afadd3a145 100644
--- a/tests/unit/Espo/Core/Utils/File/PermissionTest.php
+++ b/tests/unit/Espo/Core/Utils/File/PermissionTest.php
@@ -29,27 +29,26 @@
namespace tests\unit\Espo\Core\Utils\File;
+use Espo\Core\Utils\File\Permission;
+use PHPUnit\Framework\TestCase;
use tests\unit\ReflectionHelper;
-class PermissionTest extends \PHPUnit\Framework\TestCase
+class PermissionTest extends TestCase
{
protected $object;
-
protected $objects;
-
protected $reflection;
-
protected $fileList;
protected function setUp() : void
{
$this->objects['fileManager'] = $this->getMockBuilder('\Espo\Core\Utils\File\Manager')->disableOriginalConstructor()->getMock();
- $this->object = new \Espo\Core\Utils\File\Permission($this->objects['fileManager']);
+ $this->object = new Permission($this->objects['fileManager']);
$this->reflection = new ReflectionHelper($this->object);
- $this->fileList = array(
+ $this->fileList = [
'application/Espo/Controllers/Email.php',
'application/Espo/Controllers/EmailAccount.php',
'application/Espo/Controllers/EmailAddress.php',
@@ -64,7 +63,7 @@ class PermissionTest extends \PHPUnit\Framework\TestCase
'application/Espo/Resources/layouts/User/filters.json',
'application/Espo/Resources/metadata/app/acl.json',
'application/Espo/Resources/metadata/app/defaultDashboardLayout.json'
- );
+ ];
}
protected function tearDown() : void
@@ -102,7 +101,7 @@ class PermissionTest extends \PHPUnit\Framework\TestCase
$this->assertEquals( $result, $this->object->arrangePermissionList($this->fileList) );
}
- public function requiredPermissionsData()
+ static public function requiredPermissionsData()
{
return [
['data/config.php', '0775', '0664'],
diff --git a/tests/unit/Espo/Core/Utils/ModuleTest.php b/tests/unit/Espo/Core/Utils/ModuleTest.php
index 780adc34db..41a355d14d 100644
--- a/tests/unit/Espo/Core/Utils/ModuleTest.php
+++ b/tests/unit/Espo/Core/Utils/ModuleTest.php
@@ -31,8 +31,9 @@ namespace tests\unit\Espo\Core\Utils;
use Espo\Core\Utils\Module;
use Espo\Core\Utils\File\Manager as FileManager;
+use PHPUnit\Framework\TestCase;
-class ModuleTest extends \PHPUnit\Framework\TestCase
+class ModuleTest extends TestCase
{
/** @var Module */
private $module;
@@ -49,61 +50,46 @@ class ModuleTest extends \PHPUnit\Framework\TestCase
public function testOrder1(): void
{
$this->fileManager
+ ->expects(self::any())
->method('getDirList')
- ->withConsecutive(
- ['application/Espo/Modules'],
- ['custom/Espo/Modules'],
- )
- ->willReturnOnConsecutiveCalls(
- ['M01', 'M02', 'M1', 'M2'],
- ['M3', 'M4', 'M51', 'M52'],
- );
+ ->willReturnMap([
+ [
+ 'application/Espo/Modules',
+ ['M01', 'M02', 'M1', 'M2'],
+ ],
+ [
+ 'custom/Espo/Modules',
+ ['M3', 'M4', 'M51', 'M52'],
+ ]
+ ]);
$this->fileManager
+ ->expects(self::any())
->method('exists')
- ->withConsecutive(
- ['application/Espo/Modules/M01/Resources/module.json'],
- ['application/Espo/Modules/M02/Resources/module.json'],
- ['application/Espo/Modules/M1/Resources/module.json'],
- ['application/Espo/Modules/M2/Resources/module.json'],
- ['custom/Espo/Modules/M3/Resources/module.json'],
- ['custom/Espo/Modules/M4/Resources/module.json'],
- ['custom/Espo/Modules/M51/Resources/module.json'],
- ['custom/Espo/Modules/M52/Resources/module.json'],
- )
- ->willReturnOnConsecutiveCalls(
- true,
- true,
- true,
- true,
- true,
- true,
- true,
- true,
- );
+ ->willReturnMap([
+ ['application/Espo/Modules/M01/Resources/module.json', true],
+ ['application/Espo/Modules/M02/Resources/module.json', true],
+ ['application/Espo/Modules/M1/Resources/module.json', true],
+ ['application/Espo/Modules/M2/Resources/module.json', true],
+ ['custom/Espo/Modules/M3/Resources/module.json', true],
+ ['custom/Espo/Modules/M4/Resources/module.json', true],
+ ['custom/Espo/Modules/M51/Resources/module.json', true],
+ ['custom/Espo/Modules/M52/Resources/module.json', true],
+ ]);
$this->fileManager
+ ->expects(self::any())
->method('getContents')
- ->withConsecutive(
- ['application/Espo/Modules/M01/Resources/module.json'],
- ['application/Espo/Modules/M02/Resources/module.json'],
- ['application/Espo/Modules/M1/Resources/module.json'],
- ['application/Espo/Modules/M2/Resources/module.json'],
- ['custom/Espo/Modules/M3/Resources/module.json'],
- ['custom/Espo/Modules/M4/Resources/module.json'],
- ['custom/Espo/Modules/M51/Resources/module.json'],
- ['custom/Espo/Modules/M52/Resources/module.json'],
- )
- ->willReturnOnConsecutiveCalls(
- '{"order": 11}',
- '{"order": 11}',
- '{"order": 4}',
- '{"order": 3}',
- '{"order": 2}',
- '{"order": 1}',
- '{"order": 12}',
- '{"order": 12}',
- );
+ ->willReturnMap([
+ ['application/Espo/Modules/M01/Resources/module.json', '{"order": 11}'],
+ ['application/Espo/Modules/M02/Resources/module.json', '{"order": 11}'],
+ ['application/Espo/Modules/M1/Resources/module.json', '{"order": 4}'],
+ ['application/Espo/Modules/M2/Resources/module.json', '{"order": 3}'],
+ ['custom/Espo/Modules/M3/Resources/module.json', '{"order": 2}'],
+ ['custom/Espo/Modules/M4/Resources/module.json', '{"order": 1}'],
+ ['custom/Espo/Modules/M51/Resources/module.json', '{"order": 12}'],
+ ['custom/Espo/Modules/M52/Resources/module.json', '{"order": 12}'],
+ ]);
$this->assertEquals(
['M4', 'M3', 'M2', 'M1', 'M01', 'M02', 'M51', 'M52'],
diff --git a/tests/unit/Espo/Core/Utils/UtilTest.php b/tests/unit/Espo/Core/Utils/UtilTest.php
index 13dc2689c1..4b3387642b 100644
--- a/tests/unit/Espo/Core/Utils/UtilTest.php
+++ b/tests/unit/Espo/Core/Utils/UtilTest.php
@@ -1179,7 +1179,7 @@ class UtilTest extends \PHPUnit\Framework\TestCase
);
}
- public function getClassNames(): array
+ static public function getClassNames(): array
{
return [
'application/Espo/EntryPoints/Download.php' => ['application/Espo/EntryPoints/Download.php'],
@@ -1599,10 +1599,10 @@ class UtilTest extends \PHPUnit\Framework\TestCase
'newAttr2' => false,
);
- $this->assertEquals($result, \Espo\Core\Utils\Util::arrayDiff($array1, $array2));
+ $this->assertEquals($result, Util::arrayDiff($array1, $array2));
}
- public function htmlList()
+ static public function htmlList()
{
return [
['Test&lt;script&gt;alert(&quot;test&quot;)&lt;/script&gt;', 'Test<script>alert("test")</script>'],
@@ -1622,7 +1622,7 @@ class UtilTest extends \PHPUnit\Framework\TestCase
$this->assertEquals($expectedResult, Util::sanitizeHtml($html));
}
- public function urlAddParamList()
+ static public function urlAddParamList()
{
return [
['https://test.link/?param1=1111', 'https://test.link', 'param1', '1111'],
@@ -1644,7 +1644,7 @@ class UtilTest extends \PHPUnit\Framework\TestCase
$this->assertEquals($expectedResult, Util::urlAddParam($url, $paramName, $paramValue));
}
- public function urlRemoveParamList()
+ static public function urlRemoveParamList()
{
return [
['https://test.link', 'https://test.link', 'param1'],
diff --git a/tests/unit/Espo/ORM/BaseLockerTest.php b/tests/unit/Espo/ORM/BaseLockerTest.php
index d6f455e146..894bffd472 100644
--- a/tests/unit/Espo/ORM/BaseLockerTest.php
+++ b/tests/unit/Espo/ORM/BaseLockerTest.php
@@ -29,23 +29,26 @@
namespace tests\unit\Espo\ORM;
-use Espo\ORM\{
- TransactionManager,
- QueryComposer\MysqlQueryComposer,
- EntityFactory,
- Metadata,
- Locker\BaseLocker,
-};
+use Espo\ORM\EntityFactory;
+use Espo\ORM\Locker\BaseLocker;
+use Espo\ORM\Metadata;
+use Espo\ORM\QueryComposer\MysqlQueryComposer;
+use Espo\ORM\TransactionManager;
use PDO;
+use PHPUnit\Framework\TestCase;
-class BaseLockerTest extends \PHPUnit\Framework\TestCase
+class BaseLockerTest extends TestCase
{
+ private $transactionManager;
+ private $locker;
+ private $pdo;
+
protected function setUp() : void
{
- $this->pdo = $this->getMockBuilder(PDO::class)->disableOriginalConstructor()->getMock();
+ $this->pdo = $this->createMock(PDO::class);
- $entityFactory = $this->getMockBuilder(EntityFactory::class)->disableOriginalConstructor()->getMock();
+ $entityFactory = $this->createMock(EntityFactory::class);
$metadata = $this->getMockBuilder(Metadata::class)->disableOriginalConstructor()->getMock();
@@ -63,13 +66,22 @@ class BaseLockerTest extends \PHPUnit\Framework\TestCase
->expects($this->exactly(2))
->method('start');
+ $invokedCount = $this->exactly(2);
+
$this->pdo
- ->expects($this->exactly(2))
+ ->expects($invokedCount)
->method('exec')
- ->withConsecutive(
- ['LOCK TABLES `account` WRITE'],
- ['LOCK TABLES `contact` READ'],
- );
+ ->willReturnCallback(function ($sql) use ($invokedCount) {
+ if ($invokedCount->numberOfInvocations() === 1) {
+ $this->assertEquals('LOCK TABLES `account` WRITE', $sql);
+ }
+
+ if ($invokedCount->numberOfInvocations() === 2) {
+ $this->assertEquals('LOCK TABLES `contact` READ', $sql);
+ }
+
+ return 1;
+ });
$this->transactionManager
->expects($this->once())
@@ -91,13 +103,22 @@ class BaseLockerTest extends \PHPUnit\Framework\TestCase
->expects($this->exactly(2))
->method('start');
+ $invokedCount = $this->exactly(2);
+
$this->pdo
- ->expects($this->exactly(2))
+ ->expects($invokedCount)
->method('exec')
- ->withConsecutive(
- ['LOCK TABLES `account` WRITE'],
- ['LOCK TABLES `contact` READ'],
- );
+ ->willReturnCallback(function ($sql) use ($invokedCount) {
+ if ($invokedCount->numberOfInvocations() === 1) {
+ $this->assertEquals('LOCK TABLES `account` WRITE', $sql);
+ }
+
+ if ($invokedCount->numberOfInvocations() === 2) {
+ $this->assertEquals('LOCK TABLES `contact` READ', $sql);
+ }
+
+ return 1;
+ });
$this->transactionManager
->expects($this->once())
diff --git a/tests/unit/Espo/ORM/MapperTest.php b/tests/unit/Espo/ORM/MapperTest.php
index 7150e6b498..9e9067c5ea 100644
--- a/tests/unit/Espo/ORM/MapperTest.php
+++ b/tests/unit/Espo/ORM/MapperTest.php
@@ -27,6 +27,8 @@
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
+/** @noinspection PhpVariableIsUsedOnlyInClosureInspection */
+
namespace tests\unit\Espo\ORM;
use Espo\ORM\CollectionFactory;
@@ -44,6 +46,8 @@ use Espo\ORM\QueryComposer\QueryComposerWrapper;
use Espo\ORM\Executor\SqlExecutor;
use Espo\ORM\SthCollection;
+use PHPUnit\Framework\TestCase;
+use RuntimeException;
use tests\unit\testData\DB\Comment;
use tests\unit\testData\DB\Note;
use tests\unit\testData\DB\Post;
@@ -54,7 +58,7 @@ use PDOStatement;
require_once 'tests/unit/testData/DB/Entities.php';
-class MapperTest extends \PHPUnit\Framework\TestCase
+class MapperTest extends TestCase
{
protected $db;
protected $pdo;
@@ -62,6 +66,15 @@ class MapperTest extends \PHPUnit\Framework\TestCase
protected $note;
protected $comment;
protected $entityFactory;
+ protected $team;
+ protected $account;
+ protected $contact;
+ protected $postData;
+ protected $tag;
+ protected $query;
+ protected $sqlExecutor;
+ protected $metadata;
+
private ?CollectionFactory $collectionFactory = null;
protected function setUp() : void
@@ -70,11 +83,11 @@ class MapperTest extends \PHPUnit\Framework\TestCase
$this->pdo
->expects($this->any())
->method('quote')
- ->will($this->returnCallback(function() {
+ ->willReturnCallback(function() {
$args = func_get_args();
return "'" . $args[0] . "'";
- }));
+ });
$ormMetadata = include('tests/unit/testData/DB/ormMetadata.php');
@@ -92,28 +105,26 @@ class MapperTest extends \PHPUnit\Framework\TestCase
$entityManager
->method('getMetadata')
- ->will($this->returnValue($this->metadata));
+ ->willReturn($this->metadata);
$this->entityFactory = $this->createMock(EntityFactory::class);
$this->entityFactory
->expects($this->any())
->method('create')
- ->will($this->returnCallback(
+ ->willReturnCallback(
function () use ($entityManager) {
$args = func_get_args();
-
$className = "tests\\unit\\testData\\DB\\" . $args[0];
-
$defs = $this->metadata->get($args[0]) ?? [];
return new $className($args[0], $defs, $entityManager);
}
- ));
+ );
$entityManager
->method('getEntityFactory')
- ->will($this->returnValue($this->entityFactory));
+ ->willReturn($this->entityFactory);
$entityFactory = $this->entityFactory;
@@ -130,7 +141,7 @@ class MapperTest extends \PHPUnit\Framework\TestCase
$this->entityFactory,
$this->collectionFactory,
$this->metadata,
- $queryExecutor
+ $queryExecutor,
);
$this->post = $entityFactory->create('Post');
@@ -156,7 +167,7 @@ class MapperTest extends \PHPUnit\Framework\TestCase
if (!$noIteration) {
$values = [];
- foreach ($data as $i => $item) {
+ foreach ($data as $item) {
$values[] = $item;
}
@@ -167,7 +178,7 @@ class MapperTest extends \PHPUnit\Framework\TestCase
$sth->expects($this->any())
->method('fetchAll')
- ->will($this->returnValue($data));
+ ->willReturn($data);
return $sth;
}
@@ -182,15 +193,14 @@ class MapperTest extends \PHPUnit\Framework\TestCase
if ($return === true) {
$return = $this->createSthMock([]);
- } else
- if (is_array($return)) {
+ } else if (is_array($return)) {
$return = $this->createSthMock($return, $noIteration);
}
$this->sqlExecutor->expects($expects)
- ->method('execute')
- ->with($sql)
- ->will($this->returnValue($return));
+ ->method('execute')
+ ->with($sql)
+ ->willReturn($return);
}
protected function mockSqlCollection(string $entityType, string $sql, SthCollection $collection)
@@ -206,8 +216,6 @@ class MapperTest extends \PHPUnit\Framework\TestCase
{
$collection = $this->getMockBuilder(SthCollection::class)->disableOriginalConstructor()->getMock();
- $itemList = $itemList ?? [];
-
$generator = (function () use ($itemList) {
foreach ($itemList as $item) {
yield $item;
@@ -217,8 +225,8 @@ class MapperTest extends \PHPUnit\Framework\TestCase
$collection
->expects($this->any())
->method('getIterator')
- ->will(
- $this->returnValue($generator)
+ ->willReturn(
+ $generator
);
return $collection;
@@ -253,7 +261,7 @@ class MapperTest extends \PHPUnit\Framework\TestCase
$post = $this->db->selectOne($select);
- $this->assertEquals($post->id, '1');
+ $this->assertEquals('1', $post->id);
}
public function testSelect1(): void
@@ -310,7 +318,7 @@ class MapperTest extends \PHPUnit\Framework\TestCase
$this->assertTrue($entity instanceof Post);
$this->assertTrue(isset($entity->id));
- $this->assertEquals($entity->id, '2');
+ $this->assertEquals('2', $entity->id);
}
public function testSelectWithSpecifiedParams(): void
@@ -631,7 +639,7 @@ class MapperTest extends \PHPUnit\Framework\TestCase
$count = $this->db->countRelated($this->post, 'tags');
- $this->assertEquals($count, 1);
+ $this->assertEquals(1, $count);
}
public function testCount1(): void
@@ -667,9 +675,8 @@ class MapperTest extends \PHPUnit\Framework\TestCase
public function testInsert()
{
$query = "INSERT INTO `post` (`id`, `name`) VALUES ('1', 'test')";
- $return = true;
- $this->mockQuery($query, $return);
+ $this->mockQuery($query);
$this->post->reset();
$this->post->id = '1';
@@ -684,8 +691,8 @@ class MapperTest extends \PHPUnit\Framework\TestCase
$query =
"INSERT INTO `post` (`id`, `name`, `deleted`) VALUES ('1', 'test', 0) " .
"ON DUPLICATE KEY UPDATE `name` = 'test', `deleted` = 0";
- $return = true;
- $this->mockQuery($query, $return);
+
+ $this->mockQuery($query);
$this->post->reset();
$this->post->id = '1';
@@ -698,8 +705,8 @@ class MapperTest extends \PHPUnit\Framework\TestCase
public function testMassInsert()
{
$query = "INSERT INTO `post` (`id`, `name`) VALUES ('1', 'test1'), ('2', 'test2')";
- $return = true;
- $this->mockQuery($query, $return);
+
+ $this->mockQuery($query);
$post1 = $this->entityFactory->create('Post');
$post2 = $this->entityFactory->create('Post');
@@ -721,8 +728,7 @@ class MapperTest extends \PHPUnit\Framework\TestCase
public function testUpdate1()
{
$query = "UPDATE `post` SET post.name = 'test' WHERE post.id = '1' AND post.deleted = 0";
- $return = true;
- $this->mockQuery($query, $return);
+ $this->mockQuery($query);
$this->post->reset();
$this->post->id = '1';
@@ -734,8 +740,7 @@ class MapperTest extends \PHPUnit\Framework\TestCase
public function testUpdate2()
{
$query = "UPDATE `post` SET post.name = 'test', post.deleted = 0 WHERE post.id = '1' AND post.deleted = 0";
- $return = true;
- $this->mockQuery($query, $return);
+ $this->mockQuery($query);
$this->post->reset();
$this->post->id = '1';
@@ -749,7 +754,7 @@ class MapperTest extends \PHPUnit\Framework\TestCase
{
$query = "UPDATE `job` SET job.array = '[\"2\",\"1\"]' WHERE job.id = '1' AND job.deleted = 0";
- $this->mockQuery($query, true);
+ $this->mockQuery($query);
$job = $this->entityFactory->create('Job');
$job->id = '1';
@@ -763,7 +768,7 @@ class MapperTest extends \PHPUnit\Framework\TestCase
{
$query = "UPDATE `job` SET job.array = NULL WHERE job.id = '1' AND job.deleted = 0";
- $this->mockQuery($query, true);
+ $this->mockQuery($query);
$job = $this->entityFactory->create('Job');
$job->id = '1';
@@ -806,7 +811,7 @@ class MapperTest extends \PHPUnit\Framework\TestCase
"UPDATE `note` SET note.parent_id = NULL, note.parent_type = NULL " .
"WHERE note.id = 'noteId' AND note.parent_id = 'postId' AND note.parent_type = 'Post' AND note.deleted = 0";
- $this->mockQuery($query, true);
+ $this->mockQuery($query);
$this->note->id = 'noteId';
$this->post->id = 'postId';
@@ -820,7 +825,7 @@ class MapperTest extends \PHPUnit\Framework\TestCase
"UPDATE `note` SET note.parent_id = NULL, note.parent_type = NULL " .
"WHERE note.id = 'noteId' AND note.deleted = 0";
- $this->mockQuery($query, true);
+ $this->mockQuery($query);
$this->note->id = 'noteId';
$this->db->unrelateAll($this->note, 'parent');
@@ -832,7 +837,7 @@ class MapperTest extends \PHPUnit\Framework\TestCase
"UPDATE `comment` SET comment.post_id = NULL " .
"WHERE comment.id = 'commentId' AND comment.post_id = 'postId' AND comment.deleted = 0";
- $this->mockQuery($query, true);
+ $this->mockQuery($query);
$this->post->id = 'postId';
@@ -866,7 +871,7 @@ class MapperTest extends \PHPUnit\Framework\TestCase
$this->db->unrelateById($this->post, 'postData', 'dataId');
}
- public function testRemovenParentToChildren()
+ public function testRemovedParentToChildren()
{
$query =
"UPDATE `note` SET note.parent_id = NULL, note.parent_type = NULL " .
@@ -895,8 +900,7 @@ class MapperTest extends \PHPUnit\Framework\TestCase
public function testRemoveManyMany()
{
$query = "UPDATE `post_tag` SET post_tag.deleted = 1 WHERE post_tag.post_id = '1' AND post_tag.tag_id = '100'";
- $return = true;
- $this->mockQuery($query, $return);
+ $this->mockQuery($query);
$this->post->id = '1';
@@ -906,8 +910,8 @@ class MapperTest extends \PHPUnit\Framework\TestCase
public function testRemoveAllManyMany()
{
$query = "UPDATE `post_tag` SET post_tag.deleted = 1 WHERE post_tag.post_id = '1'";
- $return = true;
- $this->mockQuery($query, $return);
+
+ $this->mockQuery($query);
$this->post->id = '1';
@@ -920,7 +924,7 @@ class MapperTest extends \PHPUnit\Framework\TestCase
"UPDATE `entity_team` SET entity_team.deleted = 1 ".
"WHERE entity_team.entity_id = '1' AND entity_team.team_id = '100' AND entity_team.entity_type = 'Account'";
- $this->mockQuery($query, true);
+ $this->mockQuery($query);
$this->account->id = '1';
@@ -963,13 +967,26 @@ class MapperTest extends \PHPUnit\Framework\TestCase
$query2 =
"UPDATE `comment` SET comment.post_id = 'p' WHERE comment.id = 'c' AND comment.deleted = 0";
- $this->sqlExecutor->expects($this->exactly(2))
+ $invokedCount = $this->exactly(2);
+
+ $this->sqlExecutor
+ ->expects($invokedCount)
->method('execute')
- ->withConsecutive([$query1], [$query2])
- ->willReturnOnConsecutiveCalls(
- $this->createSthMock([['value' => 1]]),
- $this->createSthMock([])
- );
+ ->willReturnCallback(function ($sql) use ($invokedCount, $query1, $query2) {
+ if ($invokedCount->numberOfInvocations() === 1) {
+ $this->assertEquals($query1, $sql);
+
+ return $this->createSthMock([['value' => 1]]);
+ }
+
+ if ($invokedCount->numberOfInvocations() === 2) {
+ $this->assertEquals($query2, $sql);
+
+ return $this->createSthMock([]);
+ }
+
+ throw new RuntimeException();
+ });
$this->db->relate($this->post, 'comments', $this->comment);
}
@@ -986,13 +1003,26 @@ class MapperTest extends \PHPUnit\Framework\TestCase
$query2 =
"UPDATE `note` SET note.parent_id = 'p', note.parent_type = 'Post' WHERE note.id = 'n' AND note.deleted = 0";
- $this->sqlExecutor->expects($this->exactly(2))
+ $invokedCount = $this->exactly(2);
+
+ $this->sqlExecutor
+ ->expects($invokedCount)
->method('execute')
- ->withConsecutive([$query1], [$query2])
- ->willReturnOnConsecutiveCalls(
- $this->createSthMock([['value' => 1]]),
- $this->createSthMock([])
- );
+ ->willReturnCallback(function ($sql) use ($invokedCount, $query1, $query2) {
+ if ($invokedCount->numberOfInvocations() === 1) {
+ $this->assertEquals($query1, $sql);
+
+ return $this->createSthMock([['value' => 1]]);
+ }
+
+ if ($invokedCount->numberOfInvocations() === 2) {
+ $this->assertEquals($query2, $sql);
+
+ return $this->createSthMock([]);
+ }
+
+ throw new RuntimeException();
+ });
$this->db->relate($this->post, 'notes', $this->note);
}
@@ -1005,10 +1035,21 @@ class MapperTest extends \PHPUnit\Framework\TestCase
$query1 =
"UPDATE `comment` SET comment.post_id = 'p' WHERE comment.id = 'c' AND comment.deleted = 0";
- $this->sqlExecutor->expects($this->exactly(1))
+
+ $invokedCount = $this->exactly(1);
+
+ $this->sqlExecutor
+ ->expects($invokedCount)
->method('execute')
- ->withConsecutive([$query1])
- ->willReturnOnConsecutiveCalls($this->createSthMock([]));
+ ->willReturnCallback(function ($sql) use ($invokedCount, $query1) {
+ if ($invokedCount->numberOfInvocations() === 1) {
+ $this->assertEquals($query1, $sql);
+
+ return $this->createSthMock([]);
+ }
+
+ throw new RuntimeException();
+ });
$this->db->relate($this->comment, 'post', $this->post);
}
@@ -1021,10 +1062,20 @@ class MapperTest extends \PHPUnit\Framework\TestCase
$query1 =
"UPDATE `note` SET note.parent_id = 'p', note.parent_type = 'Post' WHERE note.id = 'n' AND note.deleted = 0";
- $this->sqlExecutor->expects($this->exactly(1))
+ $invokedCount = $this->exactly(1);
+
+ $this->sqlExecutor
+ ->expects($invokedCount)
->method('execute')
- ->withConsecutive([$query1])
- ->willReturnOnConsecutiveCalls($this->createSthMock([]));
+ ->willReturnCallback(function ($sql) use ($invokedCount, $query1) {
+ if ($invokedCount->numberOfInvocations() === 1) {
+ $this->assertEquals($query1, $sql);
+
+ return $this->createSthMock([]);
+ }
+
+ throw new RuntimeException();
+ });
$this->db->relate($this->note, 'parent', $this->post);
}
@@ -1040,10 +1091,26 @@ class MapperTest extends \PHPUnit\Framework\TestCase
$query2 =
"UPDATE `post_data` SET post_data.post_id = 'p' WHERE post_data.id = 'd' AND post_data.deleted = 0";
- $this->sqlExecutor->expects($this->exactly(2))
+ $invokedCount = $this->exactly(2);
+
+ $this->sqlExecutor
+ ->expects($invokedCount)
->method('execute')
- ->withConsecutive([$query1], [$query2])
- ->willReturnOnConsecutiveCalls($this->createSthMock([]), $this->createSthMock([]));
+ ->willReturnCallback(function ($sql) use ($invokedCount, $query1, $query2) {
+ if ($invokedCount->numberOfInvocations() === 1) {
+ $this->assertEquals($query1, $sql);
+
+ return $this->createSthMock([]);
+ }
+
+ if ($invokedCount->numberOfInvocations() === 2) {
+ $this->assertEquals($query2, $sql);
+
+ return $this->createSthMock([]);
+ }
+
+ throw new RuntimeException();
+ });
$this->db->relate($this->postData, 'post', $this->post);
}
@@ -1063,14 +1130,32 @@ class MapperTest extends \PHPUnit\Framework\TestCase
$query3 =
"UPDATE `post_data` SET post_data.post_id = 'p' WHERE post_data.id = 'd' AND post_data.deleted = 0";
- $this->sqlExecutor->expects($this->exactly(3))
+ $invokedCount = $this->exactly(3);
+
+ $this->sqlExecutor
+ ->expects($invokedCount)
->method('execute')
- ->withConsecutive([$query1], [$query2], [$query3])
- ->willReturnOnConsecutiveCalls(
- $this->createSthMock([['value' => 1]]),
- $this->createSthMock([]),
- $this->createSthMock([])
- );
+ ->willReturnCallback(function ($sql) use ($invokedCount, $query1, $query2, $query3) {
+ if ($invokedCount->numberOfInvocations() === 1) {
+ $this->assertEquals($query1, $sql);
+
+ return $this->createSthMock([['value' => 1]]);
+ }
+
+ if ($invokedCount->numberOfInvocations() === 2) {
+ $this->assertEquals($query2, $sql);
+
+ return $this->createSthMock([]);
+ }
+
+ if ($invokedCount->numberOfInvocations() === 3) {
+ $this->assertEquals($query3, $sql);
+
+ return $this->createSthMock([]);
+ }
+
+ throw new RuntimeException();
+ });
$this->db->relate($this->post, 'postData', $this->postData);
}
@@ -1092,20 +1177,38 @@ class MapperTest extends \PHPUnit\Framework\TestCase
"INSERT INTO `post_tag` (`post_id`, `tag_id`, `role`) VALUES ('postId', 'tagId', 'Test') " .
"ON DUPLICATE KEY UPDATE `deleted` = 0, `role` = 'Test'";
- $ps = $this->createMock(\PDOStatement::class);
+ $ps = $this->createMock(PDOStatement::class);
$ps->expects($this->exactly(1))
->method('rowCount')
->willReturn(0);
+
+ $invokedCount = $this->exactly(3);
+
$this->sqlExecutor
- ->expects($this->exactly(3))
+ ->expects($invokedCount)
->method('execute')
- ->withConsecutive([$query1], [$query2], [$query3])
- ->willReturnOnConsecutiveCalls(
- $this->createSthMock([['value' => 1]]),
- $ps,
- $this->createSthMock([])
- );
+ ->willReturnCallback(function ($sql) use ($invokedCount, $query1, $query2, $query3, $ps) {
+ if ($invokedCount->numberOfInvocations() === 1) {
+ $this->assertEquals($query1, $sql);
+
+ return $this->createSthMock([['value' => 1]]);
+ }
+
+ if ($invokedCount->numberOfInvocations() === 2) {
+ $this->assertEquals($query2, $sql);
+
+ return $ps;
+ }
+
+ if ($invokedCount->numberOfInvocations() === 3) {
+ $this->assertEquals($query3, $sql);
+
+ return $this->createSthMock([]);
+ }
+
+ throw new RuntimeException();
+ });
$this->db->relate($this->post, 'tags', $this->tag, ['role' => 'Test']);
}
@@ -1127,20 +1230,37 @@ class MapperTest extends \PHPUnit\Framework\TestCase
"UPDATE `post_tag` SET post_tag.deleted = 0, post_tag.role = 'Test' " .
"WHERE post_tag.post_id = 'postId' AND post_tag.tag_id = 'tagId'";
- $ps = $this->createMock(\PDOStatement::class);
+ $ps = $this->createMock(PDOStatement::class);
$ps->expects($this->exactly(1))
->method('rowCount')
->willReturn(1);
+ $invokedCount = $this->exactly(3);
+
$this->sqlExecutor
- ->expects($this->exactly(3))
+ ->expects($invokedCount)
->method('execute')
- ->withConsecutive([$query1], [$query2], [$query3])
- ->willReturnOnConsecutiveCalls(
- $this->createSthMock([['value' => 1]]),
- $ps,
- $this->createSthMock([])
- );
+ ->willReturnCallback(function ($sql) use ($invokedCount, $query1, $query2, $query3, $ps) {
+ if ($invokedCount->numberOfInvocations() === 1) {
+ $this->assertEquals($query1, $sql);
+
+ return $this->createSthMock([['value' => 1]]);
+ }
+
+ if ($invokedCount->numberOfInvocations() === 2) {
+ $this->assertEquals($query2, $sql);
+
+ return $ps;
+ }
+
+ if ($invokedCount->numberOfInvocations() === 3) {
+ $this->assertEquals($query3, $sql);
+
+ return $this->createSthMock([]);
+ }
+
+ throw new RuntimeException();
+ });
$this->db->relate($this->post, 'tags', $this->tag, ['role' => 'Test']);
}
@@ -1162,20 +1282,37 @@ class MapperTest extends \PHPUnit\Framework\TestCase
"INSERT INTO `entity_team` (`entity_id`, `team_id`, `entity_type`) VALUES ('accountId', 'teamId', 'Account') " .
"ON DUPLICATE KEY UPDATE `deleted` = 0";
- $ps = $this->createMock(\PDOStatement::class);
+ $ps = $this->createMock(PDOStatement::class);
$ps->expects($this->exactly(1))
->method('rowCount')
->willReturn(0);
+ $invokedCount = $this->exactly(3);
+
$this->sqlExecutor
- ->expects($this->exactly(3))
+ ->expects($invokedCount)
->method('execute')
- ->withConsecutive([$query1], [$query2], [$query3])
- ->willReturnOnConsecutiveCalls(
- $this->createSthMock([['value' => 1]]),
- $ps,
- $this->createSthMock([])
- );
+ ->willReturnCallback(function ($sql) use ($invokedCount, $query1, $query2, $query3, $ps) {
+ if ($invokedCount->numberOfInvocations() === 1) {
+ $this->assertEquals($query1, $sql);
+
+ return $this->createSthMock([['value' => 1]]);
+ }
+
+ if ($invokedCount->numberOfInvocations() === 2) {
+ $this->assertEquals($query2, $sql);
+
+ return $ps;
+ }
+
+ if ($invokedCount->numberOfInvocations() === 3) {
+ $this->assertEquals($query3, $sql);
+
+ return $this->createSthMock([]);
+ }
+
+ throw new RuntimeException();
+ });
$this->db->relate($this->account, 'teams', $this->team);
}
@@ -1197,20 +1334,37 @@ class MapperTest extends \PHPUnit\Framework\TestCase
"UPDATE `entity_team` SET entity_team.deleted = 0 " .
"WHERE entity_team.entity_id = 'accountId' AND entity_team.team_id = 'teamId' AND entity_team.entity_type = 'Account'";
- $ps = $this->createMock(\PDOStatement::class);
+ $ps = $this->createMock(PDOStatement::class);
$ps->expects($this->exactly(1))
->method('rowCount')
->willReturn(1);
+ $invokedCount = $this->exactly(3);
+
$this->sqlExecutor
- ->expects($this->exactly(3))
+ ->expects($invokedCount)
->method('execute')
- ->withConsecutive([$query1], [$query2], [$query3])
- ->willReturnOnConsecutiveCalls(
- $this->createSthMock([['value' => 1]]),
- $ps,
- $this->createSthMock([])
- );
+ ->willReturnCallback(function ($sql) use ($invokedCount, $query1, $query2, $query3, $ps) {
+ if ($invokedCount->numberOfInvocations() === 1) {
+ $this->assertEquals($query1, $sql);
+
+ return $this->createSthMock([['value' => 1]]);
+ }
+
+ if ($invokedCount->numberOfInvocations() === 2) {
+ $this->assertEquals($query2, $sql);
+
+ return $ps;
+ }
+
+ if ($invokedCount->numberOfInvocations() === 3) {
+ $this->assertEquals($query3, $sql);
+
+ return $this->createSthMock([]);
+ }
+
+ throw new RuntimeException();
+ });
$this->db->relate($this->account, 'teams', $this->team);
}
@@ -1261,7 +1415,7 @@ class MapperTest extends \PHPUnit\Framework\TestCase
$value = $this->db->max(Select::fromRaw(['from' => 'Post']), 'id');
- $this->assertEquals($value, 10);
+ $this->assertEquals(10, $value);
}
public function testMassRelate()
@@ -1271,8 +1425,7 @@ class MapperTest extends \PHPUnit\Framework\TestCase
"SELECT '1' AS `v0`, tag.id AS `id` FROM `tag` WHERE tag.name = 'test' AND tag.deleted = 0 ".
"ON DUPLICATE KEY UPDATE `deleted` = 0";
- $return = true;
- $this->mockQuery($query, $return);
+ $this->mockQuery($query);
$this->post->id = '1';
diff --git a/tests/unit/Espo/ORM/MysqlLockerTest.php b/tests/unit/Espo/ORM/MysqlLockerTest.php
index 6e7084443b..f9ba31b35e 100644
--- a/tests/unit/Espo/ORM/MysqlLockerTest.php
+++ b/tests/unit/Espo/ORM/MysqlLockerTest.php
@@ -29,44 +29,53 @@
namespace tests\unit\Espo\ORM;
-use Espo\ORM\{
- TransactionManager,
- QueryComposer\MysqlQueryComposer,
- EntityFactory,
- Metadata,
- Locker\MysqlLocker,
-};
+use Espo\ORM\EntityFactory;
+use Espo\ORM\Locker\MysqlLocker;
+use Espo\ORM\Metadata;
+use Espo\ORM\QueryComposer\MysqlQueryComposer;
+use Espo\ORM\TransactionManager;
use PDO;
+use PHPUnit\Framework\TestCase;
-class MysqlLockerTest extends \PHPUnit\Framework\TestCase
+class MysqlLockerTest extends TestCase
{
+ private $locker;
+ private $pdo;
+
protected function setUp() : void
{
- $this->pdo = $this->getMockBuilder(PDO::class)->disableOriginalConstructor()->getMock();
-
- $entityFactory = $this->getMockBuilder(EntityFactory::class)->disableOriginalConstructor()->getMock();
-
- $metadata = $this->getMockBuilder(Metadata::class)->disableOriginalConstructor()->getMock();
-
- $this->transactionManager = $this->getMockBuilder(TransactionManager::class)
- ->disableOriginalConstructor()->getMock();
+ $this->pdo = $this->createMock(PDO::class);
+ $entityFactory = $this->createMock(EntityFactory::class);
+ $metadata = $this->createMock(Metadata::class);
+ $transactionManager = $this->createMock(TransactionManager::class);
$composer = new MysqlQueryComposer($this->pdo, $entityFactory, $metadata);
-
- $this->locker = new MysqlLocker($this->pdo, $composer, $this->transactionManager);
+ $this->locker = new MysqlLocker($this->pdo, $composer, $transactionManager);
}
public function testLockCommit()
{
+ $invokedCount = $this->exactly(3);
+
$this->pdo
- ->expects($this->exactly(3))
+ ->expects($invokedCount)
->method('exec')
- ->withConsecutive(
- ['LOCK TABLES `account` WRITE'],
- ['LOCK TABLES `contact` READ'],
- ['UNLOCK TABLES'],
- );
+ ->willReturnCallback(function ($sql) use ($invokedCount) {
+ if ($invokedCount->numberOfInvocations() === 1) {
+ $this->assertEquals('LOCK TABLES `account` WRITE', $sql);
+ }
+
+ if ($invokedCount->numberOfInvocations() === 2) {
+ $this->assertEquals('LOCK TABLES `contact` READ', $sql);
+ }
+
+ if ($invokedCount->numberOfInvocations() === 3) {
+ $this->assertEquals('UNLOCK TABLES', $sql);
+ }
+
+ return 1;
+ });
$this->locker->lockExclusive('Account');
$this->locker->lockShare('Contact');
@@ -80,14 +89,26 @@ class MysqlLockerTest extends \PHPUnit\Framework\TestCase
public function testLockRollback()
{
+ $invokedCount = $this->exactly(3);
+
$this->pdo
- ->expects($this->exactly(3))
+ ->expects($invokedCount)
->method('exec')
- ->withConsecutive(
- ['LOCK TABLES `account` WRITE'],
- ['LOCK TABLES `contact` READ'],
- ['UNLOCK TABLES'],
- );
+ ->willReturnCallback(function ($sql) use ($invokedCount) {
+ if ($invokedCount->numberOfInvocations() === 1) {
+ $this->assertEquals('LOCK TABLES `account` WRITE', $sql);
+ }
+
+ if ($invokedCount->numberOfInvocations() === 2) {
+ $this->assertEquals('LOCK TABLES `contact` READ', $sql);
+ }
+
+ if ($invokedCount->numberOfInvocations() === 3) {
+ $this->assertEquals('UNLOCK TABLES', $sql);
+ }
+
+ return 1;
+ });
$this->locker->lockExclusive('Account');
$this->locker->lockShare('Contact');
diff --git a/tests/unit/Espo/ORM/SqlExecutorTest.php b/tests/unit/Espo/ORM/SqlExecutorTest.php
index fe68c92a72..837a33bd22 100644
--- a/tests/unit/Espo/ORM/SqlExecutorTest.php
+++ b/tests/unit/Espo/ORM/SqlExecutorTest.php
@@ -35,9 +35,15 @@ use Espo\ORM\PDO\PDOProvider;
use PDO;
use PDOStatement;
use PDOException;
+use PHPUnit\Framework\TestCase;
+use RuntimeException;
-class SqlExecutorTest extends \PHPUnit\Framework\TestCase
+class SqlExecutorTest extends TestCase
{
+ private $pdo;
+ private $sth;
+ private $executor;
+
protected function setUp() : void
{
$this->pdo = $this->createMock(PDO::class);
@@ -60,7 +66,7 @@ class SqlExecutorTest extends \PHPUnit\Framework\TestCase
$this->pdo
->expects($this->once())
->method('query')
- ->will($this->returnValue($this->sth))
+ ->willReturn($this->sth)
->with($sql);
$sth = $this->executor->execute($sql);
@@ -123,9 +129,7 @@ class SqlExecutorTest extends \PHPUnit\Framework\TestCase
try {
$this->executor->execute($sql);
- } catch (PDOException $e) {
-
- }
+ } catch (PDOException) {}
}
public function testExecuteDeadlock2()
@@ -136,15 +140,22 @@ class SqlExecutorTest extends \PHPUnit\Framework\TestCase
$e->errorInfo = [40001, 1213];
+ $invokedCount = $this->exactly(2);
+
$this->pdo
- ->expects($this->exactly(2))
+ ->expects($invokedCount)
->method('query')
- ->will(
- $this->onConsecutiveCalls(
- $this->throwException($e),
- $this->returnValue($this->sth)
- )
- );
+ ->willReturnCallback(function () use ($invokedCount, $e) {
+ if ($invokedCount->numberOfInvocations() === 1) {
+ throw $e;
+ }
+
+ if ($invokedCount->numberOfInvocations() === 2) {
+ return $this->sth;
+ }
+
+ throw new RuntimeException();
+ });
$sth = $this->executor->execute($sql, true);
diff --git a/tests/unit/Espo/ORM/TransactionManagerTest.php b/tests/unit/Espo/ORM/TransactionManagerTest.php
index de826d4cc7..9126b45cd1 100644
--- a/tests/unit/Espo/ORM/TransactionManagerTest.php
+++ b/tests/unit/Espo/ORM/TransactionManagerTest.php
@@ -29,56 +29,50 @@
namespace tests\unit\Espo\ORM;
-use Espo\ORM\{
- TransactionManager,
- QueryComposer\MysqlQueryComposer,
-};
-
+use Espo\ORM\QueryComposer\MysqlQueryComposer;
+use Espo\ORM\TransactionManager;
use PDO;
+use PHPUnit\Framework\TestCase;
use RuntimeException;
-class TransactionManagerTest extends \PHPUnit\Framework\TestCase
+class TransactionManagerTest extends TestCase
{
+ private $pdo;
+ private $manager;
+
protected function setUp() : void
{
- $this->pdo = $this->getMockBuilder(PDO::class)->disableOriginalConstructor()->getMock();
+ $this->pdo = $this->createMock(PDO::class);
+ $composer = $this->createMock(MysqlQueryComposer::class);
- $this->composer = $this->getMockBuilder(MysqlQueryComposer::class)->disableOriginalConstructor()->getMock();
-
- $this->composer
+ $composer
->expects($this->any())
->method('composeCreateSavepoint')
- ->will(
- $this->returnCallback(
- function ($name) {
- return 'SAVEPOINT ' . $name;
- }
- )
+ ->willReturnCallback(
+ function ($name) {
+ return 'SAVEPOINT ' . $name;
+ }
);
- $this->composer
+ $composer
->expects($this->any())
->method('composeReleaseSavepoint')
- ->will(
- $this->returnCallback(
- function ($name) {
- return 'RELEASE SAVEPOINT ' . $name;
- }
- )
+ ->willReturnCallback(
+ function ($name) {
+ return 'RELEASE SAVEPOINT ' . $name;
+ }
);
- $this->composer
+ $composer
->expects($this->any())
->method('composeRollbackToSavepoint')
- ->will(
- $this->returnCallback(
- function ($name) {
- return 'ROLLBACK TO SAVEPOINT ' . $name;
- }
- )
+ ->willReturnCallback(
+ function ($name) {
+ return 'ROLLBACK TO SAVEPOINT ' . $name;
+ }
);
- $this->manager = new TransactionManager($this->pdo, $this->composer);
+ $this->manager = new TransactionManager($this->pdo, $composer);
}
public function testStartOnce()
@@ -96,15 +90,30 @@ class TransactionManagerTest extends \PHPUnit\Framework\TestCase
->expects($this->exactly(1))
->method('beginTransaction');
+ $invokedCount = $this->exactly(4);
+
$this->pdo
- ->expects($this->exactly(4))
+ ->expects($invokedCount)
->method('exec')
- ->withConsecutive(
- ['SAVEPOINT POINT_1'],
- ['SAVEPOINT POINT_2'],
- ['RELEASE SAVEPOINT POINT_2'],
- ['ROLLBACK TO SAVEPOINT POINT_1'],
- );
+ ->willReturnCallback(function ($sql) use ($invokedCount) {
+ if ($invokedCount->numberOfInvocations() === 1) {
+ $this->assertEquals('SAVEPOINT POINT_1', $sql);
+ }
+
+ if ($invokedCount->numberOfInvocations() === 2) {
+ $this->assertEquals('SAVEPOINT POINT_2', $sql);
+ }
+
+ if ($invokedCount->numberOfInvocations() === 3) {
+ $this->assertEquals('RELEASE SAVEPOINT POINT_2', $sql);
+ }
+
+ if ($invokedCount->numberOfInvocations() === 4) {
+ $this->assertEquals('ROLLBACK TO SAVEPOINT POINT_1', $sql);
+ }
+
+ return 1;
+ });
$this->pdo
->expects($this->exactly(1))
@@ -121,13 +130,22 @@ class TransactionManagerTest extends \PHPUnit\Framework\TestCase
public function testNestedRollback()
{
+ $invokedCount = $this->exactly(2);
+
$this->pdo
- ->expects($this->exactly(2))
+ ->expects($invokedCount)
->method('exec')
- ->withConsecutive(
- ['SAVEPOINT POINT_1'],
- ['ROLLBACK TO SAVEPOINT POINT_1'],
- );
+ ->willReturnCallback(function ($sql) use ($invokedCount) {
+ if ($invokedCount->numberOfInvocations() === 1) {
+ $this->assertEquals('SAVEPOINT POINT_1', $sql);
+ }
+
+ if ($invokedCount->numberOfInvocations() === 2) {
+ $this->assertEquals('ROLLBACK TO SAVEPOINT POINT_1', $sql);
+ }
+
+ return 1;
+ });
$this->pdo
->expects($this->once())
@@ -207,13 +225,22 @@ class TransactionManagerTest extends \PHPUnit\Framework\TestCase
->expects($this->once())
->method('beginTransaction');
+ $invokedCount = $this->exactly(2);
+
$this->pdo
- ->expects($this->exactly(2))
+ ->expects($invokedCount)
->method('exec')
- ->withConsecutive(
- ['SAVEPOINT POINT_1'],
- ['RELEASE SAVEPOINT POINT_1'],
- );
+ ->willReturnCallback(function ($sql) use ($invokedCount) {
+ if ($invokedCount->numberOfInvocations() === 1) {
+ $this->assertEquals('SAVEPOINT POINT_1', $sql);
+ }
+
+ if ($invokedCount->numberOfInvocations() === 2) {
+ $this->assertEquals('RELEASE SAVEPOINT POINT_1', $sql);
+ }
+
+ return 1;
+ });
$this->pdo
->expects($this->once())
diff --git a/tests/unit/Espo/Tools/FieldManagerTest.php b/tests/unit/Espo/Tools/FieldManagerTest.php
index df60aa3be9..910156cfc4 100644
--- a/tests/unit/Espo/Tools/FieldManagerTest.php
+++ b/tests/unit/Espo/Tools/FieldManagerTest.php
@@ -42,11 +42,16 @@ class FieldManagerTest extends TestCase
private ?FieldManager $fieldManager = null;
private ?NameUtil $nameUtil = null;
+ private $metadataHelper;
+ private $language;
+ protected $defaultLanguage;
+ protected $metadata;
+
protected function setUp() : void
{
$this->metadata = $this->createMock(Metadata::class);
$this->language = $this->createMock(Language::class);
- $this->baseLanguage = $this->createMock(Language::class);
+ $baseLanguage = $this->createMock(Language::class);
$this->defaultLanguage = $this->createMock(Language::class);
$this->metadataHelper = $this->createMock(Metadata\Helper::class);
$this->nameUtil = $this->createMock(NameUtil::class);
@@ -59,7 +64,7 @@ class FieldManagerTest extends TestCase
$this->createMock(InjectableFactory::class),
$this->metadata,
$this->language,
- $this->baseLanguage,
+ $baseLanguage,
$this->metadataHelper,
$this->nameUtil
);
@@ -113,22 +118,22 @@ class FieldManagerTest extends TestCase
$this->language
->expects($this->once())
->method('save')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->metadata
->expects($this->any())
->method('get')
- ->will($this->returnValueMap($map));
+ ->willReturnMap($map);
$this->metadata
->expects($this->exactly(2))
->method('getObjects')
- ->will($this->returnValue($existingData));
+ ->willReturn($existingData);
$this->metadataHelper
->expects($this->once())
->method('getFieldDefsByType')
- ->will($this->returnValue(json_decode('{
+ ->willReturn(json_decode('{
"params":[
{
"name":"required",
@@ -165,12 +170,12 @@ class FieldManagerTest extends TestCase
"personalData": true,
"textFilter": true,
"fullTextSearch": true
- }', true)));
+ }', true));
$this->metadata
->expects($this->exactly(2))
->method('getCustom')
- ->will($this->returnValue((object) []));
+ ->willReturn((object) []);
$this->fieldManager->update('Account', 'name', $data);
}
@@ -345,7 +350,7 @@ class FieldManagerTest extends TestCase
$this->metadata
->expects($this->exactly(2))
->method('getCustom')
- ->will($this->returnValue((object) []));
+ ->willReturn((object) []);
$this->fieldManager->update('CustomEntity', 'varName', $data);
}
diff --git a/tests/unit/Espo/Tools/WorkingTime/CalendarUtilityTest.php b/tests/unit/Espo/Tools/WorkingTime/CalendarUtilityTest.php
index 462c5cfffe..89ba6d8105 100644
--- a/tests/unit/Espo/Tools/WorkingTime/CalendarUtilityTest.php
+++ b/tests/unit/Espo/Tools/WorkingTime/CalendarUtilityTest.php
@@ -33,8 +33,10 @@ use Espo\Core\Field\DateTime;
use Espo\Tools\WorkingTime\Calendar;
use Espo\Tools\WorkingTime\CalendarUtility;
use Espo\Tools\WorkingTime\Extractor;
+use PHPUnit\Framework\TestCase;
+use RuntimeException;
-class CalendarUtilityTest extends \PHPUnit\Framework\TestCase
+class CalendarUtilityTest extends TestCase
{
protected Calendar $calendar;
protected Extractor $extractor;
@@ -149,34 +151,41 @@ class CalendarUtilityTest extends \PHPUnit\Framework\TestCase
public function testFindClosestWorkingTime1(): void
{
- $time = DateTime::fromString('2023-01-01 00:00:00');
+ $point = DateTime::fromString('2023-01-01 00:00:00');
+
+ $invokedCount = $this->exactly(2);
$this->extractor
- ->expects($this->exactly(2))
+ ->expects($invokedCount)
->method('extract')
- ->withConsecutive(
- [
- $this->calendar,
- $time,
- $time->modify('+10 days')
- ],
- [
- $this->calendar,
- $time->modify('+10 days'),
- $time->modify('+20 days'),
- ]
- )
- ->willReturnOnConsecutiveCalls(
- [],
- [
- [
- DateTime::fromString('2023-01-11 01:00:00'),
- DateTime::fromString('2023-01-11 02:00:00')
- ],
- ]
- );
+ ->willReturnCallback(function ($calendar, $a, $b) use ($invokedCount, $point) {
+ if ($invokedCount->numberOfInvocations() === 1) {
+ $this->assertEquals($this->calendar, $calendar);
+ $this->assertEquals($point, $a);
+ $this->assertEquals($point->modify('+10 days'), $b);
+
+ return [];
+ }
+
+ if ($invokedCount->numberOfInvocations() === 2) {
+ $this->assertEquals($this->calendar, $calendar);
+ $this->assertEquals($point->modify('+10 days'), $a);
+ $this->assertEquals($point->modify('+20 days'), $b);
+
+ return [
+ [
+ DateTime::fromString('2023-01-11 01:00:00'),
+ DateTime::fromString('2023-01-11 02:00:00')
+ ],
+ ];
+ }
+
+ throw new RuntimeException();
+ });
+
- $found = $this->calendarUtility->findClosestWorkingTime($time);
+
+ $found = $this->calendarUtility->findClosestWorkingTime($point);
$this->assertEquals(DateTime::fromString('2023-01-11 01:00:00'), $found);
}
@@ -201,30 +210,35 @@ class CalendarUtilityTest extends \PHPUnit\Framework\TestCase
$point = $time->withTime(0, 0, 0)->modify('+1 day');
+ $invokedCount = $this->exactly(2);
+
$this->extractor
- ->expects($this->exactly(2))
+ ->expects($invokedCount)
->method('extractAllDay')
- ->withConsecutive(
- [
- $this->calendar,
- $point,
- $point->modify('+30 days')
- ],
- [
- $this->calendar,
- $point->modify('+30 days'),
- $point->modify('+60 days'),
- ]
- )
- ->willReturnOnConsecutiveCalls(
- [],
- [
- [
- DateTime::fromString('2023-04-01 00:00:00'),
- DateTime::fromString('2023-04-01 00:00:00')
- ],
- ]
- );
+ ->willReturnCallback(function ($calendar, $a, $b) use ($invokedCount, $point) {
+ if ($invokedCount->numberOfInvocations() === 1) {
+ $this->assertEquals($this->calendar, $calendar);
+ $this->assertEquals($point, $a);
+ $this->assertEquals($point->modify('+30 days'), $b);
+
+ return [];
+ }
+
+ if ($invokedCount->numberOfInvocations() === 2) {
+ $this->assertEquals($this->calendar, $calendar);
+ $this->assertEquals($point->modify('+30 days'), $a);
+ $this->assertEquals($point->modify('+60 days'), $b);
+
+ return [
+ [
+ DateTime::fromString('2023-04-01 00:00:00'),
+ DateTime::fromString('2023-04-01 00:00:00')
+ ],
+ ];
+ }
+
+ throw new RuntimeException();
+ });
$found = $this->calendarUtility->addWorkingDays($time, 1);
@@ -237,28 +251,31 @@ class CalendarUtilityTest extends \PHPUnit\Framework\TestCase
$point = $time->withTime(0, 0, 0)->modify('+1 day');
+ $invokedCount = $this->exactly(1);
+
$this->extractor
- ->expects($this->exactly(1))
+ ->expects($invokedCount)
->method('extractAllDay')
- ->withConsecutive(
- [
- $this->calendar,
- $point,
- $point->modify('+30 days')
- ],
- )
- ->willReturnOnConsecutiveCalls(
- [
- [
- DateTime::fromString('2023-01-02 00:00:00'),
- DateTime::fromString('2023-01-03 00:00:00')
- ],
- [
- DateTime::fromString('2023-01-03 00:00:00'),
- DateTime::fromString('2023-01-04 00:00:00')
- ],
- ]
- );
+ ->willReturnCallback(function ($calendar, $a, $b) use ($invokedCount, $point) {
+ if ($invokedCount->numberOfInvocations() === 1) {
+ $this->assertEquals($this->calendar, $calendar);
+ $this->assertEquals($point, $a);
+ $this->assertEquals($point->modify('+30 days'), $b);
+
+ return [
+ [
+ DateTime::fromString('2023-01-02 00:00:00'),
+ DateTime::fromString('2023-01-03 00:00:00')
+ ],
+ [
+ DateTime::fromString('2023-01-03 00:00:00'),
+ DateTime::fromString('2023-01-04 00:00:00')
+ ],
+ ];
+ }
+
+ throw new RuntimeException();
+ });
$found = $this->calendarUtility->addWorkingDays($time, 2);