From 819e0584fda36de476349f2aaf4e39fd346884db Mon Sep 17 00:00:00 2001 From: Christer Edvartsen Date: Wed, 12 Apr 2023 20:13:51 +0200 Subject: [PATCH] Bump dependencies --- .github/workflows/ci.yml | 3 +- .gitignore | 4 +- composer.json | 3 +- composer.lock | 887 +++++++++++++++++++----------------- phpunit.xml.dist | 15 +- psalm.xml | 26 +- tests/AssetTest.php | 240 +++++----- tests/ErrorHandler.php | 42 ++ tests/FileTest.php | 227 ++++----- tests/FopenModeTest.php | 54 +-- tests/StreamWrapperTest.php | 308 ++++++------- 11 files changed, 917 insertions(+), 892 deletions(-) create mode 100644 tests/ErrorHandler.php diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6495b24..9c54b53 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,10 +2,9 @@ name: CI on: push jobs: ci: - runs-on: ${{ matrix.os }} + runs-on: ubuntu-22.04 strategy: matrix: - os: ['ubuntu-22.04'] php: ['8.1', '8.2'] name: Run CI build steps: diff --git a/.gitignore b/.gitignore index b9af3c2..565be89 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,5 @@ build vendor -.phpunit.result.cache +.phpunit.cache .vscode -test.php \ No newline at end of file +test.php diff --git a/composer.json b/composer.json index ca60c53..436da11 100644 --- a/composer.json +++ b/composer.json @@ -14,8 +14,9 @@ "php": ">=8.1" }, "require-dev": { - "phpunit/phpunit": "^9.4", + "phpunit/phpunit": "^10.0", "psalm/plugin-phpunit": "^0.18.4", + "symfony/var-dumper": "^6.2", "vimeo/psalm": "^5.5" }, "support": { diff --git a/composer.lock b/composer.lock index f3bf1ab..809d2d4 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": "96b03bfa23a370f8e96545abc317ace2", + "content-hash": "20614cc548f3a768777436f669bcf889", "packages": [], "packages-dev": [ { @@ -502,74 +502,47 @@ "time": "2019-12-04T15:06:13+00:00" }, { - "name": "doctrine/instantiator", - "version": "2.0.0", + "name": "doctrine/deprecations", + "version": "v1.0.0", "source": { "type": "git", - "url": "https://github.com/doctrine/instantiator.git", - "reference": "c6222283fa3f4ac679f8b9ced9a4e23f163e80d0" + "url": "https://github.com/doctrine/deprecations.git", + "reference": "0e2a4f1f8cdfc7a92ec3b01c9334898c806b30de" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/c6222283fa3f4ac679f8b9ced9a4e23f163e80d0", - "reference": "c6222283fa3f4ac679f8b9ced9a4e23f163e80d0", + "url": "https://api.github.com/repos/doctrine/deprecations/zipball/0e2a4f1f8cdfc7a92ec3b01c9334898c806b30de", + "reference": "0e2a4f1f8cdfc7a92ec3b01c9334898c806b30de", "shasum": "" }, "require": { - "php": "^8.1" + "php": "^7.1|^8.0" }, "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" + "doctrine/coding-standard": "^9", + "phpunit/phpunit": "^7.5|^8.5|^9.5", + "psr/log": "^1|^2|^3" + }, + "suggest": { + "psr/log": "Allows logging deprecations via PSR-3 logger implementation" }, "type": "library", "autoload": { "psr-4": { - "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/" + "Doctrine\\Deprecations\\": "lib/Doctrine/Deprecations" } }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], - "authors": [ - { - "name": "Marco Pivetta", - "email": "ocramius@gmail.com", - "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" - ], + "description": "A small layer on top of trigger_error(E_USER_DEPRECATED) or PSR-3 logging with options to disable all deprecations or selectively for packages.", + "homepage": "https://www.doctrine-project.org/", "support": { - "issues": "https://github.com/doctrine/instantiator/issues", - "source": "https://github.com/doctrine/instantiator/tree/2.0.0" + "issues": "https://github.com/doctrine/deprecations/issues", + "source": "https://github.com/doctrine/deprecations/tree/v1.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" + "time": "2022-05-02T15:47:09+00:00" }, { "name": "felixfbecker/advanced-json-rpc", @@ -674,16 +647,16 @@ }, { "name": "fidry/cpu-core-counter", - "version": "0.4.1", + "version": "0.5.1", "source": { "type": "git", "url": "https://github.com/theofidry/cpu-core-counter.git", - "reference": "79261cc280aded96d098e1b0e0ba0c4881b432c2" + "reference": "b58e5a3933e541dc286cc91fc4f3898bbc6f1623" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/theofidry/cpu-core-counter/zipball/79261cc280aded96d098e1b0e0ba0c4881b432c2", - "reference": "79261cc280aded96d098e1b0e0ba0c4881b432c2", + "url": "https://api.github.com/repos/theofidry/cpu-core-counter/zipball/b58e5a3933e541dc286cc91fc4f3898bbc6f1623", + "reference": "b58e5a3933e541dc286cc91fc4f3898bbc6f1623", "shasum": "" }, "require": { @@ -723,7 +696,7 @@ ], "support": { "issues": "https://github.com/theofidry/cpu-core-counter/issues", - "source": "https://github.com/theofidry/cpu-core-counter/tree/0.4.1" + "source": "https://github.com/theofidry/cpu-core-counter/tree/0.5.1" }, "funding": [ { @@ -731,20 +704,20 @@ "type": "github" } ], - "time": "2022-12-16T22:01:02+00:00" + "time": "2022-12-24T12:35:10+00:00" }, { "name": "myclabs/deep-copy", - "version": "1.11.0", + "version": "1.11.1", "source": { "type": "git", "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "14daed4296fae74d9e3201d2c4925d1acb7aa614" + "reference": "7284c22080590fb39f2ffa3e9057f10a4ddd0e0c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/14daed4296fae74d9e3201d2c4925d1acb7aa614", - "reference": "14daed4296fae74d9e3201d2c4925d1acb7aa614", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/7284c22080590fb39f2ffa3e9057f10a4ddd0e0c", + "reference": "7284c22080590fb39f2ffa3e9057f10a4ddd0e0c", "shasum": "" }, "require": { @@ -782,7 +755,7 @@ ], "support": { "issues": "https://github.com/myclabs/DeepCopy/issues", - "source": "https://github.com/myclabs/DeepCopy/tree/1.11.0" + "source": "https://github.com/myclabs/DeepCopy/tree/1.11.1" }, "funding": [ { @@ -790,20 +763,20 @@ "type": "tidelift" } ], - "time": "2022-03-03T13:19:32+00:00" + "time": "2023-03-08T13:26:56+00:00" }, { "name": "netresearch/jsonmapper", - "version": "v4.1.0", + "version": "v4.2.0", "source": { "type": "git", "url": "https://github.com/cweiske/jsonmapper.git", - "reference": "cfa81ea1d35294d64adb9c68aa4cb9e92400e53f" + "reference": "f60565f8c0566a31acf06884cdaa591867ecc956" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/cweiske/jsonmapper/zipball/cfa81ea1d35294d64adb9c68aa4cb9e92400e53f", - "reference": "cfa81ea1d35294d64adb9c68aa4cb9e92400e53f", + "url": "https://api.github.com/repos/cweiske/jsonmapper/zipball/f60565f8c0566a31acf06884cdaa591867ecc956", + "reference": "f60565f8c0566a31acf06884cdaa591867ecc956", "shasum": "" }, "require": { @@ -839,22 +812,22 @@ "support": { "email": "cweiske@cweiske.de", "issues": "https://github.com/cweiske/jsonmapper/issues", - "source": "https://github.com/cweiske/jsonmapper/tree/v4.1.0" + "source": "https://github.com/cweiske/jsonmapper/tree/v4.2.0" }, - "time": "2022-12-08T20:46:14+00:00" + "time": "2023-04-09T17:37:40+00:00" }, { "name": "nikic/php-parser", - "version": "v4.15.3", + "version": "v4.15.4", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "570e980a201d8ed0236b0a62ddf2c9cbb2034039" + "reference": "6bb5176bc4af8bcb7d926f88718db9b96a2d4290" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/570e980a201d8ed0236b0a62ddf2c9cbb2034039", - "reference": "570e980a201d8ed0236b0a62ddf2c9cbb2034039", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/6bb5176bc4af8bcb7d926f88718db9b96a2d4290", + "reference": "6bb5176bc4af8bcb7d926f88718db9b96a2d4290", "shasum": "" }, "require": { @@ -895,9 +868,9 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v4.15.3" + "source": "https://github.com/nikic/PHP-Parser/tree/v4.15.4" }, - "time": "2023-01-16T22:05:37+00:00" + "time": "2023-03-05T19:49:14+00:00" }, { "name": "phar-io/manifest", @@ -1122,24 +1095,27 @@ }, { "name": "phpdocumentor/type-resolver", - "version": "1.6.2", + "version": "1.7.1", "source": { "type": "git", "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "48f445a408c131e38cab1c235aa6d2bb7a0bb20d" + "reference": "dfc078e8af9c99210337325ff5aa152872c98714" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/48f445a408c131e38cab1c235aa6d2bb7a0bb20d", - "reference": "48f445a408c131e38cab1c235aa6d2bb7a0bb20d", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/dfc078e8af9c99210337325ff5aa152872c98714", + "reference": "dfc078e8af9c99210337325ff5aa152872c98714", "shasum": "" }, "require": { + "doctrine/deprecations": "^1.0", "php": "^7.4 || ^8.0", - "phpdocumentor/reflection-common": "^2.0" + "phpdocumentor/reflection-common": "^2.0", + "phpstan/phpdoc-parser": "^1.13" }, "require-dev": { "ext-tokenizer": "*", + "phpbench/phpbench": "^1.2", "phpstan/extension-installer": "^1.1", "phpstan/phpstan": "^1.8", "phpstan/phpstan-phpunit": "^1.1", @@ -1171,50 +1147,95 @@ "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names", "support": { "issues": "https://github.com/phpDocumentor/TypeResolver/issues", - "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.6.2" + "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.7.1" + }, + "time": "2023-03-27T19:02:04+00:00" + }, + { + "name": "phpstan/phpdoc-parser", + "version": "1.18.1", + "source": { + "type": "git", + "url": "https://github.com/phpstan/phpdoc-parser.git", + "reference": "22dcdfd725ddf99583bfe398fc624ad6c5004a0f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/22dcdfd725ddf99583bfe398fc624ad6c5004a0f", + "reference": "22dcdfd725ddf99583bfe398fc624ad6c5004a0f", + "shasum": "" + }, + "require": { + "php": "^7.2 || ^8.0" + }, + "require-dev": { + "php-parallel-lint/php-parallel-lint": "^1.2", + "phpstan/extension-installer": "^1.0", + "phpstan/phpstan": "^1.5", + "phpstan/phpstan-phpunit": "^1.1", + "phpstan/phpstan-strict-rules": "^1.0", + "phpunit/phpunit": "^9.5", + "symfony/process": "^5.2" + }, + "type": "library", + "autoload": { + "psr-4": { + "PHPStan\\PhpDocParser\\": [ + "src/" + ] + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "PHPDoc parser with support for nullable, intersection and generic types", + "support": { + "issues": "https://github.com/phpstan/phpdoc-parser/issues", + "source": "https://github.com/phpstan/phpdoc-parser/tree/1.18.1" }, - "time": "2022-10-14T12:47:21+00:00" + "time": "2023-04-07T11:51:11+00:00" }, { "name": "phpunit/php-code-coverage", - "version": "9.2.23", + "version": "10.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "9f1f0f9a2fbb680b26d1cf9b61b6eac43a6e4e9c" + "reference": "20800e84296ea4732f9a125e08ce86b4004ae3e4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/9f1f0f9a2fbb680b26d1cf9b61b6eac43a6e4e9c", - "reference": "9f1f0f9a2fbb680b26d1cf9b61b6eac43a6e4e9c", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/20800e84296ea4732f9a125e08ce86b4004ae3e4", + "reference": "20800e84296ea4732f9a125e08ce86b4004ae3e4", "shasum": "" }, "require": { "ext-dom": "*", "ext-libxml": "*", "ext-xmlwriter": "*", - "nikic/php-parser": "^4.14", - "php": ">=7.3", - "phpunit/php-file-iterator": "^3.0.3", - "phpunit/php-text-template": "^2.0.2", - "sebastian/code-unit-reverse-lookup": "^2.0.2", - "sebastian/complexity": "^2.0", - "sebastian/environment": "^5.1.2", - "sebastian/lines-of-code": "^1.0.3", - "sebastian/version": "^3.0.1", + "nikic/php-parser": "^4.15", + "php": ">=8.1", + "phpunit/php-file-iterator": "^4.0", + "phpunit/php-text-template": "^3.0", + "sebastian/code-unit-reverse-lookup": "^3.0", + "sebastian/complexity": "^3.0", + "sebastian/environment": "^6.0", + "sebastian/lines-of-code": "^2.0", + "sebastian/version": "^4.0", "theseer/tokenizer": "^1.2.0" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^10.0" }, "suggest": { - "ext-pcov": "*", - "ext-xdebug": "*" + "ext-pcov": "PHP extension that provides line coverage", + "ext-xdebug": "PHP extension that provides line coverage as well as branch and path coverage" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "9.2-dev" + "dev-main": "10.0-dev" } }, "autoload": { @@ -1242,7 +1263,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.23" + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/10.0.2" }, "funding": [ { @@ -1250,32 +1271,32 @@ "type": "github" } ], - "time": "2022-12-28T12:41:10+00:00" + "time": "2023-03-06T13:00:19+00:00" }, { "name": "phpunit/php-file-iterator", - "version": "3.0.6", + "version": "4.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf" + "reference": "fd9329ab3368f59fe1fe808a189c51086bd4b6bd" }, "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/fd9329ab3368f59fe1fe808a189c51086bd4b6bd", + "reference": "fd9329ab3368f59fe1fe808a189c51086bd4b6bd", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.1" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^10.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0-dev" + "dev-main": "4.0-dev" } }, "autoload": { @@ -1302,7 +1323,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-file-iterator/issues", - "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/3.0.6" + "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/4.0.1" }, "funding": [ { @@ -1310,28 +1331,28 @@ "type": "github" } ], - "time": "2021-12-02T12:48:52+00:00" + "time": "2023-02-10T16:53:14+00:00" }, { "name": "phpunit/php-invoker", - "version": "3.1.1", + "version": "4.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-invoker.git", - "reference": "5a10147d0aaf65b58940a0b72f71c9ac0423cc67" + "reference": "f5e568ba02fa5ba0ddd0f618391d5a9ea50b06d7" }, "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/f5e568ba02fa5ba0ddd0f618391d5a9ea50b06d7", + "reference": "f5e568ba02fa5ba0ddd0f618391d5a9ea50b06d7", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.1" }, "require-dev": { "ext-pcntl": "*", - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^10.0" }, "suggest": { "ext-pcntl": "*" @@ -1339,7 +1360,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.1-dev" + "dev-main": "4.0-dev" } }, "autoload": { @@ -1365,7 +1386,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-invoker/issues", - "source": "https://github.com/sebastianbergmann/php-invoker/tree/3.1.1" + "source": "https://github.com/sebastianbergmann/php-invoker/tree/4.0.0" }, "funding": [ { @@ -1373,32 +1394,32 @@ "type": "github" } ], - "time": "2020-09-28T05:58:55+00:00" + "time": "2023-02-03T06:56:09+00:00" }, { "name": "phpunit/php-text-template", - "version": "2.0.4", + "version": "3.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-text-template.git", - "reference": "5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28" + "reference": "9f3d3709577a527025f55bcf0f7ab8052c8bb37d" }, "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/9f3d3709577a527025f55bcf0f7ab8052c8bb37d", + "reference": "9f3d3709577a527025f55bcf0f7ab8052c8bb37d", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.1" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^10.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0-dev" + "dev-main": "3.0-dev" } }, "autoload": { @@ -1424,7 +1445,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-text-template/issues", - "source": "https://github.com/sebastianbergmann/php-text-template/tree/2.0.4" + "source": "https://github.com/sebastianbergmann/php-text-template/tree/3.0.0" }, "funding": [ { @@ -1432,32 +1453,32 @@ "type": "github" } ], - "time": "2020-10-26T05:33:50+00:00" + "time": "2023-02-03T06:56:46+00:00" }, { "name": "phpunit/php-timer", - "version": "5.0.3", + "version": "6.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-timer.git", - "reference": "5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2" + "reference": "e2a2d67966e740530f4a3343fe2e030ffdc1161d" }, "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/e2a2d67966e740530f4a3343fe2e030ffdc1161d", + "reference": "e2a2d67966e740530f4a3343fe2e030ffdc1161d", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.1" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^10.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "5.0-dev" + "dev-main": "6.0-dev" } }, "autoload": { @@ -1483,7 +1504,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-timer/issues", - "source": "https://github.com/sebastianbergmann/php-timer/tree/5.0.3" + "source": "https://github.com/sebastianbergmann/php-timer/tree/6.0.0" }, "funding": [ { @@ -1491,24 +1512,23 @@ "type": "github" } ], - "time": "2020-10-26T13:16:10+00:00" + "time": "2023-02-03T06:57:52+00:00" }, { "name": "phpunit/phpunit", - "version": "9.5.28", + "version": "10.0.19", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "954ca3113a03bf780d22f07bf055d883ee04b65e" + "reference": "20c23e85c86e5c06d63538ba464e8054f4744e62" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/954ca3113a03bf780d22f07bf055d883ee04b65e", - "reference": "954ca3113a03bf780d22f07bf055d883ee04b65e", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/20c23e85c86e5c06d63538ba464e8054f4744e62", + "reference": "20c23e85c86e5c06d63538ba464e8054f4744e62", "shasum": "" }, "require": { - "doctrine/instantiator": "^1.3.1 || ^2", "ext-dom": "*", "ext-json": "*", "ext-libxml": "*", @@ -1518,27 +1538,26 @@ "myclabs/deep-copy": "^1.10.1", "phar-io/manifest": "^2.0.3", "phar-io/version": "^3.0.2", - "php": ">=7.3", - "phpunit/php-code-coverage": "^9.2.13", - "phpunit/php-file-iterator": "^3.0.5", - "phpunit/php-invoker": "^3.1.1", - "phpunit/php-text-template": "^2.0.3", - "phpunit/php-timer": "^5.0.2", - "sebastian/cli-parser": "^1.0.1", - "sebastian/code-unit": "^1.0.6", - "sebastian/comparator": "^4.0.8", - "sebastian/diff": "^4.0.3", - "sebastian/environment": "^5.1.3", - "sebastian/exporter": "^4.0.5", - "sebastian/global-state": "^5.0.1", - "sebastian/object-enumerator": "^4.0.3", - "sebastian/resource-operations": "^3.0.3", - "sebastian/type": "^3.2", - "sebastian/version": "^3.0.2" + "php": ">=8.1", + "phpunit/php-code-coverage": "^10.0", + "phpunit/php-file-iterator": "^4.0", + "phpunit/php-invoker": "^4.0", + "phpunit/php-text-template": "^3.0", + "phpunit/php-timer": "^6.0", + "sebastian/cli-parser": "^2.0", + "sebastian/code-unit": "^2.0", + "sebastian/comparator": "^5.0", + "sebastian/diff": "^5.0", + "sebastian/environment": "^6.0", + "sebastian/exporter": "^5.0", + "sebastian/global-state": "^6.0", + "sebastian/object-enumerator": "^5.0", + "sebastian/recursion-context": "^5.0", + "sebastian/type": "^4.0", + "sebastian/version": "^4.0" }, "suggest": { - "ext-soap": "*", - "ext-xdebug": "*" + "ext-soap": "To be able to generate mocks based on WSDL files" }, "bin": [ "phpunit" @@ -1546,7 +1565,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "9.5-dev" + "dev-main": "10.0-dev" } }, "autoload": { @@ -1577,7 +1596,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", - "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.28" + "security": "https://github.com/sebastianbergmann/phpunit/security/policy", + "source": "https://github.com/sebastianbergmann/phpunit/tree/10.0.19" }, "funding": [ { @@ -1593,7 +1613,7 @@ "type": "tidelift" } ], - "time": "2023-01-14T12:32:24+00:00" + "time": "2023-03-27T11:46:33+00:00" }, { "name": "psalm/plugin-phpunit", @@ -1760,28 +1780,28 @@ }, { "name": "sebastian/cli-parser", - "version": "1.0.1", + "version": "2.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/cli-parser.git", - "reference": "442e7c7e687e42adc03470c7b668bc4b2402c0b2" + "reference": "efdc130dbbbb8ef0b545a994fd811725c5282cae" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/442e7c7e687e42adc03470c7b668bc4b2402c0b2", - "reference": "442e7c7e687e42adc03470c7b668bc4b2402c0b2", + "url": "https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/efdc130dbbbb8ef0b545a994fd811725c5282cae", + "reference": "efdc130dbbbb8ef0b545a994fd811725c5282cae", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.1" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^10.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0-dev" + "dev-main": "2.0-dev" } }, "autoload": { @@ -1804,7 +1824,7 @@ "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.1" + "source": "https://github.com/sebastianbergmann/cli-parser/tree/2.0.0" }, "funding": [ { @@ -1812,32 +1832,32 @@ "type": "github" } ], - "time": "2020-09-28T06:08:49+00:00" + "time": "2023-02-03T06:58:15+00:00" }, { "name": "sebastian/code-unit", - "version": "1.0.8", + "version": "2.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/code-unit.git", - "reference": "1fc9f64c0927627ef78ba436c9b17d967e68e120" + "reference": "a81fee9eef0b7a76af11d121767abc44c104e503" }, "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/a81fee9eef0b7a76af11d121767abc44c104e503", + "reference": "a81fee9eef0b7a76af11d121767abc44c104e503", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.1" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^10.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0-dev" + "dev-main": "2.0-dev" } }, "autoload": { @@ -1860,7 +1880,7 @@ "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" + "source": "https://github.com/sebastianbergmann/code-unit/tree/2.0.0" }, "funding": [ { @@ -1868,32 +1888,32 @@ "type": "github" } ], - "time": "2020-10-26T13:08:54+00:00" + "time": "2023-02-03T06:58:43+00:00" }, { "name": "sebastian/code-unit-reverse-lookup", - "version": "2.0.3", + "version": "3.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", - "reference": "ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5" + "reference": "5e3a687f7d8ae33fb362c5c0743794bbb2420a1d" }, "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/5e3a687f7d8ae33fb362c5c0743794bbb2420a1d", + "reference": "5e3a687f7d8ae33fb362c5c0743794bbb2420a1d", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.1" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^10.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0-dev" + "dev-main": "3.0-dev" } }, "autoload": { @@ -1915,7 +1935,7 @@ "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" + "source": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/tree/3.0.0" }, "funding": [ { @@ -1923,34 +1943,36 @@ "type": "github" } ], - "time": "2020-09-28T05:30:19+00:00" + "time": "2023-02-03T06:59:15+00:00" }, { "name": "sebastian/comparator", - "version": "4.0.8", + "version": "5.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "fa0f136dd2334583309d32b62544682ee972b51a" + "reference": "72f01e6586e0caf6af81297897bd112eb7e9627c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/fa0f136dd2334583309d32b62544682ee972b51a", - "reference": "fa0f136dd2334583309d32b62544682ee972b51a", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/72f01e6586e0caf6af81297897bd112eb7e9627c", + "reference": "72f01e6586e0caf6af81297897bd112eb7e9627c", "shasum": "" }, "require": { - "php": ">=7.3", - "sebastian/diff": "^4.0", - "sebastian/exporter": "^4.0" + "ext-dom": "*", + "ext-mbstring": "*", + "php": ">=8.1", + "sebastian/diff": "^5.0", + "sebastian/exporter": "^5.0" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^10.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.0-dev" + "dev-main": "5.0-dev" } }, "autoload": { @@ -1989,7 +2011,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/comparator/issues", - "source": "https://github.com/sebastianbergmann/comparator/tree/4.0.8" + "source": "https://github.com/sebastianbergmann/comparator/tree/5.0.0" }, "funding": [ { @@ -1997,33 +2019,33 @@ "type": "github" } ], - "time": "2022-09-14T12:41:17+00:00" + "time": "2023-02-03T07:07:16+00:00" }, { "name": "sebastian/complexity", - "version": "2.0.2", + "version": "3.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/complexity.git", - "reference": "739b35e53379900cc9ac327b2147867b8b6efd88" + "reference": "e67d240970c9dc7ea7b2123a6d520e334dd61dc6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/739b35e53379900cc9ac327b2147867b8b6efd88", - "reference": "739b35e53379900cc9ac327b2147867b8b6efd88", + "url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/e67d240970c9dc7ea7b2123a6d520e334dd61dc6", + "reference": "e67d240970c9dc7ea7b2123a6d520e334dd61dc6", "shasum": "" }, "require": { - "nikic/php-parser": "^4.7", - "php": ">=7.3" + "nikic/php-parser": "^4.10", + "php": ">=8.1" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^10.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0-dev" + "dev-main": "3.0-dev" } }, "autoload": { @@ -2046,7 +2068,7 @@ "homepage": "https://github.com/sebastianbergmann/complexity", "support": { "issues": "https://github.com/sebastianbergmann/complexity/issues", - "source": "https://github.com/sebastianbergmann/complexity/tree/2.0.2" + "source": "https://github.com/sebastianbergmann/complexity/tree/3.0.0" }, "funding": [ { @@ -2054,33 +2076,33 @@ "type": "github" } ], - "time": "2020-10-26T15:52:27+00:00" + "time": "2023-02-03T06:59:47+00:00" }, { "name": "sebastian/diff", - "version": "4.0.4", + "version": "5.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "3461e3fccc7cfdfc2720be910d3bd73c69be590d" + "reference": "aae9a0a43bff37bd5d8d0311426c87bf36153f02" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/3461e3fccc7cfdfc2720be910d3bd73c69be590d", - "reference": "3461e3fccc7cfdfc2720be910d3bd73c69be590d", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/aae9a0a43bff37bd5d8d0311426c87bf36153f02", + "reference": "aae9a0a43bff37bd5d8d0311426c87bf36153f02", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.1" }, "require-dev": { - "phpunit/phpunit": "^9.3", + "phpunit/phpunit": "^10.0", "symfony/process": "^4.2 || ^5" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.0-dev" + "dev-main": "5.0-dev" } }, "autoload": { @@ -2112,7 +2134,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/diff/issues", - "source": "https://github.com/sebastianbergmann/diff/tree/4.0.4" + "security": "https://github.com/sebastianbergmann/diff/security/policy", + "source": "https://github.com/sebastianbergmann/diff/tree/5.0.1" }, "funding": [ { @@ -2120,27 +2143,27 @@ "type": "github" } ], - "time": "2020-10-26T13:10:38+00:00" + "time": "2023-03-23T05:12:41+00:00" }, { "name": "sebastian/environment", - "version": "5.1.4", + "version": "6.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "1b5dff7bb151a4db11d49d90e5408e4e938270f7" + "reference": "43c751b41d74f96cbbd4e07b7aec9675651e2951" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/1b5dff7bb151a4db11d49d90e5408e4e938270f7", - "reference": "1b5dff7bb151a4db11d49d90e5408e4e938270f7", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/43c751b41d74f96cbbd4e07b7aec9675651e2951", + "reference": "43c751b41d74f96cbbd4e07b7aec9675651e2951", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.1" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^10.0" }, "suggest": { "ext-posix": "*" @@ -2148,7 +2171,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "5.1-dev" + "dev-main": "6.0-dev" } }, "autoload": { @@ -2167,7 +2190,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", @@ -2175,7 +2198,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/environment/issues", - "source": "https://github.com/sebastianbergmann/environment/tree/5.1.4" + "security": "https://github.com/sebastianbergmann/environment/security/policy", + "source": "https://github.com/sebastianbergmann/environment/tree/6.0.1" }, "funding": [ { @@ -2183,34 +2207,34 @@ "type": "github" } ], - "time": "2022-04-03T09:37:03+00:00" + "time": "2023-04-11T05:39:26+00:00" }, { "name": "sebastian/exporter", - "version": "4.0.5", + "version": "5.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "ac230ed27f0f98f597c8a2b6eb7ac563af5e5b9d" + "reference": "f3ec4bf931c0b31e5b413f5b4fc970a7d03338c0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/ac230ed27f0f98f597c8a2b6eb7ac563af5e5b9d", - "reference": "ac230ed27f0f98f597c8a2b6eb7ac563af5e5b9d", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/f3ec4bf931c0b31e5b413f5b4fc970a7d03338c0", + "reference": "f3ec4bf931c0b31e5b413f5b4fc970a7d03338c0", "shasum": "" }, "require": { - "php": ">=7.3", - "sebastian/recursion-context": "^4.0" + "ext-mbstring": "*", + "php": ">=8.1", + "sebastian/recursion-context": "^5.0" }, "require-dev": { - "ext-mbstring": "*", - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^10.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.0-dev" + "dev-main": "5.0-dev" } }, "autoload": { @@ -2252,7 +2276,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/exporter/issues", - "source": "https://github.com/sebastianbergmann/exporter/tree/4.0.5" + "source": "https://github.com/sebastianbergmann/exporter/tree/5.0.0" }, "funding": [ { @@ -2260,38 +2284,35 @@ "type": "github" } ], - "time": "2022-09-14T06:03:37+00:00" + "time": "2023-02-03T07:06:49+00:00" }, { "name": "sebastian/global-state", - "version": "5.0.5", + "version": "6.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "0ca8db5a5fc9c8646244e629625ac486fa286bf2" + "reference": "aab257c712de87b90194febd52e4d184551c2d44" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/0ca8db5a5fc9c8646244e629625ac486fa286bf2", - "reference": "0ca8db5a5fc9c8646244e629625ac486fa286bf2", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/aab257c712de87b90194febd52e4d184551c2d44", + "reference": "aab257c712de87b90194febd52e4d184551c2d44", "shasum": "" }, "require": { - "php": ">=7.3", - "sebastian/object-reflector": "^2.0", - "sebastian/recursion-context": "^4.0" + "php": ">=8.1", + "sebastian/object-reflector": "^3.0", + "sebastian/recursion-context": "^5.0" }, "require-dev": { "ext-dom": "*", - "phpunit/phpunit": "^9.3" - }, - "suggest": { - "ext-uopz": "*" + "phpunit/phpunit": "^10.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "5.0-dev" + "dev-main": "6.0-dev" } }, "autoload": { @@ -2316,7 +2337,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/global-state/issues", - "source": "https://github.com/sebastianbergmann/global-state/tree/5.0.5" + "source": "https://github.com/sebastianbergmann/global-state/tree/6.0.0" }, "funding": [ { @@ -2324,33 +2345,33 @@ "type": "github" } ], - "time": "2022-02-14T08:28:10+00:00" + "time": "2023-02-03T07:07:38+00:00" }, { "name": "sebastian/lines-of-code", - "version": "1.0.3", + "version": "2.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/lines-of-code.git", - "reference": "c1c2e997aa3146983ed888ad08b15470a2e22ecc" + "reference": "17c4d940ecafb3d15d2cf916f4108f664e28b130" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/c1c2e997aa3146983ed888ad08b15470a2e22ecc", - "reference": "c1c2e997aa3146983ed888ad08b15470a2e22ecc", + "url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/17c4d940ecafb3d15d2cf916f4108f664e28b130", + "reference": "17c4d940ecafb3d15d2cf916f4108f664e28b130", "shasum": "" }, "require": { - "nikic/php-parser": "^4.6", - "php": ">=7.3" + "nikic/php-parser": "^4.10", + "php": ">=8.1" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^10.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0-dev" + "dev-main": "2.0-dev" } }, "autoload": { @@ -2373,7 +2394,7 @@ "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.3" + "source": "https://github.com/sebastianbergmann/lines-of-code/tree/2.0.0" }, "funding": [ { @@ -2381,34 +2402,34 @@ "type": "github" } ], - "time": "2020-11-28T06:42:11+00:00" + "time": "2023-02-03T07:08:02+00:00" }, { "name": "sebastian/object-enumerator", - "version": "4.0.4", + "version": "5.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/object-enumerator.git", - "reference": "5c9eeac41b290a3712d88851518825ad78f45c71" + "reference": "202d0e344a580d7f7d04b3fafce6933e59dae906" }, "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/202d0e344a580d7f7d04b3fafce6933e59dae906", + "reference": "202d0e344a580d7f7d04b3fafce6933e59dae906", "shasum": "" }, "require": { - "php": ">=7.3", - "sebastian/object-reflector": "^2.0", - "sebastian/recursion-context": "^4.0" + "php": ">=8.1", + "sebastian/object-reflector": "^3.0", + "sebastian/recursion-context": "^5.0" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^10.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.0-dev" + "dev-main": "5.0-dev" } }, "autoload": { @@ -2430,7 +2451,7 @@ "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" + "source": "https://github.com/sebastianbergmann/object-enumerator/tree/5.0.0" }, "funding": [ { @@ -2438,32 +2459,32 @@ "type": "github" } ], - "time": "2020-10-26T13:12:34+00:00" + "time": "2023-02-03T07:08:32+00:00" }, { "name": "sebastian/object-reflector", - "version": "2.0.4", + "version": "3.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/object-reflector.git", - "reference": "b4f479ebdbf63ac605d183ece17d8d7fe49c15c7" + "reference": "24ed13d98130f0e7122df55d06c5c4942a577957" }, "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/24ed13d98130f0e7122df55d06c5c4942a577957", + "reference": "24ed13d98130f0e7122df55d06c5c4942a577957", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.1" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^10.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0-dev" + "dev-main": "3.0-dev" } }, "autoload": { @@ -2485,7 +2506,7 @@ "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" + "source": "https://github.com/sebastianbergmann/object-reflector/tree/3.0.0" }, "funding": [ { @@ -2493,32 +2514,32 @@ "type": "github" } ], - "time": "2020-10-26T13:14:26+00:00" + "time": "2023-02-03T07:06:18+00:00" }, { "name": "sebastian/recursion-context", - "version": "4.0.4", + "version": "5.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/recursion-context.git", - "reference": "cd9d8cf3c5804de4341c283ed787f099f5506172" + "reference": "05909fb5bc7df4c52992396d0116aed689f93712" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/cd9d8cf3c5804de4341c283ed787f099f5506172", - "reference": "cd9d8cf3c5804de4341c283ed787f099f5506172", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/05909fb5bc7df4c52992396d0116aed689f93712", + "reference": "05909fb5bc7df4c52992396d0116aed689f93712", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.1" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^10.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.0-dev" + "dev-main": "5.0-dev" } }, "autoload": { @@ -2545,10 +2566,10 @@ } ], "description": "Provides functionality to recursively process PHP variables", - "homepage": "http://www.github.com/sebastianbergmann/recursion-context", + "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.4" + "source": "https://github.com/sebastianbergmann/recursion-context/tree/5.0.0" }, "funding": [ { @@ -2556,87 +2577,32 @@ "type": "github" } ], - "time": "2020-10-26T13:17:30+00:00" - }, - { - "name": "sebastian/resource-operations", - "version": "3.0.3", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/resource-operations.git", - "reference": "0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8", - "reference": "0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8", - "shasum": "" - }, - "require": { - "php": ">=7.3" - }, - "require-dev": { - "phpunit/phpunit": "^9.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Provides a list of PHP built-in functions that operate on resources", - "homepage": "https://www.github.com/sebastianbergmann/resource-operations", - "support": { - "issues": "https://github.com/sebastianbergmann/resource-operations/issues", - "source": "https://github.com/sebastianbergmann/resource-operations/tree/3.0.3" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2020-09-28T06:45:17+00:00" + "time": "2023-02-03T07:05:40+00:00" }, { "name": "sebastian/type", - "version": "3.2.0", + "version": "4.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/type.git", - "reference": "fb3fe09c5f0bae6bc27ef3ce933a1e0ed9464b6e" + "reference": "462699a16464c3944eefc02ebdd77882bd3925bf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/fb3fe09c5f0bae6bc27ef3ce933a1e0ed9464b6e", - "reference": "fb3fe09c5f0bae6bc27ef3ce933a1e0ed9464b6e", + "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/462699a16464c3944eefc02ebdd77882bd3925bf", + "reference": "462699a16464c3944eefc02ebdd77882bd3925bf", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.1" }, "require-dev": { - "phpunit/phpunit": "^9.5" + "phpunit/phpunit": "^10.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.2-dev" + "dev-main": "4.0-dev" } }, "autoload": { @@ -2659,7 +2625,7 @@ "homepage": "https://github.com/sebastianbergmann/type", "support": { "issues": "https://github.com/sebastianbergmann/type/issues", - "source": "https://github.com/sebastianbergmann/type/tree/3.2.0" + "source": "https://github.com/sebastianbergmann/type/tree/4.0.0" }, "funding": [ { @@ -2667,29 +2633,29 @@ "type": "github" } ], - "time": "2022-09-12T14:47:03+00:00" + "time": "2023-02-03T07:10:45+00:00" }, { "name": "sebastian/version", - "version": "3.0.2", + "version": "4.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/version.git", - "reference": "c6c1022351a901512170118436c764e473f6de8c" + "reference": "c51fa83a5d8f43f1402e3f32a005e6262244ef17" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/c6c1022351a901512170118436c764e473f6de8c", - "reference": "c6c1022351a901512170118436c764e473f6de8c", + "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/c51fa83a5d8f43f1402e3f32a005e6262244ef17", + "reference": "c51fa83a5d8f43f1402e3f32a005e6262244ef17", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.1" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0-dev" + "dev-main": "4.0-dev" } }, "autoload": { @@ -2712,7 +2678,7 @@ "homepage": "https://github.com/sebastianbergmann/version", "support": { "issues": "https://github.com/sebastianbergmann/version/issues", - "source": "https://github.com/sebastianbergmann/version/tree/3.0.2" + "source": "https://github.com/sebastianbergmann/version/tree/4.0.1" }, "funding": [ { @@ -2720,30 +2686,29 @@ "type": "github" } ], - "time": "2020-09-28T06:39:44+00:00" + "time": "2023-02-07T11:34:05+00:00" }, { "name": "spatie/array-to-xml", - "version": "2.17.1", + "version": "3.1.5", "source": { "type": "git", "url": "https://github.com/spatie/array-to-xml.git", - "reference": "5cbec9c6ab17e320c58a259f0cebe88bde4a7c46" + "reference": "13f76acef5362d15c71ae1ac6350cc3df5e25e43" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/spatie/array-to-xml/zipball/5cbec9c6ab17e320c58a259f0cebe88bde4a7c46", - "reference": "5cbec9c6ab17e320c58a259f0cebe88bde4a7c46", + "url": "https://api.github.com/repos/spatie/array-to-xml/zipball/13f76acef5362d15c71ae1ac6350cc3df5e25e43", + "reference": "13f76acef5362d15c71ae1ac6350cc3df5e25e43", "shasum": "" }, "require": { "ext-dom": "*", - "php": "^7.4|^8.0" + "php": "^8.0" }, "require-dev": { "mockery/mockery": "^1.2", "pestphp/pest": "^1.21", - "phpunit/phpunit": "^9.0", "spatie/pest-plugin-snapshots": "^1.1" }, "type": "library", @@ -2772,7 +2737,7 @@ "xml" ], "support": { - "source": "https://github.com/spatie/array-to-xml/tree/2.17.1" + "source": "https://github.com/spatie/array-to-xml/tree/3.1.5" }, "funding": [ { @@ -2784,20 +2749,20 @@ "type": "github" } ], - "time": "2022-12-26T08:22:07+00:00" + "time": "2022-12-24T13:43:51+00:00" }, { "name": "symfony/console", - "version": "v6.2.3", + "version": "v6.2.8", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "0f579613e771dba2dbb8211c382342a641f5da06" + "reference": "3582d68a64a86ec25240aaa521ec8bc2342b369b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/0f579613e771dba2dbb8211c382342a641f5da06", - "reference": "0f579613e771dba2dbb8211c382342a641f5da06", + "url": "https://api.github.com/repos/symfony/console/zipball/3582d68a64a86ec25240aaa521ec8bc2342b369b", + "reference": "3582d68a64a86ec25240aaa521ec8bc2342b369b", "shasum": "" }, "require": { @@ -2859,12 +2824,12 @@ "homepage": "https://symfony.com", "keywords": [ "cli", - "command line", + "command-line", "console", "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v6.2.3" + "source": "https://github.com/symfony/console/tree/v6.2.8" }, "funding": [ { @@ -2880,20 +2845,20 @@ "type": "tidelift" } ], - "time": "2022-12-28T14:26:22+00:00" + "time": "2023-03-29T21:42:15+00:00" }, { "name": "symfony/deprecation-contracts", - "version": "v3.2.0", + "version": "v3.2.1", "source": { "type": "git", "url": "https://github.com/symfony/deprecation-contracts.git", - "reference": "1ee04c65529dea5d8744774d474e7cbd2f1206d3" + "reference": "e2d1534420bd723d0ef5aec58a22c5fe60ce6f5e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/1ee04c65529dea5d8744774d474e7cbd2f1206d3", - "reference": "1ee04c65529dea5d8744774d474e7cbd2f1206d3", + "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/e2d1534420bd723d0ef5aec58a22c5fe60ce6f5e", + "reference": "e2d1534420bd723d0ef5aec58a22c5fe60ce6f5e", "shasum": "" }, "require": { @@ -2931,7 +2896,7 @@ "description": "A generic function and convention to trigger deprecation notices", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/deprecation-contracts/tree/v3.2.0" + "source": "https://github.com/symfony/deprecation-contracts/tree/v3.2.1" }, "funding": [ { @@ -2947,20 +2912,20 @@ "type": "tidelift" } ], - "time": "2022-11-25T10:21:52+00:00" + "time": "2023-03-01T10:25:55+00:00" }, { "name": "symfony/filesystem", - "version": "v6.2.0", + "version": "v6.2.7", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "50b2523c874605cf3d4acf7a9e2b30b6a440a016" + "reference": "82b6c62b959f642d000456f08c6d219d749215b3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/50b2523c874605cf3d4acf7a9e2b30b6a440a016", - "reference": "50b2523c874605cf3d4acf7a9e2b30b6a440a016", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/82b6c62b959f642d000456f08c6d219d749215b3", + "reference": "82b6c62b959f642d000456f08c6d219d749215b3", "shasum": "" }, "require": { @@ -2994,7 +2959,7 @@ "description": "Provides basic utilities for the filesystem", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/filesystem/tree/v6.2.0" + "source": "https://github.com/symfony/filesystem/tree/v6.2.7" }, "funding": [ { @@ -3010,7 +2975,7 @@ "type": "tidelift" } ], - "time": "2022-11-20T13:01:27+00:00" + "time": "2023-02-14T08:44:56+00:00" }, { "name": "symfony/polyfill-ctype", @@ -3344,16 +3309,16 @@ }, { "name": "symfony/service-contracts", - "version": "v3.2.0", + "version": "v3.2.1", "source": { "type": "git", "url": "https://github.com/symfony/service-contracts.git", - "reference": "aac98028c69df04ee77eb69b96b86ee51fbf4b75" + "reference": "a8c9cedf55f314f3a186041d19537303766df09a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/service-contracts/zipball/aac98028c69df04ee77eb69b96b86ee51fbf4b75", - "reference": "aac98028c69df04ee77eb69b96b86ee51fbf4b75", + "url": "https://api.github.com/repos/symfony/service-contracts/zipball/a8c9cedf55f314f3a186041d19537303766df09a", + "reference": "a8c9cedf55f314f3a186041d19537303766df09a", "shasum": "" }, "require": { @@ -3409,7 +3374,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/service-contracts/tree/v3.2.0" + "source": "https://github.com/symfony/service-contracts/tree/v3.2.1" }, "funding": [ { @@ -3425,20 +3390,20 @@ "type": "tidelift" } ], - "time": "2022-11-25T10:21:52+00:00" + "time": "2023-03-01T10:32:47+00:00" }, { "name": "symfony/string", - "version": "v6.2.2", + "version": "v6.2.8", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "863219fd713fa41cbcd285a79723f94672faff4d" + "reference": "193e83bbd6617d6b2151c37fff10fa7168ebddef" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/863219fd713fa41cbcd285a79723f94672faff4d", - "reference": "863219fd713fa41cbcd285a79723f94672faff4d", + "url": "https://api.github.com/repos/symfony/string/zipball/193e83bbd6617d6b2151c37fff10fa7168ebddef", + "reference": "193e83bbd6617d6b2151c37fff10fa7168ebddef", "shasum": "" }, "require": { @@ -3495,7 +3460,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v6.2.2" + "source": "https://github.com/symfony/string/tree/v6.2.8" }, "funding": [ { @@ -3511,7 +3476,95 @@ "type": "tidelift" } ], - "time": "2022-12-14T16:11:27+00:00" + "time": "2023-03-20T16:06:02+00:00" + }, + { + "name": "symfony/var-dumper", + "version": "v6.2.8", + "source": { + "type": "git", + "url": "https://github.com/symfony/var-dumper.git", + "reference": "d37ab6787be2db993747b6218fcc96e8e3bb4bd0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/var-dumper/zipball/d37ab6787be2db993747b6218fcc96e8e3bb4bd0", + "reference": "d37ab6787be2db993747b6218fcc96e8e3bb4bd0", + "shasum": "" + }, + "require": { + "php": ">=8.1", + "symfony/polyfill-mbstring": "~1.0" + }, + "conflict": { + "phpunit/phpunit": "<5.4.3", + "symfony/console": "<5.4" + }, + "require-dev": { + "ext-iconv": "*", + "symfony/console": "^5.4|^6.0", + "symfony/process": "^5.4|^6.0", + "symfony/uid": "^5.4|^6.0", + "twig/twig": "^2.13|^3.0.4" + }, + "suggest": { + "ext-iconv": "To convert non-UTF-8 strings to UTF-8 (or symfony/polyfill-iconv in case ext-iconv cannot be used).", + "ext-intl": "To show region name in time zone dump", + "symfony/console": "To use the ServerDumpCommand and/or the bin/var-dump-server script" + }, + "bin": [ + "Resources/bin/var-dump-server" + ], + "type": "library", + "autoload": { + "files": [ + "Resources/functions/dump.php" + ], + "psr-4": { + "Symfony\\Component\\VarDumper\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Provides mechanisms for walking through any arbitrary PHP variable", + "homepage": "https://symfony.com", + "keywords": [ + "debug", + "dump" + ], + "support": { + "source": "https://github.com/symfony/var-dumper/tree/v6.2.8" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2023-03-29T21:42:15+00:00" }, { "name": "theseer/tokenizer", @@ -3565,22 +3618,22 @@ }, { "name": "vimeo/psalm", - "version": "5.5.0", + "version": "5.9.0", "source": { "type": "git", "url": "https://github.com/vimeo/psalm.git", - "reference": "b63061a27f2683ec0f3509012bb22daab3b65b61" + "reference": "8b9ad1eb9e8b7d3101f949291da2b9f7767cd163" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/vimeo/psalm/zipball/b63061a27f2683ec0f3509012bb22daab3b65b61", - "reference": "b63061a27f2683ec0f3509012bb22daab3b65b61", + "url": "https://api.github.com/repos/vimeo/psalm/zipball/8b9ad1eb9e8b7d3101f949291da2b9f7767cd163", + "reference": "8b9ad1eb9e8b7d3101f949291da2b9f7767cd163", "shasum": "" }, "require": { "amphp/amp": "^2.4.2", "amphp/byte-stream": "^1.5", - "composer/package-versions-deprecated": "^1.10.0", + "composer-runtime-api": "^2", "composer/semver": "^1.4 || ^2.0 || ^3.0", "composer/xdebug-handler": "^2.0 || ^3.0", "dnoegel/php-xdg-base-dir": "^0.1.1", @@ -3593,12 +3646,12 @@ "ext-tokenizer": "*", "felixfbecker/advanced-json-rpc": "^3.1", "felixfbecker/language-server-protocol": "^1.5.2", - "fidry/cpu-core-counter": "^0.4.0", + "fidry/cpu-core-counter": "^0.4.1 || ^0.5.1", "netresearch/jsonmapper": "^1.0 || ^2.0 || ^3.0 || ^4.0", - "nikic/php-parser": "^4.13", + "nikic/php-parser": "^4.14", "php": "^7.4 || ~8.0.0 || ~8.1.0 || ~8.2.0", "sebastian/diff": "^4.0 || ^5.0", - "spatie/array-to-xml": "^2.17.0", + "spatie/array-to-xml": "^2.17.0 || ^3.0", "symfony/console": "^4.1.6 || ^5.0 || ^6.0", "symfony/filesystem": "^5.4 || ^6.0" }, @@ -3606,14 +3659,15 @@ "psalm/psalm": "self.version" }, "require-dev": { + "amphp/phpunit-util": "^2.0", "bamarni/composer-bin-plugin": "^1.4", - "brianium/paratest": "^6.0", + "brianium/paratest": "^6.9", "ext-curl": "*", "mockery/mockery": "^1.5", "nunomaduro/mock-final-classes": "^1.1", "php-parallel-lint/php-parallel-lint": "^1.2", "phpstan/phpdoc-parser": "^1.6", - "phpunit/phpunit": "^9.5", + "phpunit/phpunit": "^9.6", "psalm/plugin-mockery": "^1.1", "psalm/plugin-phpunit": "^0.18", "slevomat/coding-standard": "^8.4", @@ -3659,13 +3713,14 @@ "keywords": [ "code", "inspection", - "php" + "php", + "static analysis" ], "support": { "issues": "https://github.com/vimeo/psalm/issues", - "source": "https://github.com/vimeo/psalm/tree/5.5.0" + "source": "https://github.com/vimeo/psalm/tree/5.9.0" }, - "time": "2023-01-23T01:50:35+00:00" + "time": "2023-03-29T21:38:21+00:00" }, { "name": "webmozart/assert", diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 2d6fe24..8152636 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,16 +1,6 @@ - - + + src @@ -18,7 +8,6 @@ src/functions.php - tests diff --git a/psalm.xml b/psalm.xml index 79f294d..fce98ab 100644 --- a/psalm.xml +++ b/psalm.xml @@ -6,11 +6,12 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="https://getpsalm.org/schema/config" xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd" + findUnusedCode="false" + findUnusedBaselineEntry="true" > - @@ -19,32 +20,15 @@ - - - - - - - - - - - - - - - - - - - - + + + diff --git a/tests/AssetTest.php b/tests/AssetTest.php index 74fdd92..b32dd92 100644 --- a/tests/AssetTest.php +++ b/tests/AssetTest.php @@ -84,22 +84,6 @@ public function testCanSetAndGetName() : void { $this->assertSame('newname', $asset->getName(), 'Incorrect name'); } - /** - * @return array> - */ - public function getInvalidAssetNames() : array { - return [ - 'empty name' => [ - 'name' => ' ', - 'exceptionMessage' => 'Name can not be empty', - ], - 'dir separators' => [ - 'name' => 'foo/bar', - 'exceptionMessage' => 'Name can not contain a directory separator', - ], - ]; - } - /** * @dataProvider getInvalidAssetNames * @covers ::setName @@ -262,9 +246,122 @@ public function testSetExistingParentReturnsEarly() : void { } /** - * @return array> + * @dataProvider getAccessCheckDataForReadable + * @covers ::isReadable + */ + public function testCanCheckIfAssetIsReadable(int $ownerUid, int $ownerGid, int $mode, int $checkUid, int $checkGid, bool $expectedResult) : void { + $file = new File('filename'); + $file->setUid($ownerUid); + $file->setGid($ownerGid); + $file->setMode($mode); + + $this->assertSame($expectedResult, $file->isReadable($checkUid, $checkGid), 'Wrong result for isReadable'); + } + + /** + * @covers ::isReadable + */ + public function testAssetIsNotReadableWhenParentIsNotReadable() : void { + $dir = new Directory('dir'); + $dir->setUid(1); + $dir->setGid(1); + $dir->setMode(0770); + + $file = new File('file'); + $file->setUid(2); + $file->setGid(2); + $file->setMode(0777); + $file->setParent($dir); + + $this->assertTrue($file->isReadable(1, 1), 'Expected user to be able to read file'); + $this->assertFalse($file->isReadable(2, 2), 'Did not expect user to be able to read'); + } + + /** + * @dataProvider getAccessCheckDataForWritable + * @covers ::isWritable + */ + public function testCanCheckIfAssetIsWritable(int $ownerUid, int $ownerGid, int $mode, int $checkUid, int $checkGid, bool $expectedResult) : void { + $file = new File('filename'); + $file->setUid($ownerUid); + $file->setGid($ownerGid); + $file->setMode($mode); + + $this->assertSame($expectedResult, $file->isWritable($checkUid, $checkGid), 'Wrong result for isWritable'); + } + + /** + * @dataProvider getAccessCheckDataForExecutable + * @covers ::isExecutable + */ + public function testCanCheckIfAssetIsExecutable(int $ownerUid, int $ownerGid, int $mode, int $checkUid, int $checkGid, bool $expectedResult) : void { + $file = new File('filename'); + $file->setUid($ownerUid); + $file->setGid($ownerGid); + $file->setMode($mode); + + $this->assertSame($expectedResult, $file->isExecutable($checkUid, $checkGid), 'Wrong result for isExecutable'); + } + + /** + * @covers ::isOwnedByUser + */ + public function testCanCheckIfAssetIsOwnedByUser() : void { + $asset = new File('filename'); + $this->assertTrue($asset->isOwnedByUser(0), 'Expected UID 0 to own the asset'); + $asset->setUid(1); + $this->assertFalse($asset->isOwnedByUser(0), 'Did not expect UID 0 to own the asset'); + $this->assertTrue($asset->isOwnedByUser(1), 'Expected UID 1 to own the asset'); + } + + /** + * @covers ::getDevice + * @covers TestFs\Device::getDevice + */ + public function testCanGetDevice() : void { + $file = new File('name'); + $dir = new Directory('name'); + $device = new Device('some name'); + $dir->addChild($file); + $device->addChild($dir); + + $this->assertSame($device, $file->getDevice(), 'Incorrect instance returned'); + $this->assertSame($device, $dir->getDevice(), 'Incorrect instance returned'); + $this->assertSame($device, $device->getDevice(), 'Incorrect instance returned'); + } + + /** + * @covers ::getDevice + */ + public function testReturnNullIfThereIsNoDevice() : void { + $file = new File('name'); + $dir = new Directory('name'); + $dir->addChild($file); + + $this->assertNull($file->getDevice(), 'Did not expect any device'); + $this->assertNull($dir->getDevice(), 'Did not expect any device'); + } + + /** + * @return array */ - public function getAccessCheckDataForReadable() : array { + public static function getInvalidAssetNames() : array { + return [ + 'empty name' => [ + 'name' => ' ', + 'exceptionMessage' => 'Name can not be empty', + ], + 'dir separators' => [ + 'name' => 'foo/bar', + 'exceptionMessage' => 'Name can not contain a directory separator', + ], + ]; + } + + /** + * @return array + */ + public static function getAccessCheckDataForReadable() : array { return [ 'root user' => [ 'ownerUid' => 1, @@ -318,41 +415,9 @@ public function getAccessCheckDataForReadable() : array { } /** - * @dataProvider getAccessCheckDataForReadable - * @covers ::isReadable - */ - public function testCanCheckIfAssetIsReadable(int $ownerUid, int $ownerGid, int $mode, int $checkUid, int $checkGid, bool $expectedResult) : void { - $file = new File('filename'); - $file->setUid($ownerUid); - $file->setGid($ownerGid); - $file->setMode($mode); - - $this->assertSame($expectedResult, $file->isReadable($checkUid, $checkGid), 'Wrong result for isReadable'); - } - - /** - * @covers ::isReadable - */ - public function testAssetIsNotReadableWhenParentIsNotReadable() : void { - $dir = new Directory('dir'); - $dir->setUid(1); - $dir->setGid(1); - $dir->setMode(0770); - - $file = new File('file'); - $file->setUid(2); - $file->setGid(2); - $file->setMode(0777); - $file->setParent($dir); - - $this->assertTrue($file->isReadable(1, 1), 'Expected user to be able to read file'); - $this->assertFalse($file->isReadable(2, 2), 'Did not expect user to be able to read'); - } - - /** - * @return array> + * @return array */ - public function getAccessCheckDataForWritable() : array { + public static function getAccessCheckDataForWritable() : array { return [ 'root user' => [ 'ownerUid' => 1, @@ -406,22 +471,9 @@ public function getAccessCheckDataForWritable() : array { } /** - * @dataProvider getAccessCheckDataForWritable - * @covers ::isWritable + * @return array */ - public function testCanCheckIfAssetIsWritable(int $ownerUid, int $ownerGid, int $mode, int $checkUid, int $checkGid, bool $expectedResult) : void { - $file = new File('filename'); - $file->setUid($ownerUid); - $file->setGid($ownerGid); - $file->setMode($mode); - - $this->assertSame($expectedResult, $file->isWritable($checkUid, $checkGid), 'Wrong result for isWritable'); - } - - /** - * @return array> - */ - public function getAccessCheckDataForExecutable() : array { + public static function getAccessCheckDataForExecutable() : array { return [ 'root user' => [ 'ownerUid' => 1, @@ -473,56 +525,4 @@ public function getAccessCheckDataForExecutable() : array { ], ]; } - - /** - * @dataProvider getAccessCheckDataForExecutable - * @covers ::isExecutable - */ - public function testCanCheckIfAssetIsExecutable(int $ownerUid, int $ownerGid, int $mode, int $checkUid, int $checkGid, bool $expectedResult) : void { - $file = new File('filename'); - $file->setUid($ownerUid); - $file->setGid($ownerGid); - $file->setMode($mode); - - $this->assertSame($expectedResult, $file->isExecutable($checkUid, $checkGid), 'Wrong result for isExecutable'); - } - - /** - * @covers ::isOwnedByUser - */ - public function testCanCheckIfAssetIsOwnedByUser() : void { - $asset = new File('filename'); - $this->assertTrue($asset->isOwnedByUser(0), 'Expected UID 0 to own the asset'); - $asset->setUid(1); - $this->assertFalse($asset->isOwnedByUser(0), 'Did not expect UID 0 to own the asset'); - $this->assertTrue($asset->isOwnedByUser(1), 'Expected UID 1 to own the asset'); - } - - /** - * @covers ::getDevice - * @covers TestFs\Device::getDevice - */ - public function testCanGetDevice() : void { - $file = new File('name'); - $dir = new Directory('name'); - $device = new Device('some name'); - $dir->addChild($file); - $device->addChild($dir); - - $this->assertSame($device, $file->getDevice(), 'Incorrect instance returned'); - $this->assertSame($device, $dir->getDevice(), 'Incorrect instance returned'); - $this->assertSame($device, $device->getDevice(), 'Incorrect instance returned'); - } - - /** - * @covers ::getDevice - */ - public function testReturnNullIfThereIsNoDevice() : void { - $file = new File('name'); - $dir = new Directory('name'); - $dir->addChild($file); - - $this->assertNull($file->getDevice(), 'Did not expect any device'); - $this->assertNull($dir->getDevice(), 'Did not expect any device'); - } -} \ No newline at end of file +} diff --git a/tests/ErrorHandler.php b/tests/ErrorHandler.php new file mode 100644 index 0000000..541ae95 --- /dev/null +++ b/tests/ErrorHandler.php @@ -0,0 +1,42 @@ +assertSame(0100000, (new File('name'))->getType(), 'Incorrect file type'); } - /** - * @return array> - */ - public function getFileContent() : array { - return [ - ['some content', 12], - ['', 0], - ]; - } - /** * @dataProvider getFileContent * @covers ::getSize @@ -32,26 +24,6 @@ public function testCanCalculateSize(string $content, int $expectedSize) : void $this->assertSame($expectedSize, (new File('name', $content))->getSize(), 'Incorrect size'); } - /** - * @return array> - */ - public function getContentForReading() : array { - return [ - 'empty file' => [ - 'content' => '', - 'bytes' => 10, - 'expectedOutput' => '', - 'expectedOffset' => 0 - ], - 'file with contents' => [ - 'content' => 'this is some data', - 'bytes' => 7, - 'expectedOutput' => 'this is', - 'expectedOffset' => 7 - ] - ]; - } - /** * @dataProvider getContentForReading * @covers ::read @@ -73,26 +45,6 @@ public function testCanCheckForEof() : void { $this->assertTrue($file->eof(), 'Expected EOF'); } - /** - * @return array> - */ - public function getContentForWriting() : array { - return [ - 'empty string' => [ - 'existingContent' => 'existing content', - 'newDataLength' => 0, - 'newData' => '', - 'newContent' => 'existing content', - ], - 'write some data' => [ - 'existingContent' => 'exsiting content', - 'newDataLength' => 9, - 'newData' => 'some data', - 'newContent' => 'some datacontent', - ], - ]; - } - /** * @dataProvider getContentForWriting * @covers ::write @@ -107,34 +59,6 @@ public function testCanWriteData(string $existingContent, int $newDataLength, st $this->assertSame($newContent, $file->getContent(), 'Incorrect content after writing'); } - /** - * @return array> - */ - public function getDataForTruncate() : array { - return [ - 'truncate empty file' => [ - 'existingContent' => '', - 'size' => 0, - 'expectedContent' => '', - ], - 'truncate file with contents' => [ - 'existingContent' => 'existing content', - 'size' => 0, - 'expectedContent' => '', - ], - 'truncate to larger size' => [ - 'existingContent' => 'content', - 'size' => 10, - 'expectedContent' => "content\0\0\0", - ], - 'truncate to smaller size and rewind' => [ - 'existingContent' => 'content', - 'size' => 4, - 'expectedContent' => 'cont', - ], - ]; - } - /** * @dataProvider getDataForTruncate * @covers ::truncate @@ -146,35 +70,6 @@ public function testCanTruncateFile(string $existingContent, int $size, string $ $this->assertSame(0, $file->getOffset(), 'Offset is not supposed to be changed'); } - /** - * @return array> - */ - public function getDataForSeek() : array { - return [ - 'set' => [ - 'content' => 'file content', - 'seek' => 5, - 'whence' => SEEK_SET, - 'expectedOffset' => 5, - 'expectedContent' => 'file content', - ], - 'cur' => [ - 'content' => 'file content', - 'seek' => 3, - 'whence' => SEEK_CUR, - 'expectedOffset' => 3, - 'expectedContent' => 'file content', - ], - 'end' => [ - 'content' => 'file content', - 'seek' => 3, - 'whence' => SEEK_END, - 'expectedOffset' => 15, - 'expectedContent' => "file content\0\0\0", - ], - ]; - } - /** * @dataProvider getDataForSeek * @covers ::seek @@ -358,11 +253,123 @@ public function testTruncateDataWhenThereIsNotEnoughSpaceOnDevice() : void { $device->setDeviceSize(7); $device->addChild($file); - @$file->write('some data'); + $this->ignoreError(fn () => $file->write('some data')); $this->assertSame('some da', $file->getContent()); - $this->expectNotice(); - $this->expectNoticeMessage('fwrite(): write failed, no space left on device'); + $this->expectExceptionObject(new Notice('fwrite(): write failed, no space left on device')); $file->write('some data'); } + + /** + * @return array + */ + public static function getFileContent() : array { + return [ + 'content' => [ + 'content' => 'some content', + 'expectedSize' => 12, + ], + 'no content' => [ + 'content' => '', + 'expectedSize' => 0, + ], + ]; + } + + /** + * @return array + */ + public static function getContentForReading() : array { + return [ + 'empty file' => [ + 'content' => '', + 'bytes' => 10, + 'expectedOutput' => '', + 'expectedOffset' => 0 + ], + 'file with contents' => [ + 'content' => 'this is some data', + 'bytes' => 7, + 'expectedOutput' => 'this is', + 'expectedOffset' => 7 + ] + ]; + } + + /** + * @return array + */ + public static function getContentForWriting() : array { + return [ + 'empty string' => [ + 'existingContent' => 'existing content', + 'newDataLength' => 0, + 'newData' => '', + 'newContent' => 'existing content', + ], + 'write some data' => [ + 'existingContent' => 'exsiting content', + 'newDataLength' => 9, + 'newData' => 'some data', + 'newContent' => 'some datacontent', + ], + ]; + } + + /** + * @return array + */ + public static function getDataForTruncate() : array { + return [ + 'truncate empty file' => [ + 'existingContent' => '', + 'size' => 0, + 'expectedContent' => '', + ], + 'truncate file with contents' => [ + 'existingContent' => 'existing content', + 'size' => 0, + 'expectedContent' => '', + ], + 'truncate to larger size' => [ + 'existingContent' => 'content', + 'size' => 10, + 'expectedContent' => "content\0\0\0", + ], + 'truncate to smaller size and rewind' => [ + 'existingContent' => 'content', + 'size' => 4, + 'expectedContent' => 'cont', + ], + ]; + } + + /** + * @return array + */ + public static function getDataForSeek() : array { + return [ + 'set' => [ + 'content' => 'file content', + 'seek' => 5, + 'whence' => SEEK_SET, + 'expectedOffset' => 5, + 'expectedContent' => 'file content', + ], + 'cur' => [ + 'content' => 'file content', + 'seek' => 3, + 'whence' => SEEK_CUR, + 'expectedOffset' => 3, + 'expectedContent' => 'file content', + ], + 'end' => [ + 'content' => 'file content', + 'seek' => 3, + 'whence' => SEEK_END, + 'expectedOffset' => 15, + 'expectedContent' => "file content\0\0\0", + ], + ]; + } } diff --git a/tests/FopenModeTest.php b/tests/FopenModeTest.php index 4dda075..0027359 100644 --- a/tests/FopenModeTest.php +++ b/tests/FopenModeTest.php @@ -8,11 +8,34 @@ */ class FopenModeTest extends TestCase { /** - * @return array> + * @covers ::__construct + * @covers ::read + * @covers ::write + * @covers ::create + * @covers ::truncate + * @covers ::offset + * @covers ::binary + * @covers ::text + * @dataProvider getModeData + */ + public function testCorrectlyCreatesInstance(string $mode, bool $extended, ?string $extra, bool $expectedRead, bool $expectedWrite, int $expectedOffset, bool $expectedTruncate, bool $expectedCreate, bool $expectedBinary, bool $expectedText) : void { + $mode = new FopenMode($mode, $extended, $extra); + + $this->assertSame($expectedRead, $mode->read(), 'Incorrect read value'); + $this->assertSame($expectedWrite, $mode->write(), 'Incorrect write value'); + $this->assertSame($expectedCreate, $mode->create(), 'Incorrect create value'); + $this->assertSame($expectedTruncate, $mode->truncate(), 'Incorrect truncate value'); + $this->assertSame($expectedOffset, $mode->offset(), 'Incorrect offset value'); + $this->assertSame($expectedBinary, $mode->binary(), 'Incorrect binary value'); + $this->assertSame($expectedText, $mode->text(), 'Incorrect text value'); + } + + /** + * @return array */ - public function getModeData() : array { + public static function getModeData() : array { return [ - [ + 'read' => [ 'mode' => 'r', 'extended' => true, 'extra' => null, @@ -24,7 +47,7 @@ public function getModeData() : array { 'expectedBinary' => false, 'expectedText' => false ], - [ + 'write' => [ 'mode' => 'w', 'extended' => false, 'extra' => null, @@ -38,27 +61,4 @@ public function getModeData() : array { ], ]; } - - /** - * @covers ::__construct - * @covers ::read - * @covers ::write - * @covers ::create - * @covers ::truncate - * @covers ::offset - * @covers ::binary - * @covers ::text - * @dataProvider getModeData - */ - public function testCorrectlyCreatesInstance(string $mode, bool $extended, ?string $extra, bool $expectedRead, bool $expectedWrite, int $expectedOffset, bool $expectedTruncate, bool $expectedCreate, bool $expectedBinary, bool $expectedText) : void { - $mode = new FopenMode($mode, $extended, $extra); - - $this->assertSame($expectedRead, $mode->read(), 'Incorrect read value'); - $this->assertSame($expectedWrite, $mode->write(), 'Incorrect write value'); - $this->assertSame($expectedCreate, $mode->create(), 'Incorrect create value'); - $this->assertSame($expectedTruncate, $mode->truncate(), 'Incorrect truncate value'); - $this->assertSame($expectedOffset, $mode->offset(), 'Incorrect offset value'); - $this->assertSame($expectedBinary, $mode->binary(), 'Incorrect binary value'); - $this->assertSame($expectedText, $mode->text(), 'Incorrect text value'); - } } diff --git a/tests/StreamWrapperTest.php b/tests/StreamWrapperTest.php index 6ebdb25..6258d55 100644 --- a/tests/StreamWrapperTest.php +++ b/tests/StreamWrapperTest.php @@ -9,6 +9,8 @@ * @coversDefaultClass TestFs\StreamWrapper */ class StreamWrapperTest extends TestCase { + use ErrorHandler; + private Device $device; public function setUp() : void { @@ -64,8 +66,14 @@ public function testCanCreateDirectory() : void { */ public function testCanCreateDirectoryRecursively() : void { $this->assertTrue(mkdir('tfs://foo/bar/baz', 0777, true)); - $this->assertTrue($this->device->getChildDirectory('foo')->getChildDirectory('bar')->hasChild('baz')); - $this->assertInstanceOf(Directory::class, $this->device->getChildDirectory('foo')->getChildDirectory('bar')->getChild('baz')); + $child = $this->device->getChildDirectory('foo'); + $this->assertInstanceOf(Directory::class, $child); + + $child = $child->getChildDirectory('bar'); + $this->assertInstanceOf(Directory::class, $child); + + $this->assertTrue($child->hasChild('baz')); + $this->assertInstanceOf(Directory::class, $child->getChild('baz')); } /** @@ -73,10 +81,8 @@ public function testCanCreateDirectoryRecursively() : void { */ public function testMkdirFailsWhenNameExists() : void { $this->assertTrue(mkdir('tfs://foobar')); - $this->assertFalse(@mkdir('tfs://foobar')); - - $this->expectWarning(); - $this->expectWarningMessage('mkdir(): File exists'); + $this->assertFalse($this->ignoreError(fn () => mkdir('tfs://foobar'))); + $this->expectExceptionObject(new Warning('mkdir(): File exists')); mkdir('tfs://foobar'); } @@ -84,10 +90,8 @@ public function testMkdirFailsWhenNameExists() : void { * @covers ::mkdir */ public function testMkdirFailsOnNonRecursiveWhenADirIsMissing() : void { - $this->assertFalse(@mkdir('tfs://foo/bar')); - - $this->expectWarning(); - $this->expectWarningMessage('mkdir(): No such file or directory'); + $this->assertFalse($this->ignoreError(fn () => mkdir('tfs://foo/bar'))); + $this->expectExceptionObject(new Warning('mkdir(): No such file or directory')); mkdir('tfs://foo/bar'); } @@ -97,8 +101,11 @@ public function testMkdirFailsOnNonRecursiveWhenADirIsMissing() : void { public function testCanCreateDirsWhenSomeDirsExist() : void { $this->assertTrue(mkdir('tfs://foo')); $this->assertTrue(mkdir('tfs://foo/bar')); - $this->assertTrue($this->device->getChild('foo')->hasChild('bar')); - $this->assertInstanceOf(Directory::class, $this->device->getChild('foo')->getChild('bar')); + + $dir = $this->device->getChild('foo'); + $this->assertInstanceOf(Directory::class, $dir); + $this->assertTrue($dir->hasChild('bar')); + $this->assertInstanceOf(Directory::class, $dir->getChild('bar')); } /** @@ -115,10 +122,8 @@ public function testCanRemoveDir() : void { * @covers ::rmdir */ public function testRmDirFailsWhenDeletingANonExistingDir() : void { - $this->assertFalse(@rmdir('tfs://foo')); - - $this->expectWarning(); - $this->expectWarningMessage('rmdir(foo): No such file or directory'); + $this->assertFalse($this->ignoreError(fn () => rmdir('tfs://foo'))); + $this->expectExceptionObject(new Warning('rmdir(foo): No such file or directory')); rmdir('tfs://foo'); } @@ -127,10 +132,8 @@ public function testRmDirFailsWhenDeletingANonExistingDir() : void { */ public function testRmDirFailsWhenDeletingANonDirectory() : void { $this->assertTrue(touch('tfs://foo')); - $this->assertFalse(@rmdir('tfs://foo')); - - $this->expectWarning(); - $this->expectWarningMessage('rmdir(foo): Not a directory'); + $this->assertFalse($this->ignoreError(fn () => rmdir('tfs://foo'))); + $this->expectExceptionObject(new Warning('rmdir(foo): Not a directory')); rmdir('tfs://foo'); } @@ -140,10 +143,8 @@ public function testRmDirFailsWhenDeletingANonDirectory() : void { public function testRmDirFailsWhenDeletingANonEmptyDirectory() : void { $this->assertTrue(mkdir('tfs://foo')); $this->assertTrue(touch('tfs://foo/bar')); - $this->assertFalse(@rmdir('tfs://foo')); - - $this->expectWarning(); - $this->expectWarningMessage('rmdir(foo): Not empty'); + $this->assertFalse($this->ignoreError(fn () => rmdir('tfs://foo'))); + $this->expectExceptionObject(new Warning('rmdir(foo): Not empty')); rmdir('tfs://foo'); } @@ -158,10 +159,9 @@ public function testRmDirFailsOnMissingPermissions() : void { StreamWrapper::setUid(1); StreamWrapper::setGid(1); - $this->assertFalse(@rmdir('tfs://root')); + $this->assertFalse($this->ignoreError(fn () => rmdir('tfs://root'))); - $this->expectWarning(); - $this->expectWarningMessage('rmdir(root): Permission denied'); + $this->expectExceptionObject(new Warning('rmdir(root): Permission denied')); rmdir('tfs://root'); } @@ -212,10 +212,8 @@ public function testCanOpenAndReadDirectories() : void { * @covers ::dir_opendir */ public function testFailsWhenOpeningDirectoryThatDoesNotExist() : void { - $this->assertFalse(@opendir('tfs://foo')); - - $this->expectWarning(); - $this->expectWarningMessage('opendir(tfs://foo): failed to open dir: No such file or directory'); + $this->assertFalse($this->ignoreError(fn () => opendir('tfs://foo'))); + $this->expectExceptionObject(new Warning('opendir(tfs://foo): failed to open dir: No such file or directory')); opendir('tfs://foo'); } @@ -224,29 +222,11 @@ public function testFailsWhenOpeningDirectoryThatDoesNotExist() : void { */ public function testFailsWhenOpeningFileAsDir() : void { touch('tfs://foo'); - $this->assertFalse(@opendir('tfs://foo')); - - $this->expectWarning(); - $this->expectWarningMessage('opendir(tfs://foo): failed to open dir: Not a directory'); + $this->assertFalse($this->ignoreError(fn () => opendir('tfs://foo'))); + $this->expectExceptionObject(new Warning('opendir(tfs://foo): failed to open dir: Not a directory')); opendir('tfs://foo'); } - /** - * @return array> - */ - public function getUrls() : array { - return [ - [ - 'tfs://foo', - 'foo' - ], - [ - 'tfs://foo//bar\\baz', - 'foo/bar/baz' - ] - ]; - } - /** * @dataProvider getUrls * @covers ::urlToPath @@ -263,22 +243,6 @@ public function testUrlToPathFailsOnInvalidUrl() : void { (new StreamWrapper())->urlToPath('foo://bar'); } - /** - * @return array> - */ - public function getPaths() : array { - return [ - [ - 'foo', - 'tfs://foo' - ], - [ - '/foo/bar/baz.txt', - 'tfs://foo/bar/baz.txt' - ], - ]; - } - /** * @dataProvider getPaths * @covers ::url @@ -299,10 +263,8 @@ public function testCanRemoveFile() : void { * @covers ::unlink */ public function testRemoveFileThatDoesNotExistFails() : void { - $this->assertFalse(@unlink('tfs://foo.bar')); - - $this->expectWarning(); - $this->expectWarningMessage('unlink(foo.bar): No such file or directory'); + $this->assertFalse($this->ignoreError(fn () => unlink('tfs://foo.bar'))); + $this->expectExceptionObject(new Warning('unlink(foo.bar): No such file or directory')); unlink('tfs://foo.bar'); } @@ -311,10 +273,9 @@ public function testRemoveFileThatDoesNotExistFails() : void { */ public function testUnlinkDirectoryFails() : void { mkdir('tfs://foo'); - $this->assertFalse(@unlink('tfs://foo')); + $this->assertFalse($this->ignoreError(fn () => unlink('tfs://foo'))); - $this->expectWarning(); - $this->expectWarningMessage('unlink(foo): Is a directory'); + $this->expectExceptionObject(new Warning('unlink(foo): Is a directory')); unlink('tfs://foo'); } @@ -330,10 +291,9 @@ public function testUnlinkFailsWhenDirIsNotWritable() : void { StreamWrapper::setUid(1); StreamWrapper::setGid(1); - $this->assertFalse(@unlink('tfs://dir/file')); + $this->assertFalse($this->ignoreError(fn () => unlink('tfs://dir/file'))); - $this->expectWarning(); - $this->expectWarningMessage('unlink(dir/file): Permission denied'); + $this->expectExceptionObject(new Warning('unlink(dir/file): Permission denied')); unlink('tfs://dir/file'); } @@ -400,10 +360,8 @@ public function testCanGetDeviceName() : void { * @covers ::rename */ public function testRenameFailsWhenOriginDoesNotExist() : void { - $this->assertFalse(@rename('tfs://foo', 'tfs://bar/baz.txt')); - - $this->expectWarning(); - $this->expectWarningMessage('rename(tfs://foo,tfs://bar/baz.txt): No such file or directory'); + $this->assertFalse($this->ignoreError(fn () => rename('tfs://foo', 'tfs://bar/baz.txt'))); + $this->expectExceptionObject(new Warning('rename(tfs://foo,tfs://bar/baz.txt): No such file or directory')); rename('tfs://foo', 'tfs://bar/baz.txt'); } @@ -412,10 +370,9 @@ public function testRenameFailsWhenOriginDoesNotExist() : void { */ public function testRenameFailsWhenParentOfTargetDoesNotExist() : void { $this->assertTrue(touch('tfs://foo')); - $this->assertFalse(@rename('tfs://foo', 'tfs://bar/baz.txt')); + $this->assertFalse($this->ignoreError(fn () => rename('tfs://foo', 'tfs://bar/baz.txt'))); - $this->expectWarning(); - $this->expectWarningMessage('rename(tfs://foo,tfs://bar/baz.txt): No such file or directory'); + $this->expectExceptionObject(new Warning('rename(tfs://foo,tfs://bar/baz.txt): No such file or directory')); rename('tfs://foo', 'tfs://bar/baz.txt'); } @@ -425,10 +382,8 @@ public function testRenameFailsWhenParentOfTargetDoesNotExist() : void { public function testRenameFailsWhenTargetIsADirectory() : void { $this->assertTrue(touch('tfs://foo')); $this->assertTrue(mkdir('tfs://bar')); - $this->assertFalse(@rename('tfs://foo', 'tfs://bar')); - - $this->expectWarning(); - $this->expectWarningMessage('rename(tfs://foo,tfs://bar): Is a directory'); + $this->assertFalse($this->ignoreError(fn () => rename('tfs://foo', 'tfs://bar'))); + $this->expectExceptionObject(new Warning('rename(tfs://foo,tfs://bar): Is a directory')); rename('tfs://foo', 'tfs://bar'); } @@ -438,10 +393,9 @@ public function testRenameFailsWhenTargetIsADirectory() : void { public function testRenameFailsWhenRenamingFromDirectoryToFile() : void { $this->assertTrue(mkdir('tfs://foo')); $this->assertTrue(touch('tfs://bar')); - $this->assertFalse(@rename('tfs://foo', 'tfs://bar')); + $this->assertFalse($this->ignoreError(fn () => rename('tfs://foo', 'tfs://bar'))); - $this->expectWarning(); - $this->expectWarningMessage('rename(tfs://foo,tfs://bar): Not a directory'); + $this->expectExceptionObject(new Warning('rename(tfs://foo,tfs://bar): Not a directory')); rename('tfs://foo', 'tfs://bar'); } @@ -453,6 +407,7 @@ public function testRenameOverwritesExistingTarget() : void { $this->assertTrue(touch('tfs://target.txt')); $target = $this->device->getChild('target.txt'); + $this->assertInstanceOf(File::class, $target); $this->assertSame($this->device, $target->getParent()); $this->assertTrue(rename('tfs://origin.txt', 'tfs://target.txt'), 'Expected rename to succeed'); @@ -484,7 +439,9 @@ public function testCanRenameFile() : void { $this->assertTrue(rename('tfs://bar', 'tfs://baz/barfoo')); $this->assertFalse($this->device->hasChild('bar'), '/bar should not exist'); - $this->assertTrue($this->device->getChild('baz')->hasChild('barfoo'), '/baz/barfoo should exist'); + $dir = $this->device->getChild('baz'); + $this->assertInstanceOf(Directory::class, $dir); + $this->assertTrue($dir->hasChild('barfoo'), '/baz/barfoo should exist'); } /** @@ -545,10 +502,8 @@ private function getHandleForFixture(string $url, string $mode, string $fixtureP * @covers ::warn */ public function testFopenFailsOnInvalidMode() : void { - $this->assertFalse(@fopen('tfs://foo.txt', 'z')); - - $this->expectWarning(); - $this->expectWarningMessage('fopen(): Unsupported mode: "z"'); + $this->assertFalse($this->ignoreError(fn () => fopen('tfs://foo.txt', 'z'))); + $this->expectExceptionObject(new Warning('fopen(): Unsupported mode: "z"')); fopen('tfs://foo.txt', 'z'); } @@ -556,10 +511,8 @@ public function testFopenFailsOnInvalidMode() : void { * @covers ::stream_open */ public function testFopenFailsWhenUsingPathOption() : void { - $this->assertFalse(@fopen('tfs://foo.txt', 'w', true)); - - $this->expectWarning(); - $this->expectWarningMessage('TestFs does not support "use_include_path"'); + $this->assertFalse($this->ignoreError(fn () => fopen('tfs://foo.txt', 'w', true))); + $this->expectExceptionObject(new Warning('TestFs does not support "use_include_path"')); fopen('tfs://foo.txt', 'w', true); } @@ -567,10 +520,8 @@ public function testFopenFailsWhenUsingPathOption() : void { * @covers ::stream_open */ public function testFopenFailsWhenOpeningAFileForWritingAndTheParentDoesNotExist() : void { - $this->assertFalse(@fopen('tfs://foo/bar.txt', 'w')); - - $this->expectWarning(); - $this->expectWarningMessage('fopen(foo/bar.txt): failed to open stream: No such file or directory'); + $this->assertFalse($this->ignoreError(fn () => fopen('tfs://foo/bar.txt', 'w'))); + $this->expectExceptionObject(new Warning('fopen(foo/bar.txt): failed to open stream: No such file or directory')); fopen('tfs://foo/bar.txt', 'w'); } @@ -579,10 +530,8 @@ public function testFopenFailsWhenOpeningAFileForWritingAndTheParentDoesNotExist */ public function testFopenFailsWhenOpeningADirectory() : void { mkdir('tfs://foo'); - $this->assertFalse(@fopen('tfs://foo', 'w')); - - $this->expectWarning(); - $this->expectWarningMessage('fopen(foo): failed to open stream. Is a directory'); + $this->assertFalse($this->ignoreError(fn () => fopen('tfs://foo', 'w'))); + $this->expectExceptionObject(new Warning('fopen(foo): failed to open stream. Is a directory')); fopen('tfs://foo', 'w'); } @@ -590,10 +539,8 @@ public function testFopenFailsWhenOpeningADirectory() : void { * @covers ::stream_open */ public function testFopenFailsWhenOpeningAFileThatDoesNotExistWithoutCreationMode() : void { - $this->assertFalse(@fopen('tfs://foo.txt', 'r')); - - $this->expectWarning(); - $this->expectWarningMessage('fopen(foo.txt): failed to open stream: No such file or directory'); + $this->assertFalse($this->ignoreError(fn () => fopen('tfs://foo.txt', 'r'))); + $this->expectExceptionObject(new Warning('fopen(foo.txt): failed to open stream: No such file or directory')); fopen('tfs://foo.txt', 'r'); } @@ -653,10 +600,8 @@ public function testSilentlyIgnoresNonBlockingOption() : void { * @covers ::url_stat */ public function testStatFailsWhenAssetDoesNotExist() : void { - $this->assertFalse(@stat('tfs://foo.txt')); - - $this->expectWarning(); - $this->expectWarningMessage('stat(): stat failed for tfs://foo.txt'); + $this->assertFalse($this->ignoreError(fn () => stat('tfs://foo.txt'))); + $this->expectExceptionObject(new Warning('stat(): stat failed for tfs://foo.txt')); $_ = stat('tfs://foo.txt'); } @@ -664,10 +609,8 @@ public function testStatFailsWhenAssetDoesNotExist() : void { * @covers ::url_stat */ public function testStatCanFailQuietlyWhenAssetDoesNotExist() : void { - $this->assertFalse(@stat('tfs://foo.txt')); - - $this->expectWarning(); - $this->expectWarningMessage('stat(): stat failed for tfs://foo.txt'); + $this->assertFalse($this->ignoreError(fn () => stat('tfs://foo.txt'))); + $this->expectExceptionObject(new Warning('stat(): stat failed for tfs://foo.txt')); $_ = stat('tfs://foo.txt'); } @@ -683,10 +626,8 @@ public function testStatFailsWhenParentDirIsNotReadable() : void { StreamWrapper::setUid(1); StreamWrapper::setGid(1); - $this->assertFalse(@stat('tfs://dir/file')); - - $this->expectWarning(); - $this->expectWarningMessage('stat(): stat failed for tfs://dir/file'); + $this->assertFalse($this->ignoreError(fn () => stat('tfs://dir/file'))); + $this->expectExceptionObject(new Warning('stat(): stat failed for tfs://dir/file')); $_ = stat('tfs://dir/file'); } @@ -694,10 +635,8 @@ public function testStatFailsWhenParentDirIsNotReadable() : void { * @covers ::stream_metadata */ public function testTouchFailsWhenParentDirectoryDoesNotExist() : void { - $this->assertFalse(@touch('tfs://foo/bar.txt')); - - $this->expectWarning(); - $this->expectWarningMessage('touch(): Unable to create file foo/bar.txt because No such file or directory'); + $this->assertFalse($this->ignoreError(fn () => touch('tfs://foo/bar.txt'))); + $this->expectExceptionObject(new Warning('touch(): Unable to create file foo/bar.txt because No such file or directory')); touch('tfs://foo/bar.txt'); } @@ -724,10 +663,8 @@ public function testCanChangeAssetMode() : void { * @covers ::stream_metadata */ public function testFailsWhenChangingModeOnNonExistingFile() : void { - $this->assertFalse(@chmod('tfs://foo/bar.txt', 0600)); - - $this->expectWarning(); - $this->expectWarningMessage('chmod(): No such file or directory'); + $this->assertFalse($this->ignoreError(fn () => chmod('tfs://foo/bar.txt', 0600))); + $this->expectExceptionObject(new Warning('chmod(): No such file or directory')); chmod('tfs://foo/bar.txt', 0600); } @@ -748,10 +685,8 @@ public function testTouchSupportsCustomTimes() : void { */ public function testChangeOwnerWithNonExistingUsername() : void { touch('tfs://file.txt'); - $this->assertFalse(@chown('tfs://file.txt', 'non-exsiting-user')); - - $this->expectWarning(); - $this->expectWarningMessage('chown(): Unable to find uid for non-exsiting-user'); + $this->assertFalse($this->ignoreError(fn () => chown('tfs://file.txt', 'non-exsiting-user'))); + $this->expectExceptionObject(new Warning('chown(): Unable to find uid for non-exsiting-user')); chown('tfs://file.txt', 'non-exsiting-user'); } @@ -760,10 +695,8 @@ public function testChangeOwnerWithNonExistingUsername() : void { */ public function testChangeOwnerWithNonExistingUid() : void { touch('tfs://file.txt'); - $this->assertFalse(@chown('tfs://file.txt', 123)); - - $this->expectWarning(); - $this->expectWarningMessage('chown(): Operation not permitted'); + $this->assertFalse($this->ignoreError(fn () => chown('tfs://file.txt', 123))); + $this->expectExceptionObject(new Warning('chown(): Operation not permitted')); chown('tfs://file.txt', 123); } @@ -771,10 +704,8 @@ public function testChangeOwnerWithNonExistingUid() : void { * @covers ::stream_metadata */ public function testChangeOwnerFailsWhenFileDoesNotExist() : void { - $this->assertFalse(@chown('tfs://file.txt', 123)); - - $this->expectWarning(); - $this->expectWarningMessage('chown(): No such file or directory'); + $this->assertFalse($this->ignoreError(fn () => chown('tfs://file.txt', 123))); + $this->expectExceptionObject(new Warning('chown(): No such file or directory')); chown('tfs://file.txt', 123); } @@ -790,10 +721,8 @@ public function testChownFailsWhenRegularUserIsNotOwner() : void { StreamWrapper::setUid(1); $this->assertTrue(touch('tfs://file.txt'), 'Expected touch to succeed'); - $this->assertFalse(@chown('tfs://file.txt', 'user2'), 'Expected chown to fail'); - - $this->expectWarning(); - $this->expectWarningMessage('chown(): Operation not permitted'); + $this->assertFalse($this->ignoreError(fn () => chown('tfs://file.txt', 'user2')), 'Expected chown to fail'); + $this->expectExceptionObject(new Warning('chown(): Operation not permitted')); chown('tfs://file.txt', 'user2'); } @@ -815,10 +744,8 @@ public function testCanChangeOwnerToSelfWhenAlreadyOwningFile() : void { */ public function testChangeGroupWithNonExistingGroup() : void { touch('tfs://file.txt'); - $this->assertFalse(@chgrp('tfs://file.txt', 'non-exsiting-group')); - - $this->expectWarning(); - $this->expectWarningMessage('chgrp(): Unable to find gid for non-exsiting-group'); + $this->assertFalse($this->ignoreError(fn () => chgrp('tfs://file.txt', 'non-exsiting-group'))); + $this->expectExceptionObject(new Warning('chgrp(): Unable to find gid for non-exsiting-group')); chgrp('tfs://file.txt', 'non-exsiting-group'); } @@ -827,10 +754,8 @@ public function testChangeGroupWithNonExistingGroup() : void { */ public function testChangeGroupWithNonExistingGid() : void { touch('tfs://file.txt'); - $this->assertFalse(@chgrp('tfs://file.txt', 123)); - - $this->expectWarning(); - $this->expectWarningMessage('chgrp(): Operation not permitted'); + $this->assertFalse($this->ignoreError(fn () => chgrp('tfs://file.txt', 123))); + $this->expectExceptionObject(new Warning('chgrp(): Operation not permitted')); chgrp('tfs://file.txt', 123); } @@ -838,10 +763,8 @@ public function testChangeGroupWithNonExistingGid() : void { * @covers ::stream_metadata */ public function testChangeGroupFailsWhenFileDoesNotExist() : void { - $this->assertFalse(@chgrp('tfs://file.txt', 123)); - - $this->expectWarning(); - $this->expectWarningMessage('chgrp(): No such file or directory'); + $this->assertFalse($this->ignoreError(fn () => chgrp('tfs://file.txt', 123))); + $this->expectExceptionObject(new Warning('chgrp(): No such file or directory')); chgrp('tfs://file.txt', 123); } @@ -906,10 +829,9 @@ public function testOpeningDirectoryWithoutPermission() : void { StreamWrapper::setUid(1); StreamWrapper::setGid(1); - $this->assertFalse(@opendir('tfs://root')); + $this->assertFalse($this->ignoreError(fn () => opendir('tfs://root'))); - $this->expectWarning(); - $this->expectWarningMessage('opendir(tfs://root): failed to open dir: Permission denied'); + $this->expectExceptionObject(new Warning('opendir(tfs://root): failed to open dir: Permission denied')); opendir('tfs://root'); } @@ -925,10 +847,9 @@ public function testOpeningDirectoryInProtectedDirectoryFails() : void { StreamWrapper::setUid(1); StreamWrapper::setGid(1); - $this->assertFalse(@opendir('tfs://root/dir')); + $this->assertFalse($this->ignoreError(fn () => opendir('tfs://root/dir'))); - $this->expectWarning(); - $this->expectWarningMessage('opendir(tfs://root/dir): failed to open dir: Permission denied'); + $this->expectExceptionObject(new Warning('opendir(tfs://root/dir): failed to open dir: Permission denied')); opendir('tfs://root/dir'); } @@ -943,10 +864,9 @@ public function testMkdirFailsWhenCreatingADirectoryInANonWritableDirectory() : StreamWrapper::setUid(1); StreamWrapper::setGid(1); - $this->assertFalse(@mkdir('tfs://root/dir')); + $this->assertFalse($this->ignoreError(fn () => mkdir('tfs://root/dir'))); - $this->expectWarning(); - $this->expectWarningMessage('mkdir(): Permission denied'); + $this->expectExceptionObject(new Warning('mkdir(): Permission denied')); mkdir('tfs://root/dir'); } @@ -981,10 +901,9 @@ public function testOpenAndCreatingFileInUnwritableDirectoryFails() : void { StreamWrapper::setGid(1); - $this->assertFalse(@fopen('tfs://dir/file', 'w+'), 'Expected fopen to fail'); + $this->assertFalse($this->ignoreError(fn () => fopen('tfs://dir/file', 'w+')), 'Expected fopen to fail'); - $this->expectWarning(); - $this->expectWarningMessage('fopen(dir/file): failed to open stream: Permission denied'); + $this->expectExceptionObject(new Warning('fopen(dir/file): failed to open stream: Permission denied')); fopen('tfs://dir/file', 'w+'); } @@ -1002,10 +921,9 @@ public function testOpeningUnreadableFileFails() : void { touch('tfs://dir/file'); chmod('tfs://dir/file', 0000); - $this->assertFalse(@fopen('tfs://dir/file', 'r'), 'Expected fopen to fail'); + $this->assertFalse($this->ignoreError(fn () => fopen('tfs://dir/file', 'r')), 'Expected fopen to fail'); - $this->expectWarning(); - $this->expectWarningMessage('fopen(dir/file): failed to open stream: Permission denied'); + $this->expectExceptionObject(new Warning('fopen(dir/file): failed to open stream: Permission denied')); fopen('tfs://dir/file', 'r'); } @@ -1038,10 +956,9 @@ public function testCanNotChangeToGroupWhenUserIsNotAMember() : void { $this->assertTrue(touch('tfs://file.txt'), 'Expected touch to succeed'); $this->assertTrue(chgrp('tfs://file.txt', 'group1'), 'Expected chgrp to succeed'); - $this->assertFalse(@chgrp('tfs://file.txt', 'group2'), 'Expected chgrp to fail'); + $this->assertFalse($this->ignoreError(fn () => chgrp('tfs://file.txt', 'group2')), 'Expected chgrp to fail'); - $this->expectWarning(); - $this->expectWarningMessage('chgrp(): Operation not permitted'); + $this->expectExceptionObject(new Warning('chgrp(): Operation not permitted')); chgrp('tfs://file.txt', 'group2'); } @@ -1056,8 +973,7 @@ public function testCanNotChangeToGroupWhenGroupIsEmpty() : void { $this->assertTrue(touch('tfs://file.txt'), 'Expected touch to succeed'); - $this->expectWarning(); - $this->expectWarningMessage('chgrp(): Operation not permitted'); + $this->expectExceptionObject(new Warning('chgrp(): Operation not permitted')); chgrp('tfs://file.txt', 'group1'); } @@ -1148,4 +1064,36 @@ public function testThrowsExceptionOnMissingFileHandleWhenWritingToStream() : vo $this->expectExceptionObject(new RuntimeException('Invalid file handle')); (new StreamWrapper())->stream_write('some data'); } + + /** + * @return array + */ + public static function getUrls() : array { + return [ + [ + 'url' => 'tfs://foo', + 'expectedPath' => 'foo' + ], + [ + 'url' => 'tfs://foo//bar\\baz', + 'expectedPath' => 'foo/bar/baz' + ] + ]; + } + + /** + * @return array + */ + public static function getPaths() : array { + return [ + 'relative' => [ + 'path' => 'foo', + 'expectedUrl' => 'tfs://foo' + ], + 'absolute' => [ + 'path' => '/foo/bar/baz.txt', + 'expectedUrl' => 'tfs://foo/bar/baz.txt' + ], + ]; + } }