diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8010cb6..cd8d32d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -14,7 +14,7 @@ jobs: - name: Setup PHP uses: shivammathur/setup-php@v2 with: - php-version: 8.1 + php-version: 8.2 ini-values: assert.exception=1, phar.readonly=0, zend.assertions=1 extensions: curl, json, phar, mbstring, gzip, bzip2, openssl tools: pecl, phing diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 75880a1..c4e72cd 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -16,7 +16,7 @@ jobs: key: cache-v1 # can be any string, change to clear the extension cache. strategy: matrix: - php-versions: ['8.1', '8.2', '8.3'] + php-versions: ['8.2', '8.3'] experimental: [ false ] include: - php-versions: '8.4' diff --git a/composer.json b/composer.json index d03bd93..393fb2a 100644 --- a/composer.json +++ b/composer.json @@ -30,8 +30,8 @@ "rize/uri-template": "*" }, "require-dev": { - "lunr/halo": "~0.10.0", - "phpunit/phpunit": "~10.0", + "lunr/halo": "~0.11.0", + "phpunit/phpunit": "~11.0", "theseer/autoload": "~1.0", "phing/phing": "~3.0", "phpstan/phpstan": "^1.2.0", diff --git a/composer.lock b/composer.lock index 09eb19a..491663e 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": "b8e5ae8f736d4ff65d6d9cb918af30dc", + "content-hash": "e5e970b0aeb650a88b05e939faa17874", "packages": [ { "name": "lukasoppermann/http-status", @@ -66,16 +66,16 @@ }, { "name": "matthiasmullie/minify", - "version": "1.3.73", + "version": "1.3.75", "source": { "type": "git", "url": "https://github.com/matthiasmullie/minify.git", - "reference": "cb7a9297b4ab070909cefade30ee95054d4ae87a" + "reference": "76ba4a5f555fd7bf4aa408af608e991569076671" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/matthiasmullie/minify/zipball/cb7a9297b4ab070909cefade30ee95054d4ae87a", - "reference": "cb7a9297b4ab070909cefade30ee95054d4ae87a", + "url": "https://api.github.com/repos/matthiasmullie/minify/zipball/76ba4a5f555fd7bf4aa408af608e991569076671", + "reference": "76ba4a5f555fd7bf4aa408af608e991569076671", "shasum": "" }, "require": { @@ -86,8 +86,7 @@ "require-dev": { "friendsofphp/php-cs-fixer": ">=2.0", "matthiasmullie/scrapbook": ">=1.3", - "phpunit/phpunit": ">=4.8", - "squizlabs/php_codesniffer": ">=3.0" + "phpunit/phpunit": ">=4.8" }, "suggest": { "psr/cache-implementation": "Cache implementation to use with Minify::cache" @@ -125,7 +124,7 @@ ], "support": { "issues": "https://github.com/matthiasmullie/minify/issues", - "source": "https://github.com/matthiasmullie/minify/tree/1.3.73" + "source": "https://github.com/matthiasmullie/minify/tree/1.3.75" }, "funding": [ { @@ -133,7 +132,7 @@ "type": "github" } ], - "time": "2024-03-15T10:27:10+00:00" + "time": "2025-06-25T09:56:19+00:00" }, { "name": "matthiasmullie/path-converter", @@ -246,16 +245,16 @@ }, { "name": "psr/log", - "version": "3.0.0", + "version": "3.0.2", "source": { "type": "git", "url": "https://github.com/php-fig/log.git", - "reference": "fe5ea303b0887d5caefd3d431c3e61ad47037001" + "reference": "f16e1d5863e37f8d8c2a01719f5b34baa2b714d3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/log/zipball/fe5ea303b0887d5caefd3d431c3e61ad47037001", - "reference": "fe5ea303b0887d5caefd3d431c3e61ad47037001", + "url": "https://api.github.com/repos/php-fig/log/zipball/f16e1d5863e37f8d8c2a01719f5b34baa2b714d3", + "reference": "f16e1d5863e37f8d8c2a01719f5b34baa2b714d3", "shasum": "" }, "require": { @@ -290,9 +289,9 @@ "psr-3" ], "support": { - "source": "https://github.com/php-fig/log/tree/3.0.0" + "source": "https://github.com/php-fig/log/tree/3.0.2" }, - "time": "2021-07-14T16:46:02+00:00" + "time": "2024-09-11T13:17:53+00:00" }, { "name": "rize/uri-template", @@ -360,16 +359,16 @@ }, { "name": "symfony/deprecation-contracts", - "version": "v3.5.1", + "version": "v3.6.0", "source": { "type": "git", "url": "https://github.com/symfony/deprecation-contracts.git", - "reference": "74c71c939a79f7d5bf3c1ce9f5ea37ba0114c6f6" + "reference": "63afe740e99a13ba87ec199bb07bbdee937a5b62" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/74c71c939a79f7d5bf3c1ce9f5ea37ba0114c6f6", - "reference": "74c71c939a79f7d5bf3c1ce9f5ea37ba0114c6f6", + "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/63afe740e99a13ba87ec199bb07bbdee937a5b62", + "reference": "63afe740e99a13ba87ec199bb07bbdee937a5b62", "shasum": "" }, "require": { @@ -382,7 +381,7 @@ "name": "symfony/contracts" }, "branch-alias": { - "dev-main": "3.5-dev" + "dev-main": "3.6-dev" } }, "autoload": { @@ -407,7 +406,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.5.1" + "source": "https://github.com/symfony/deprecation-contracts/tree/v3.6.0" }, "funding": [ { @@ -423,11 +422,11 @@ "type": "tidelift" } ], - "time": "2024-09-25T14:20:29+00:00" + "time": "2024-09-25T14:21:43+00:00" }, { "name": "symfony/polyfill-ctype", - "version": "v1.31.0", + "version": "v1.32.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", @@ -486,7 +485,7 @@ "portable" ], "support": { - "source": "https://github.com/symfony/polyfill-ctype/tree/v1.31.0" + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.32.0" }, "funding": [ { @@ -506,19 +505,20 @@ }, { "name": "symfony/polyfill-mbstring", - "version": "v1.31.0", + "version": "v1.32.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "85181ba99b2345b0ef10ce42ecac37612d9fd341" + "reference": "6d857f4d76bd4b343eac26d6b539585d2bc56493" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/85181ba99b2345b0ef10ce42ecac37612d9fd341", - "reference": "85181ba99b2345b0ef10ce42ecac37612d9fd341", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/6d857f4d76bd4b343eac26d6b539585d2bc56493", + "reference": "6d857f4d76bd4b343eac26d6b539585d2bc56493", "shasum": "" }, "require": { + "ext-iconv": "*", "php": ">=7.2" }, "provide": { @@ -566,7 +566,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.31.0" + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.32.0" }, "funding": [ { @@ -582,11 +582,11 @@ "type": "tidelift" } ], - "time": "2024-09-09T11:45:10+00:00" + "time": "2024-12-23T08:48:59+00:00" }, { "name": "twig/markdown-extra", - "version": "v3.20.0", + "version": "v3.21.0", "source": { "type": "git", "url": "https://github.com/twigphp/markdown-extra.git", @@ -642,7 +642,7 @@ "twig" ], "support": { - "source": "https://github.com/twigphp/markdown-extra/tree/v3.20.0" + "source": "https://github.com/twigphp/markdown-extra/tree/v3.21.0" }, "funding": [ { @@ -658,16 +658,16 @@ }, { "name": "twig/twig", - "version": "v3.20.0", + "version": "v3.21.1", "source": { "type": "git", "url": "https://github.com/twigphp/Twig.git", - "reference": "3468920399451a384bef53cf7996965f7cd40183" + "reference": "285123877d4dd97dd7c11842ac5fb7e86e60d81d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/twigphp/Twig/zipball/3468920399451a384bef53cf7996965f7cd40183", - "reference": "3468920399451a384bef53cf7996965f7cd40183", + "url": "https://api.github.com/repos/twigphp/Twig/zipball/285123877d4dd97dd7c11842ac5fb7e86e60d81d", + "reference": "285123877d4dd97dd7c11842ac5fb7e86e60d81d", "shasum": "" }, "require": { @@ -721,7 +721,7 @@ ], "support": { "issues": "https://github.com/twigphp/Twig/issues", - "source": "https://github.com/twigphp/Twig/tree/v3.20.0" + "source": "https://github.com/twigphp/Twig/tree/v3.21.1" }, "funding": [ { @@ -733,7 +733,7 @@ "type": "tidelift" } ], - "time": "2025-02-13T08:34:43+00:00" + "time": "2025-05-03T07:21:55+00:00" }, { "name": "vanilla/garden-cli", @@ -794,16 +794,16 @@ "packages-dev": [ { "name": "lunr/halo", - "version": "0.10.1", + "version": "0.11.0", "source": { "type": "git", "url": "https://github.com/lunr-php/lunr.halo.git", - "reference": "80e493a019c5fe29a1d798fe76ae7b9917cd52b6" + "reference": "3a794ab2bba893a32c8b4e4cf2c2ab4a771b336a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/lunr-php/lunr.halo/zipball/80e493a019c5fe29a1d798fe76ae7b9917cd52b6", - "reference": "80e493a019c5fe29a1d798fe76ae7b9917cd52b6", + "url": "https://api.github.com/repos/lunr-php/lunr.halo/zipball/3a794ab2bba893a32c8b4e4cf2c2ab4a771b336a", + "reference": "3a794ab2bba893a32c8b4e4cf2c2ab4a771b336a", "shasum": "" }, "require": { @@ -812,7 +812,7 @@ }, "require-dev": { "ext-xdebug": ">=3.0", - "phpunit/phpunit": ">=9.0 <9.6", + "phpunit/phpunit": ">=10.5 <11.0", "psr/container": ">=2.0.2", "psr/log": ">=1.1" }, @@ -834,23 +834,22 @@ "unit tests" ], "support": { - "issues": "https://github.com/lunr-php/lunr.halo/issues", - "source": "https://github.com/lunr-php/lunr.halo/tree/0.10.1" + "source": "https://github.com/lunr-php/lunr.halo/tree/0.11.0" }, - "time": "2024-12-05T11:12:59+00:00" + "time": "2025-02-08T20:26:34+00:00" }, { "name": "myclabs/deep-copy", - "version": "1.12.0", + "version": "1.13.3", "source": { "type": "git", "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "3a6b9a42cd8f8771bd4295d13e1423fa7f3d942c" + "reference": "faed855a7b5f4d4637717c2b3863e277116beb36" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/3a6b9a42cd8f8771bd4295d13e1423fa7f3d942c", - "reference": "3a6b9a42cd8f8771bd4295d13e1423fa7f3d942c", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/faed855a7b5f4d4637717c2b3863e277116beb36", + "reference": "faed855a7b5f4d4637717c2b3863e277116beb36", "shasum": "" }, "require": { @@ -889,7 +888,7 @@ ], "support": { "issues": "https://github.com/myclabs/DeepCopy/issues", - "source": "https://github.com/myclabs/DeepCopy/tree/1.12.0" + "source": "https://github.com/myclabs/DeepCopy/tree/1.13.3" }, "funding": [ { @@ -897,20 +896,20 @@ "type": "tidelift" } ], - "time": "2024-06-12T14:39:25+00:00" + "time": "2025-07-05T12:25:42+00:00" }, { "name": "nikic/php-parser", - "version": "v5.1.0", + "version": "v5.5.0", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "683130c2ff8c2739f4822ff7ac5c873ec529abd1" + "reference": "ae59794362fe85e051a58ad36b289443f57be7a9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/683130c2ff8c2739f4822ff7ac5c873ec529abd1", - "reference": "683130c2ff8c2739f4822ff7ac5c873ec529abd1", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/ae59794362fe85e051a58ad36b289443f57be7a9", + "reference": "ae59794362fe85e051a58ad36b289443f57be7a9", "shasum": "" }, "require": { @@ -953,9 +952,9 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v5.1.0" + "source": "https://github.com/nikic/PHP-Parser/tree/v5.5.0" }, - "time": "2024-07-01T20:03:41+00:00" + "time": "2025-05-31T08:24:38+00:00" }, { "name": "phar-io/manifest", @@ -1407,16 +1406,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.12.8", + "version": "1.12.27", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "f6a60a4d66142b8156c9da923f1972657bc4748c" + "reference": "3a6e423c076ab39dfedc307e2ac627ef579db162" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/f6a60a4d66142b8156c9da923f1972657bc4748c", - "reference": "f6a60a4d66142b8156c9da923f1972657bc4748c", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/3a6e423c076ab39dfedc307e2ac627ef579db162", + "reference": "3a6e423c076ab39dfedc307e2ac627ef579db162", "shasum": "" }, "require": { @@ -1461,7 +1460,7 @@ "type": "github" } ], - "time": "2024-11-06T19:06:49+00:00" + "time": "2025-05-21T20:51:45+00:00" }, { "name": "phpstan/phpstan-deprecation-rules", @@ -1512,21 +1511,21 @@ }, { "name": "phpstan/phpstan-phpunit", - "version": "1.4.0", + "version": "1.4.2", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan-phpunit.git", - "reference": "f3ea021866f4263f07ca3636bf22c64be9610c11" + "reference": "72a6721c9b64b3e4c9db55abbc38f790b318267e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan-phpunit/zipball/f3ea021866f4263f07ca3636bf22c64be9610c11", - "reference": "f3ea021866f4263f07ca3636bf22c64be9610c11", + "url": "https://api.github.com/repos/phpstan/phpstan-phpunit/zipball/72a6721c9b64b3e4c9db55abbc38f790b318267e", + "reference": "72a6721c9b64b3e4c9db55abbc38f790b318267e", "shasum": "" }, "require": { "php": "^7.2 || ^8.0", - "phpstan/phpstan": "^1.11" + "phpstan/phpstan": "^1.12" }, "conflict": { "phpunit/phpunit": "<7.0" @@ -1558,22 +1557,22 @@ "description": "PHPUnit extensions and rules for PHPStan", "support": { "issues": "https://github.com/phpstan/phpstan-phpunit/issues", - "source": "https://github.com/phpstan/phpstan-phpunit/tree/1.4.0" + "source": "https://github.com/phpstan/phpstan-phpunit/tree/1.4.2" }, - "time": "2024-04-20T06:39:00+00:00" + "time": "2024-12-17T17:20:49+00:00" }, { "name": "phpstan/phpstan-strict-rules", - "version": "1.6.1", + "version": "1.6.2", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan-strict-rules.git", - "reference": "daeec748b53de80a97498462513066834ec28f8b" + "reference": "b564ca479e7e735f750aaac4935af965572a7845" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan-strict-rules/zipball/daeec748b53de80a97498462513066834ec28f8b", - "reference": "daeec748b53de80a97498462513066834ec28f8b", + "url": "https://api.github.com/repos/phpstan/phpstan-strict-rules/zipball/b564ca479e7e735f750aaac4935af965572a7845", + "reference": "b564ca479e7e735f750aaac4935af965572a7845", "shasum": "" }, "require": { @@ -1607,41 +1606,41 @@ "description": "Extra strict and opinionated rules for PHPStan", "support": { "issues": "https://github.com/phpstan/phpstan-strict-rules/issues", - "source": "https://github.com/phpstan/phpstan-strict-rules/tree/1.6.1" + "source": "https://github.com/phpstan/phpstan-strict-rules/tree/1.6.2" }, - "time": "2024-09-20T14:04:44+00:00" + "time": "2025-01-19T13:02:24+00:00" }, { "name": "phpunit/php-code-coverage", - "version": "10.1.15", + "version": "11.0.10", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "5da8b1728acd1e6ffdf2ff32ffbdfd04307f26ae" + "reference": "1a800a7446add2d79cc6b3c01c45381810367d76" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/5da8b1728acd1e6ffdf2ff32ffbdfd04307f26ae", - "reference": "5da8b1728acd1e6ffdf2ff32ffbdfd04307f26ae", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/1a800a7446add2d79cc6b3c01c45381810367d76", + "reference": "1a800a7446add2d79cc6b3c01c45381810367d76", "shasum": "" }, "require": { "ext-dom": "*", "ext-libxml": "*", "ext-xmlwriter": "*", - "nikic/php-parser": "^4.18 || ^5.0", - "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" + "nikic/php-parser": "^5.4.0", + "php": ">=8.2", + "phpunit/php-file-iterator": "^5.1.0", + "phpunit/php-text-template": "^4.0.1", + "sebastian/code-unit-reverse-lookup": "^4.0.1", + "sebastian/complexity": "^4.0.1", + "sebastian/environment": "^7.2.0", + "sebastian/lines-of-code": "^3.0.1", + "sebastian/version": "^5.0.2", + "theseer/tokenizer": "^1.2.3" }, "require-dev": { - "phpunit/phpunit": "^10.1" + "phpunit/phpunit": "^11.5.2" }, "suggest": { "ext-pcov": "PHP extension that provides line coverage", @@ -1650,7 +1649,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "10.1-dev" + "dev-main": "11.0.x-dev" } }, "autoload": { @@ -1679,40 +1678,52 @@ "support": { "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", "security": "https://github.com/sebastianbergmann/php-code-coverage/security/policy", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/10.1.15" + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/show" }, "funding": [ { "url": "https://github.com/sebastianbergmann", "type": "github" + }, + { + "url": "https://liberapay.com/sebastianbergmann", + "type": "liberapay" + }, + { + "url": "https://thanks.dev/u/gh/sebastianbergmann", + "type": "thanks_dev" + }, + { + "url": "https://tidelift.com/funding/github/packagist/phpunit/php-code-coverage", + "type": "tidelift" } ], - "time": "2024-06-29T08:25:15+00:00" + "time": "2025-06-18T08:56:18+00:00" }, { "name": "phpunit/php-file-iterator", - "version": "4.1.0", + "version": "5.1.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "a95037b6d9e608ba092da1b23931e537cadc3c3c" + "reference": "118cfaaa8bc5aef3287bf315b6060b1174754af6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/a95037b6d9e608ba092da1b23931e537cadc3c3c", - "reference": "a95037b6d9e608ba092da1b23931e537cadc3c3c", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/118cfaaa8bc5aef3287bf315b6060b1174754af6", + "reference": "118cfaaa8bc5aef3287bf315b6060b1174754af6", "shasum": "" }, "require": { - "php": ">=8.1" + "php": ">=8.2" }, "require-dev": { - "phpunit/phpunit": "^10.0" + "phpunit/phpunit": "^11.0" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "4.0-dev" + "dev-main": "5.0-dev" } }, "autoload": { @@ -1740,7 +1751,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/php-file-iterator/issues", "security": "https://github.com/sebastianbergmann/php-file-iterator/security/policy", - "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/4.1.0" + "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/5.1.0" }, "funding": [ { @@ -1748,28 +1759,28 @@ "type": "github" } ], - "time": "2023-08-31T06:24:48+00:00" + "time": "2024-08-27T05:02:59+00:00" }, { "name": "phpunit/php-invoker", - "version": "4.0.0", + "version": "5.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-invoker.git", - "reference": "f5e568ba02fa5ba0ddd0f618391d5a9ea50b06d7" + "reference": "c1ca3814734c07492b3d4c5f794f4b0995333da2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-invoker/zipball/f5e568ba02fa5ba0ddd0f618391d5a9ea50b06d7", - "reference": "f5e568ba02fa5ba0ddd0f618391d5a9ea50b06d7", + "url": "https://api.github.com/repos/sebastianbergmann/php-invoker/zipball/c1ca3814734c07492b3d4c5f794f4b0995333da2", + "reference": "c1ca3814734c07492b3d4c5f794f4b0995333da2", "shasum": "" }, "require": { - "php": ">=8.1" + "php": ">=8.2" }, "require-dev": { "ext-pcntl": "*", - "phpunit/phpunit": "^10.0" + "phpunit/phpunit": "^11.0" }, "suggest": { "ext-pcntl": "*" @@ -1777,7 +1788,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "4.0-dev" + "dev-main": "5.0-dev" } }, "autoload": { @@ -1803,7 +1814,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-invoker/issues", - "source": "https://github.com/sebastianbergmann/php-invoker/tree/4.0.0" + "security": "https://github.com/sebastianbergmann/php-invoker/security/policy", + "source": "https://github.com/sebastianbergmann/php-invoker/tree/5.0.1" }, "funding": [ { @@ -1811,32 +1823,32 @@ "type": "github" } ], - "time": "2023-02-03T06:56:09+00:00" + "time": "2024-07-03T05:07:44+00:00" }, { "name": "phpunit/php-text-template", - "version": "3.0.1", + "version": "4.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-text-template.git", - "reference": "0c7b06ff49e3d5072f057eb1fa59258bf287a748" + "reference": "3e0404dc6b300e6bf56415467ebcb3fe4f33e964" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/0c7b06ff49e3d5072f057eb1fa59258bf287a748", - "reference": "0c7b06ff49e3d5072f057eb1fa59258bf287a748", + "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/3e0404dc6b300e6bf56415467ebcb3fe4f33e964", + "reference": "3e0404dc6b300e6bf56415467ebcb3fe4f33e964", "shasum": "" }, "require": { - "php": ">=8.1" + "php": ">=8.2" }, "require-dev": { - "phpunit/phpunit": "^10.0" + "phpunit/phpunit": "^11.0" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "3.0-dev" + "dev-main": "4.0-dev" } }, "autoload": { @@ -1863,7 +1875,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/php-text-template/issues", "security": "https://github.com/sebastianbergmann/php-text-template/security/policy", - "source": "https://github.com/sebastianbergmann/php-text-template/tree/3.0.1" + "source": "https://github.com/sebastianbergmann/php-text-template/tree/4.0.1" }, "funding": [ { @@ -1871,32 +1883,32 @@ "type": "github" } ], - "time": "2023-08-31T14:07:24+00:00" + "time": "2024-07-03T05:08:43+00:00" }, { "name": "phpunit/php-timer", - "version": "6.0.0", + "version": "7.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-timer.git", - "reference": "e2a2d67966e740530f4a3343fe2e030ffdc1161d" + "reference": "3b415def83fbcb41f991d9ebf16ae4ad8b7837b3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/e2a2d67966e740530f4a3343fe2e030ffdc1161d", - "reference": "e2a2d67966e740530f4a3343fe2e030ffdc1161d", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/3b415def83fbcb41f991d9ebf16ae4ad8b7837b3", + "reference": "3b415def83fbcb41f991d9ebf16ae4ad8b7837b3", "shasum": "" }, "require": { - "php": ">=8.1" + "php": ">=8.2" }, "require-dev": { - "phpunit/phpunit": "^10.0" + "phpunit/phpunit": "^11.0" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "6.0-dev" + "dev-main": "7.0-dev" } }, "autoload": { @@ -1922,7 +1934,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-timer/issues", - "source": "https://github.com/sebastianbergmann/php-timer/tree/6.0.0" + "security": "https://github.com/sebastianbergmann/php-timer/security/policy", + "source": "https://github.com/sebastianbergmann/php-timer/tree/7.0.1" }, "funding": [ { @@ -1930,20 +1943,20 @@ "type": "github" } ], - "time": "2023-02-03T06:57:52+00:00" + "time": "2024-07-03T05:09:35+00:00" }, { "name": "phpunit/phpunit", - "version": "10.5.26", + "version": "11.5.27", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "42e2f13ceaa2e34461bc89bea75407550b40b2aa" + "reference": "446d43867314781df7e9adf79c3ec7464956fd8f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/42e2f13ceaa2e34461bc89bea75407550b40b2aa", - "reference": "42e2f13ceaa2e34461bc89bea75407550b40b2aa", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/446d43867314781df7e9adf79c3ec7464956fd8f", + "reference": "446d43867314781df7e9adf79c3ec7464956fd8f", "shasum": "" }, "require": { @@ -1953,26 +1966,26 @@ "ext-mbstring": "*", "ext-xml": "*", "ext-xmlwriter": "*", - "myclabs/deep-copy": "^1.10.1", - "phar-io/manifest": "^2.0.3", - "phar-io/version": "^3.0.2", - "php": ">=8.1", - "phpunit/php-code-coverage": "^10.1.5", - "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.1", - "sebastian/global-state": "^6.0.1", - "sebastian/object-enumerator": "^5.0", - "sebastian/recursion-context": "^5.0", - "sebastian/type": "^4.0", - "sebastian/version": "^4.0" + "myclabs/deep-copy": "^1.13.3", + "phar-io/manifest": "^2.0.4", + "phar-io/version": "^3.2.1", + "php": ">=8.2", + "phpunit/php-code-coverage": "^11.0.10", + "phpunit/php-file-iterator": "^5.1.0", + "phpunit/php-invoker": "^5.0.1", + "phpunit/php-text-template": "^4.0.1", + "phpunit/php-timer": "^7.0.1", + "sebastian/cli-parser": "^3.0.2", + "sebastian/code-unit": "^3.0.3", + "sebastian/comparator": "^6.3.1", + "sebastian/diff": "^6.0.2", + "sebastian/environment": "^7.2.1", + "sebastian/exporter": "^6.3.0", + "sebastian/global-state": "^7.0.2", + "sebastian/object-enumerator": "^6.0.1", + "sebastian/type": "^5.1.2", + "sebastian/version": "^5.0.2", + "staabm/side-effects-detector": "^1.0.5" }, "suggest": { "ext-soap": "To be able to generate mocks based on WSDL files" @@ -1983,7 +1996,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "10.5-dev" + "dev-main": "11.5-dev" } }, "autoload": { @@ -2015,7 +2028,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", "security": "https://github.com/sebastianbergmann/phpunit/security/policy", - "source": "https://github.com/sebastianbergmann/phpunit/tree/10.5.26" + "source": "https://github.com/sebastianbergmann/phpunit/tree/11.5.27" }, "funding": [ { @@ -2026,12 +2039,20 @@ "url": "https://github.com/sebastianbergmann", "type": "github" }, + { + "url": "https://liberapay.com/sebastianbergmann", + "type": "liberapay" + }, + { + "url": "https://thanks.dev/u/gh/sebastianbergmann", + "type": "thanks_dev" + }, { "url": "https://tidelift.com/funding/github/packagist/phpunit/phpunit", "type": "tidelift" } ], - "time": "2024-07-08T05:30:46+00:00" + "time": "2025-07-11T04:10:06+00:00" }, { "name": "psr/container", @@ -2088,28 +2109,28 @@ }, { "name": "sebastian/cli-parser", - "version": "2.0.1", + "version": "3.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/cli-parser.git", - "reference": "c34583b87e7b7a8055bf6c450c2c77ce32a24084" + "reference": "15c5dd40dc4f38794d383bb95465193f5e0ae180" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/c34583b87e7b7a8055bf6c450c2c77ce32a24084", - "reference": "c34583b87e7b7a8055bf6c450c2c77ce32a24084", + "url": "https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/15c5dd40dc4f38794d383bb95465193f5e0ae180", + "reference": "15c5dd40dc4f38794d383bb95465193f5e0ae180", "shasum": "" }, "require": { - "php": ">=8.1" + "php": ">=8.2" }, "require-dev": { - "phpunit/phpunit": "^10.0" + "phpunit/phpunit": "^11.0" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "2.0-dev" + "dev-main": "3.0-dev" } }, "autoload": { @@ -2133,7 +2154,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/cli-parser/issues", "security": "https://github.com/sebastianbergmann/cli-parser/security/policy", - "source": "https://github.com/sebastianbergmann/cli-parser/tree/2.0.1" + "source": "https://github.com/sebastianbergmann/cli-parser/tree/3.0.2" }, "funding": [ { @@ -2141,32 +2162,32 @@ "type": "github" } ], - "time": "2024-03-02T07:12:49+00:00" + "time": "2024-07-03T04:41:36+00:00" }, { "name": "sebastian/code-unit", - "version": "2.0.0", + "version": "3.0.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/code-unit.git", - "reference": "a81fee9eef0b7a76af11d121767abc44c104e503" + "reference": "54391c61e4af8078e5b276ab082b6d3c54c9ad64" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/code-unit/zipball/a81fee9eef0b7a76af11d121767abc44c104e503", - "reference": "a81fee9eef0b7a76af11d121767abc44c104e503", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit/zipball/54391c61e4af8078e5b276ab082b6d3c54c9ad64", + "reference": "54391c61e4af8078e5b276ab082b6d3c54c9ad64", "shasum": "" }, "require": { - "php": ">=8.1" + "php": ">=8.2" }, "require-dev": { - "phpunit/phpunit": "^10.0" + "phpunit/phpunit": "^11.5" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "2.0-dev" + "dev-main": "3.0-dev" } }, "autoload": { @@ -2189,7 +2210,8 @@ "homepage": "https://github.com/sebastianbergmann/code-unit", "support": { "issues": "https://github.com/sebastianbergmann/code-unit/issues", - "source": "https://github.com/sebastianbergmann/code-unit/tree/2.0.0" + "security": "https://github.com/sebastianbergmann/code-unit/security/policy", + "source": "https://github.com/sebastianbergmann/code-unit/tree/3.0.3" }, "funding": [ { @@ -2197,32 +2219,32 @@ "type": "github" } ], - "time": "2023-02-03T06:58:43+00:00" + "time": "2025-03-19T07:56:08+00:00" }, { "name": "sebastian/code-unit-reverse-lookup", - "version": "3.0.0", + "version": "4.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", - "reference": "5e3a687f7d8ae33fb362c5c0743794bbb2420a1d" + "reference": "183a9b2632194febd219bb9246eee421dad8d45e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/5e3a687f7d8ae33fb362c5c0743794bbb2420a1d", - "reference": "5e3a687f7d8ae33fb362c5c0743794bbb2420a1d", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/183a9b2632194febd219bb9246eee421dad8d45e", + "reference": "183a9b2632194febd219bb9246eee421dad8d45e", "shasum": "" }, "require": { - "php": ">=8.1" + "php": ">=8.2" }, "require-dev": { - "phpunit/phpunit": "^10.0" + "phpunit/phpunit": "^11.0" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "3.0-dev" + "dev-main": "4.0-dev" } }, "autoload": { @@ -2244,7 +2266,8 @@ "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", "support": { "issues": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/issues", - "source": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/tree/3.0.0" + "security": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/security/policy", + "source": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/tree/4.0.1" }, "funding": [ { @@ -2252,36 +2275,39 @@ "type": "github" } ], - "time": "2023-02-03T06:59:15+00:00" + "time": "2024-07-03T04:45:54+00:00" }, { "name": "sebastian/comparator", - "version": "5.0.1", + "version": "6.3.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "2db5010a484d53ebf536087a70b4a5423c102372" + "reference": "24b8fbc2c8e201bb1308e7b05148d6ab393b6959" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/2db5010a484d53ebf536087a70b4a5423c102372", - "reference": "2db5010a484d53ebf536087a70b4a5423c102372", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/24b8fbc2c8e201bb1308e7b05148d6ab393b6959", + "reference": "24b8fbc2c8e201bb1308e7b05148d6ab393b6959", "shasum": "" }, "require": { "ext-dom": "*", "ext-mbstring": "*", - "php": ">=8.1", - "sebastian/diff": "^5.0", - "sebastian/exporter": "^5.0" + "php": ">=8.2", + "sebastian/diff": "^6.0", + "sebastian/exporter": "^6.0" }, "require-dev": { - "phpunit/phpunit": "^10.3" + "phpunit/phpunit": "^11.4" + }, + "suggest": { + "ext-bcmath": "For comparing BcMath\\Number objects" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "5.0-dev" + "dev-main": "6.3-dev" } }, "autoload": { @@ -2321,7 +2347,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/comparator/issues", "security": "https://github.com/sebastianbergmann/comparator/security/policy", - "source": "https://github.com/sebastianbergmann/comparator/tree/5.0.1" + "source": "https://github.com/sebastianbergmann/comparator/tree/6.3.1" }, "funding": [ { @@ -2329,33 +2355,33 @@ "type": "github" } ], - "time": "2023-08-14T13:18:12+00:00" + "time": "2025-03-07T06:57:01+00:00" }, { "name": "sebastian/complexity", - "version": "3.2.0", + "version": "4.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/complexity.git", - "reference": "68ff824baeae169ec9f2137158ee529584553799" + "reference": "ee41d384ab1906c68852636b6de493846e13e5a0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/68ff824baeae169ec9f2137158ee529584553799", - "reference": "68ff824baeae169ec9f2137158ee529584553799", + "url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/ee41d384ab1906c68852636b6de493846e13e5a0", + "reference": "ee41d384ab1906c68852636b6de493846e13e5a0", "shasum": "" }, "require": { - "nikic/php-parser": "^4.18 || ^5.0", - "php": ">=8.1" + "nikic/php-parser": "^5.0", + "php": ">=8.2" }, "require-dev": { - "phpunit/phpunit": "^10.0" + "phpunit/phpunit": "^11.0" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "3.2-dev" + "dev-main": "4.0-dev" } }, "autoload": { @@ -2379,7 +2405,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/complexity/issues", "security": "https://github.com/sebastianbergmann/complexity/security/policy", - "source": "https://github.com/sebastianbergmann/complexity/tree/3.2.0" + "source": "https://github.com/sebastianbergmann/complexity/tree/4.0.1" }, "funding": [ { @@ -2387,33 +2413,33 @@ "type": "github" } ], - "time": "2023-12-21T08:37:17+00:00" + "time": "2024-07-03T04:49:50+00:00" }, { "name": "sebastian/diff", - "version": "5.1.1", + "version": "6.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "c41e007b4b62af48218231d6c2275e4c9b975b2e" + "reference": "b4ccd857127db5d41a5b676f24b51371d76d8544" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/c41e007b4b62af48218231d6c2275e4c9b975b2e", - "reference": "c41e007b4b62af48218231d6c2275e4c9b975b2e", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/b4ccd857127db5d41a5b676f24b51371d76d8544", + "reference": "b4ccd857127db5d41a5b676f24b51371d76d8544", "shasum": "" }, "require": { - "php": ">=8.1" + "php": ">=8.2" }, "require-dev": { - "phpunit/phpunit": "^10.0", - "symfony/process": "^6.4" + "phpunit/phpunit": "^11.0", + "symfony/process": "^4.2 || ^5" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "5.1-dev" + "dev-main": "6.0-dev" } }, "autoload": { @@ -2446,7 +2472,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/diff/issues", "security": "https://github.com/sebastianbergmann/diff/security/policy", - "source": "https://github.com/sebastianbergmann/diff/tree/5.1.1" + "source": "https://github.com/sebastianbergmann/diff/tree/6.0.2" }, "funding": [ { @@ -2454,27 +2480,27 @@ "type": "github" } ], - "time": "2024-03-02T07:15:17+00:00" + "time": "2024-07-03T04:53:05+00:00" }, { "name": "sebastian/environment", - "version": "6.1.0", + "version": "7.2.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "8074dbcd93529b357029f5cc5058fd3e43666984" + "reference": "a5c75038693ad2e8d4b6c15ba2403532647830c4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/8074dbcd93529b357029f5cc5058fd3e43666984", - "reference": "8074dbcd93529b357029f5cc5058fd3e43666984", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/a5c75038693ad2e8d4b6c15ba2403532647830c4", + "reference": "a5c75038693ad2e8d4b6c15ba2403532647830c4", "shasum": "" }, "require": { - "php": ">=8.1" + "php": ">=8.2" }, "require-dev": { - "phpunit/phpunit": "^10.0" + "phpunit/phpunit": "^11.3" }, "suggest": { "ext-posix": "*" @@ -2482,7 +2508,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "6.1-dev" + "dev-main": "7.2-dev" } }, "autoload": { @@ -2510,42 +2536,54 @@ "support": { "issues": "https://github.com/sebastianbergmann/environment/issues", "security": "https://github.com/sebastianbergmann/environment/security/policy", - "source": "https://github.com/sebastianbergmann/environment/tree/6.1.0" + "source": "https://github.com/sebastianbergmann/environment/tree/7.2.1" }, "funding": [ { "url": "https://github.com/sebastianbergmann", "type": "github" + }, + { + "url": "https://liberapay.com/sebastianbergmann", + "type": "liberapay" + }, + { + "url": "https://thanks.dev/u/gh/sebastianbergmann", + "type": "thanks_dev" + }, + { + "url": "https://tidelift.com/funding/github/packagist/sebastian/environment", + "type": "tidelift" } ], - "time": "2024-03-23T08:47:14+00:00" + "time": "2025-05-21T11:55:47+00:00" }, { "name": "sebastian/exporter", - "version": "5.1.2", + "version": "6.3.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "955288482d97c19a372d3f31006ab3f37da47adf" + "reference": "3473f61172093b2da7de1fb5782e1f24cc036dc3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/955288482d97c19a372d3f31006ab3f37da47adf", - "reference": "955288482d97c19a372d3f31006ab3f37da47adf", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/3473f61172093b2da7de1fb5782e1f24cc036dc3", + "reference": "3473f61172093b2da7de1fb5782e1f24cc036dc3", "shasum": "" }, "require": { "ext-mbstring": "*", - "php": ">=8.1", - "sebastian/recursion-context": "^5.0" + "php": ">=8.2", + "sebastian/recursion-context": "^6.0" }, "require-dev": { - "phpunit/phpunit": "^10.0" + "phpunit/phpunit": "^11.3" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "5.1-dev" + "dev-main": "6.1-dev" } }, "autoload": { @@ -2588,7 +2626,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/exporter/issues", "security": "https://github.com/sebastianbergmann/exporter/security/policy", - "source": "https://github.com/sebastianbergmann/exporter/tree/5.1.2" + "source": "https://github.com/sebastianbergmann/exporter/tree/6.3.0" }, "funding": [ { @@ -2596,35 +2634,35 @@ "type": "github" } ], - "time": "2024-03-02T07:17:12+00:00" + "time": "2024-12-05T09:17:50+00:00" }, { "name": "sebastian/global-state", - "version": "6.0.2", + "version": "7.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "987bafff24ecc4c9ac418cab1145b96dd6e9cbd9" + "reference": "3be331570a721f9a4b5917f4209773de17f747d7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/987bafff24ecc4c9ac418cab1145b96dd6e9cbd9", - "reference": "987bafff24ecc4c9ac418cab1145b96dd6e9cbd9", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/3be331570a721f9a4b5917f4209773de17f747d7", + "reference": "3be331570a721f9a4b5917f4209773de17f747d7", "shasum": "" }, "require": { - "php": ">=8.1", - "sebastian/object-reflector": "^3.0", - "sebastian/recursion-context": "^5.0" + "php": ">=8.2", + "sebastian/object-reflector": "^4.0", + "sebastian/recursion-context": "^6.0" }, "require-dev": { "ext-dom": "*", - "phpunit/phpunit": "^10.0" + "phpunit/phpunit": "^11.0" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "6.0-dev" + "dev-main": "7.0-dev" } }, "autoload": { @@ -2650,7 +2688,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/global-state/issues", "security": "https://github.com/sebastianbergmann/global-state/security/policy", - "source": "https://github.com/sebastianbergmann/global-state/tree/6.0.2" + "source": "https://github.com/sebastianbergmann/global-state/tree/7.0.2" }, "funding": [ { @@ -2658,33 +2696,33 @@ "type": "github" } ], - "time": "2024-03-02T07:19:19+00:00" + "time": "2024-07-03T04:57:36+00:00" }, { "name": "sebastian/lines-of-code", - "version": "2.0.2", + "version": "3.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/lines-of-code.git", - "reference": "856e7f6a75a84e339195d48c556f23be2ebf75d0" + "reference": "d36ad0d782e5756913e42ad87cb2890f4ffe467a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/856e7f6a75a84e339195d48c556f23be2ebf75d0", - "reference": "856e7f6a75a84e339195d48c556f23be2ebf75d0", + "url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/d36ad0d782e5756913e42ad87cb2890f4ffe467a", + "reference": "d36ad0d782e5756913e42ad87cb2890f4ffe467a", "shasum": "" }, "require": { - "nikic/php-parser": "^4.18 || ^5.0", - "php": ">=8.1" + "nikic/php-parser": "^5.0", + "php": ">=8.2" }, "require-dev": { - "phpunit/phpunit": "^10.0" + "phpunit/phpunit": "^11.0" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "2.0-dev" + "dev-main": "3.0-dev" } }, "autoload": { @@ -2708,7 +2746,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/lines-of-code/issues", "security": "https://github.com/sebastianbergmann/lines-of-code/security/policy", - "source": "https://github.com/sebastianbergmann/lines-of-code/tree/2.0.2" + "source": "https://github.com/sebastianbergmann/lines-of-code/tree/3.0.1" }, "funding": [ { @@ -2716,34 +2754,34 @@ "type": "github" } ], - "time": "2023-12-21T08:38:20+00:00" + "time": "2024-07-03T04:58:38+00:00" }, { "name": "sebastian/object-enumerator", - "version": "5.0.0", + "version": "6.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/object-enumerator.git", - "reference": "202d0e344a580d7f7d04b3fafce6933e59dae906" + "reference": "f5b498e631a74204185071eb41f33f38d64608aa" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/202d0e344a580d7f7d04b3fafce6933e59dae906", - "reference": "202d0e344a580d7f7d04b3fafce6933e59dae906", + "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/f5b498e631a74204185071eb41f33f38d64608aa", + "reference": "f5b498e631a74204185071eb41f33f38d64608aa", "shasum": "" }, "require": { - "php": ">=8.1", - "sebastian/object-reflector": "^3.0", - "sebastian/recursion-context": "^5.0" + "php": ">=8.2", + "sebastian/object-reflector": "^4.0", + "sebastian/recursion-context": "^6.0" }, "require-dev": { - "phpunit/phpunit": "^10.0" + "phpunit/phpunit": "^11.0" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "5.0-dev" + "dev-main": "6.0-dev" } }, "autoload": { @@ -2765,7 +2803,8 @@ "homepage": "https://github.com/sebastianbergmann/object-enumerator/", "support": { "issues": "https://github.com/sebastianbergmann/object-enumerator/issues", - "source": "https://github.com/sebastianbergmann/object-enumerator/tree/5.0.0" + "security": "https://github.com/sebastianbergmann/object-enumerator/security/policy", + "source": "https://github.com/sebastianbergmann/object-enumerator/tree/6.0.1" }, "funding": [ { @@ -2773,32 +2812,32 @@ "type": "github" } ], - "time": "2023-02-03T07:08:32+00:00" + "time": "2024-07-03T05:00:13+00:00" }, { "name": "sebastian/object-reflector", - "version": "3.0.0", + "version": "4.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/object-reflector.git", - "reference": "24ed13d98130f0e7122df55d06c5c4942a577957" + "reference": "6e1a43b411b2ad34146dee7524cb13a068bb35f9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/24ed13d98130f0e7122df55d06c5c4942a577957", - "reference": "24ed13d98130f0e7122df55d06c5c4942a577957", + "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/6e1a43b411b2ad34146dee7524cb13a068bb35f9", + "reference": "6e1a43b411b2ad34146dee7524cb13a068bb35f9", "shasum": "" }, "require": { - "php": ">=8.1" + "php": ">=8.2" }, "require-dev": { - "phpunit/phpunit": "^10.0" + "phpunit/phpunit": "^11.0" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "3.0-dev" + "dev-main": "4.0-dev" } }, "autoload": { @@ -2820,7 +2859,8 @@ "homepage": "https://github.com/sebastianbergmann/object-reflector/", "support": { "issues": "https://github.com/sebastianbergmann/object-reflector/issues", - "source": "https://github.com/sebastianbergmann/object-reflector/tree/3.0.0" + "security": "https://github.com/sebastianbergmann/object-reflector/security/policy", + "source": "https://github.com/sebastianbergmann/object-reflector/tree/4.0.1" }, "funding": [ { @@ -2828,32 +2868,32 @@ "type": "github" } ], - "time": "2023-02-03T07:06:18+00:00" + "time": "2024-07-03T05:01:32+00:00" }, { "name": "sebastian/recursion-context", - "version": "5.0.0", + "version": "6.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/recursion-context.git", - "reference": "05909fb5bc7df4c52992396d0116aed689f93712" + "reference": "694d156164372abbd149a4b85ccda2e4670c0e16" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/05909fb5bc7df4c52992396d0116aed689f93712", - "reference": "05909fb5bc7df4c52992396d0116aed689f93712", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/694d156164372abbd149a4b85ccda2e4670c0e16", + "reference": "694d156164372abbd149a4b85ccda2e4670c0e16", "shasum": "" }, "require": { - "php": ">=8.1" + "php": ">=8.2" }, "require-dev": { - "phpunit/phpunit": "^10.0" + "phpunit/phpunit": "^11.0" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "5.0-dev" + "dev-main": "6.0-dev" } }, "autoload": { @@ -2883,7 +2923,8 @@ "homepage": "https://github.com/sebastianbergmann/recursion-context", "support": { "issues": "https://github.com/sebastianbergmann/recursion-context/issues", - "source": "https://github.com/sebastianbergmann/recursion-context/tree/5.0.0" + "security": "https://github.com/sebastianbergmann/recursion-context/security/policy", + "source": "https://github.com/sebastianbergmann/recursion-context/tree/6.0.2" }, "funding": [ { @@ -2891,32 +2932,32 @@ "type": "github" } ], - "time": "2023-02-03T07:05:40+00:00" + "time": "2024-07-03T05:10:34+00:00" }, { "name": "sebastian/type", - "version": "4.0.0", + "version": "5.1.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/type.git", - "reference": "462699a16464c3944eefc02ebdd77882bd3925bf" + "reference": "a8a7e30534b0eb0c77cd9d07e82de1a114389f5e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/462699a16464c3944eefc02ebdd77882bd3925bf", - "reference": "462699a16464c3944eefc02ebdd77882bd3925bf", + "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/a8a7e30534b0eb0c77cd9d07e82de1a114389f5e", + "reference": "a8a7e30534b0eb0c77cd9d07e82de1a114389f5e", "shasum": "" }, "require": { - "php": ">=8.1" + "php": ">=8.2" }, "require-dev": { - "phpunit/phpunit": "^10.0" + "phpunit/phpunit": "^11.3" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "4.0-dev" + "dev-main": "5.1-dev" } }, "autoload": { @@ -2939,7 +2980,8 @@ "homepage": "https://github.com/sebastianbergmann/type", "support": { "issues": "https://github.com/sebastianbergmann/type/issues", - "source": "https://github.com/sebastianbergmann/type/tree/4.0.0" + "security": "https://github.com/sebastianbergmann/type/security/policy", + "source": "https://github.com/sebastianbergmann/type/tree/5.1.2" }, "funding": [ { @@ -2947,29 +2989,29 @@ "type": "github" } ], - "time": "2023-02-03T07:10:45+00:00" + "time": "2025-03-18T13:35:50+00:00" }, { "name": "sebastian/version", - "version": "4.0.1", + "version": "5.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/version.git", - "reference": "c51fa83a5d8f43f1402e3f32a005e6262244ef17" + "reference": "c687e3387b99f5b03b6caa64c74b63e2936ff874" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/c51fa83a5d8f43f1402e3f32a005e6262244ef17", - "reference": "c51fa83a5d8f43f1402e3f32a005e6262244ef17", + "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/c687e3387b99f5b03b6caa64c74b63e2936ff874", + "reference": "c687e3387b99f5b03b6caa64c74b63e2936ff874", "shasum": "" }, "require": { - "php": ">=8.1" + "php": ">=8.2" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "4.0-dev" + "dev-main": "5.0-dev" } }, "autoload": { @@ -2992,7 +3034,8 @@ "homepage": "https://github.com/sebastianbergmann/version", "support": { "issues": "https://github.com/sebastianbergmann/version/issues", - "source": "https://github.com/sebastianbergmann/version/tree/4.0.1" + "security": "https://github.com/sebastianbergmann/version/security/policy", + "source": "https://github.com/sebastianbergmann/version/tree/5.0.2" }, "funding": [ { @@ -3000,51 +3043,103 @@ "type": "github" } ], - "time": "2023-02-07T11:34:05+00:00" + "time": "2024-10-09T05:16:32+00:00" + }, + { + "name": "staabm/side-effects-detector", + "version": "1.0.5", + "source": { + "type": "git", + "url": "https://github.com/staabm/side-effects-detector.git", + "reference": "d8334211a140ce329c13726d4a715adbddd0a163" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/staabm/side-effects-detector/zipball/d8334211a140ce329c13726d4a715adbddd0a163", + "reference": "d8334211a140ce329c13726d4a715adbddd0a163", + "shasum": "" + }, + "require": { + "ext-tokenizer": "*", + "php": "^7.4 || ^8.0" + }, + "require-dev": { + "phpstan/extension-installer": "^1.4.3", + "phpstan/phpstan": "^1.12.6", + "phpunit/phpunit": "^9.6.21", + "symfony/var-dumper": "^5.4.43", + "tomasvotruba/type-coverage": "1.0.0", + "tomasvotruba/unused-public": "1.0.0" + }, + "type": "library", + "autoload": { + "classmap": [ + "lib/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "A static analysis tool to detect side effects in PHP code", + "keywords": [ + "static analysis" + ], + "support": { + "issues": "https://github.com/staabm/side-effects-detector/issues", + "source": "https://github.com/staabm/side-effects-detector/tree/1.0.5" + }, + "funding": [ + { + "url": "https://github.com/staabm", + "type": "github" + } + ], + "time": "2024-10-20T05:08:20+00:00" }, { "name": "symfony/console", - "version": "v6.4.15", + "version": "v7.3.1", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "f1fc6f47283e27336e7cebb9e8946c8de7bff9bd" + "reference": "9e27aecde8f506ba0fd1d9989620c04a87697101" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/f1fc6f47283e27336e7cebb9e8946c8de7bff9bd", - "reference": "f1fc6f47283e27336e7cebb9e8946c8de7bff9bd", + "url": "https://api.github.com/repos/symfony/console/zipball/9e27aecde8f506ba0fd1d9989620c04a87697101", + "reference": "9e27aecde8f506ba0fd1d9989620c04a87697101", "shasum": "" }, "require": { - "php": ">=8.1", + "php": ">=8.2", "symfony/deprecation-contracts": "^2.5|^3", "symfony/polyfill-mbstring": "~1.0", "symfony/service-contracts": "^2.5|^3", - "symfony/string": "^5.4|^6.0|^7.0" + "symfony/string": "^7.2" }, "conflict": { - "symfony/dependency-injection": "<5.4", - "symfony/dotenv": "<5.4", - "symfony/event-dispatcher": "<5.4", - "symfony/lock": "<5.4", - "symfony/process": "<5.4" + "symfony/dependency-injection": "<6.4", + "symfony/dotenv": "<6.4", + "symfony/event-dispatcher": "<6.4", + "symfony/lock": "<6.4", + "symfony/process": "<6.4" }, "provide": { "psr/log-implementation": "1.0|2.0|3.0" }, "require-dev": { "psr/log": "^1|^2|^3", - "symfony/config": "^5.4|^6.0|^7.0", - "symfony/dependency-injection": "^5.4|^6.0|^7.0", - "symfony/event-dispatcher": "^5.4|^6.0|^7.0", + "symfony/config": "^6.4|^7.0", + "symfony/dependency-injection": "^6.4|^7.0", + "symfony/event-dispatcher": "^6.4|^7.0", "symfony/http-foundation": "^6.4|^7.0", "symfony/http-kernel": "^6.4|^7.0", - "symfony/lock": "^5.4|^6.0|^7.0", - "symfony/messenger": "^5.4|^6.0|^7.0", - "symfony/process": "^5.4|^6.0|^7.0", - "symfony/stopwatch": "^5.4|^6.0|^7.0", - "symfony/var-dumper": "^5.4|^6.0|^7.0" + "symfony/lock": "^6.4|^7.0", + "symfony/messenger": "^6.4|^7.0", + "symfony/process": "^6.4|^7.0", + "symfony/stopwatch": "^6.4|^7.0", + "symfony/var-dumper": "^6.4|^7.0" }, "type": "library", "autoload": { @@ -3078,7 +3173,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v6.4.15" + "source": "https://github.com/symfony/console/tree/v7.3.1" }, "funding": [ { @@ -3094,11 +3189,11 @@ "type": "tidelift" } ], - "time": "2024-11-06T14:19:14+00:00" + "time": "2025-06-27T19:55:54+00:00" }, { "name": "symfony/polyfill-intl-grapheme", - "version": "v1.31.0", + "version": "v1.32.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-grapheme.git", @@ -3119,8 +3214,8 @@ "type": "library", "extra": { "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" } }, "autoload": { @@ -3156,7 +3251,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.31.0" + "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.32.0" }, "funding": [ { @@ -3176,7 +3271,7 @@ }, { "name": "symfony/polyfill-intl-normalizer", - "version": "v1.31.0", + "version": "v1.32.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-normalizer.git", @@ -3197,8 +3292,8 @@ "type": "library", "extra": { "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" } }, "autoload": { @@ -3237,7 +3332,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.31.0" + "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.32.0" }, "funding": [ { @@ -3257,16 +3352,16 @@ }, { "name": "symfony/service-contracts", - "version": "v3.5.1", + "version": "v3.6.0", "source": { "type": "git", "url": "https://github.com/symfony/service-contracts.git", - "reference": "e53260aabf78fb3d63f8d79d69ece59f80d5eda0" + "reference": "f021b05a130d35510bd6b25fe9053c2a8a15d5d4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/service-contracts/zipball/e53260aabf78fb3d63f8d79d69ece59f80d5eda0", - "reference": "e53260aabf78fb3d63f8d79d69ece59f80d5eda0", + "url": "https://api.github.com/repos/symfony/service-contracts/zipball/f021b05a130d35510bd6b25fe9053c2a8a15d5d4", + "reference": "f021b05a130d35510bd6b25fe9053c2a8a15d5d4", "shasum": "" }, "require": { @@ -3279,12 +3374,12 @@ }, "type": "library", "extra": { - "branch-alias": { - "dev-main": "3.5-dev" - }, "thanks": { - "name": "symfony/contracts", - "url": "https://github.com/symfony/contracts" + "url": "https://github.com/symfony/contracts", + "name": "symfony/contracts" + }, + "branch-alias": { + "dev-main": "3.6-dev" } }, "autoload": { @@ -3320,7 +3415,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/service-contracts/tree/v3.5.1" + "source": "https://github.com/symfony/service-contracts/tree/v3.6.0" }, "funding": [ { @@ -3336,24 +3431,24 @@ "type": "tidelift" } ], - "time": "2024-09-25T14:20:29+00:00" + "time": "2025-04-25T09:37:31+00:00" }, { "name": "symfony/string", - "version": "v6.4.15", + "version": "v7.3.0", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "73a5e66ea2e1677c98d4449177c5a9cf9d8b4c6f" + "reference": "f3570b8c61ca887a9e2938e85cb6458515d2b125" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/73a5e66ea2e1677c98d4449177c5a9cf9d8b4c6f", - "reference": "73a5e66ea2e1677c98d4449177c5a9cf9d8b4c6f", + "url": "https://api.github.com/repos/symfony/string/zipball/f3570b8c61ca887a9e2938e85cb6458515d2b125", + "reference": "f3570b8c61ca887a9e2938e85cb6458515d2b125", "shasum": "" }, "require": { - "php": ">=8.1", + "php": ">=8.2", "symfony/polyfill-ctype": "~1.8", "symfony/polyfill-intl-grapheme": "~1.0", "symfony/polyfill-intl-normalizer": "~1.0", @@ -3363,11 +3458,12 @@ "symfony/translation-contracts": "<2.5" }, "require-dev": { - "symfony/error-handler": "^5.4|^6.0|^7.0", - "symfony/http-client": "^5.4|^6.0|^7.0", - "symfony/intl": "^6.2|^7.0", + "symfony/emoji": "^7.1", + "symfony/error-handler": "^6.4|^7.0", + "symfony/http-client": "^6.4|^7.0", + "symfony/intl": "^6.4|^7.0", "symfony/translation-contracts": "^2.5|^3.0", - "symfony/var-exporter": "^5.4|^6.0|^7.0" + "symfony/var-exporter": "^6.4|^7.0" }, "type": "library", "autoload": { @@ -3406,7 +3502,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v6.4.15" + "source": "https://github.com/symfony/string/tree/v7.3.0" }, "funding": [ { @@ -3422,32 +3518,32 @@ "type": "tidelift" } ], - "time": "2024-11-13T13:31:12+00:00" + "time": "2025-04-20T20:19:01+00:00" }, { "name": "symfony/yaml", - "version": "v6.4.13", + "version": "v7.3.1", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "e99b4e94d124b29ee4cf3140e1b537d2dad8cec9" + "reference": "0c3555045a46ab3cd4cc5a69d161225195230edb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/e99b4e94d124b29ee4cf3140e1b537d2dad8cec9", - "reference": "e99b4e94d124b29ee4cf3140e1b537d2dad8cec9", + "url": "https://api.github.com/repos/symfony/yaml/zipball/0c3555045a46ab3cd4cc5a69d161225195230edb", + "reference": "0c3555045a46ab3cd4cc5a69d161225195230edb", "shasum": "" }, "require": { - "php": ">=8.1", - "symfony/deprecation-contracts": "^2.5|^3", + "php": ">=8.2", + "symfony/deprecation-contracts": "^2.5|^3.0", "symfony/polyfill-ctype": "^1.8" }, "conflict": { - "symfony/console": "<5.4" + "symfony/console": "<6.4" }, "require-dev": { - "symfony/console": "^5.4|^6.0|^7.0" + "symfony/console": "^6.4|^7.0" }, "bin": [ "Resources/bin/yaml-lint" @@ -3478,7 +3574,7 @@ "description": "Loads and dumps YAML files", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/yaml/tree/v6.4.13" + "source": "https://github.com/symfony/yaml/tree/v7.3.1" }, "funding": [ { @@ -3494,7 +3590,7 @@ "type": "tidelift" } ], - "time": "2024-09-25T14:18:03+00:00" + "time": "2025-06-03T06:57:57+00:00" }, { "name": "theseer/autoload", @@ -3791,7 +3887,7 @@ ], "aliases": [], "minimum-stability": "stable", - "stability-flags": [], + "stability-flags": {}, "prefer-stable": false, "prefer-lowest": false, "platform": { @@ -3799,6 +3895,6 @@ "ext-json": "*", "ext-curl": "*" }, - "platform-dev": [], - "plugin-api-version": "2.3.0" + "platform-dev": {}, + "plugin-api-version": "2.6.0" } diff --git a/src/PHPDraft/In/Tests/ApibFileParserTest.php b/src/PHPDraft/In/Tests/ApibFileParserTest.php index e4e12f6..c4484cf 100644 --- a/src/PHPDraft/In/Tests/ApibFileParserTest.php +++ b/src/PHPDraft/In/Tests/ApibFileParserTest.php @@ -9,23 +9,20 @@ namespace PHPDraft\In\Tests; -use Lunr\Halo\LunrBaseTest; +use Lunr\Halo\LunrBaseTestCase; use PHPDraft\In\ApibFileParser; -use ReflectionClass; +use PHPUnit\Framework\Attributes\CoversClass; /** * Class ApibFileParserTest - * @covers \PHPDraft\In\ApibFileParser */ -class ApibFileParserTest extends LunrBaseTest +#[CoversClass(ApibFileParser::class)] +class ApibFileParserTest extends LunrBaseTestCase { - private ApibFileParser $class; /** * Set up tests. - * - * @return void Test is now set up. */ public function setUp(): void { @@ -35,7 +32,6 @@ public function setUp(): void /** * Test if setup is successful - * @return void */ public function testLocationSetup(): void { @@ -44,7 +40,6 @@ public function testLocationSetup(): void /** * Test if setup is successful - * @return void */ public function testFilenameSetup(): void { @@ -53,8 +48,6 @@ public function testFilenameSetup(): void /** * Test if exception when the file doesn't exist - * - * @return void */ public function testFilenameSetupWrong(): void { @@ -62,25 +55,24 @@ public function testFilenameSetupWrong(): void $this->expectExceptionMessageMatches('/API File not found: .*\/drafter\/non_existing_including_apib/'); $this->expectExceptionCode(1); - $this->set_reflection_property_value('filename', TEST_STATICS . '/drafter/non_existing_including_apib'); + $this->setReflectionPropertyValue('filename', TEST_STATICS . '/drafter/non_existing_including_apib'); $this->class->parse(); } /** * Test if setup is successful - * @return void */ public function testParseBasic(): void { - $this->set_reflection_property_value('filename', TEST_STATICS . '/drafter/apib/including.apib'); - $this->set_reflection_property_value('location', TEST_STATICS . '/drafter/apib/'); + $this->setReflectionPropertyValue('filename', TEST_STATICS . '/drafter/apib/including.apib'); + $this->setReflectionPropertyValue('location', TEST_STATICS . '/drafter/apib/'); - $this->mock_function('curl_exec', fn() => 'hello'); + $this->mockFunction('curl_exec', fn() => 'hello'); $this->class->parse(); - $this->unmock_function('curl_exec'); + $this->unmockFunction('curl_exec'); $text = "FORMAT: 1A\nHOST: https://owner-api.teslamotors.com\n"; $text .= "EXTRA_HOSTS: https://test.owner-api.teslamotors.com\nSOMETHING: INFO\n\n"; @@ -95,12 +87,10 @@ public function testParseBasic(): void /** * Test setting content - * - * @covers \PHPDraft\In\ApibFileParser::set_apib_content */ public function testSetContent(): void { $this->class->set_apib_content('content'); - $this->assertEquals('content', $this->get_reflection_property_value('full_apib')); + $this->assertEquals('content', $this->getReflectionPropertyValue('full_apib')); } } diff --git a/src/PHPDraft/Model/Elements/BasicStructureElement.php b/src/PHPDraft/Model/Elements/BasicStructureElement.php index c20f0fd..985ee86 100644 --- a/src/PHPDraft/Model/Elements/BasicStructureElement.php +++ b/src/PHPDraft/Model/Elements/BasicStructureElement.php @@ -8,8 +8,6 @@ namespace PHPDraft\Model\Elements; -use Stringable; - abstract class BasicStructureElement implements StructureElement { /** diff --git a/src/PHPDraft/Model/Elements/ElementStructureElement.php b/src/PHPDraft/Model/Elements/ElementStructureElement.php index 27593ac..707f7b5 100644 --- a/src/PHPDraft/Model/Elements/ElementStructureElement.php +++ b/src/PHPDraft/Model/Elements/ElementStructureElement.php @@ -2,8 +2,6 @@ namespace PHPDraft\Model\Elements; -use Stringable; - class ElementStructureElement implements StructureElement { /** diff --git a/src/PHPDraft/Model/Elements/ObjectStructureElement.php b/src/PHPDraft/Model/Elements/ObjectStructureElement.php index f0ac049..edbeb6c 100644 --- a/src/PHPDraft/Model/Elements/ObjectStructureElement.php +++ b/src/PHPDraft/Model/Elements/ObjectStructureElement.php @@ -88,7 +88,7 @@ public function parse(?object $object, array &$dependencies): self * * @return void */ - protected function parse_value_structure(object $object, array &$dependencies) + protected function parse_value_structure(object $object, array &$dependencies): void { if (isset($object->content->content) || in_array($this->element, ['boolean', 'string', 'number', 'ref'], true)) { return; diff --git a/src/PHPDraft/Model/Elements/Tests/ArrayStructureElementTest.php b/src/PHPDraft/Model/Elements/Tests/ArrayStructureElementTest.php index 0153b44..89e07e5 100644 --- a/src/PHPDraft/Model/Elements/Tests/ArrayStructureElementTest.php +++ b/src/PHPDraft/Model/Elements/Tests/ArrayStructureElementTest.php @@ -9,16 +9,20 @@ namespace PHPDraft\Model\Elements\Tests; -use Lunr\Halo\LunrBaseTest; +use Lunr\Halo\LunrBaseTestCase; use PHPDraft\Model\Elements\ArrayStructureElement; use PHPDraft\Model\Elements\ElementStructureElement; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\DataProvider; /** * Class ArrayStructureTest - * @covers \PHPDraft\Model\Elements\ArrayStructureElement */ -class ArrayStructureElementTest extends LunrBaseTest +#[CoversClass(ArrayStructureElement::class)] +class ArrayStructureElementTest extends LunrBaseTestCase { + private ArrayStructureElement $class; + /** * Set up tests * @@ -33,13 +37,10 @@ public function setUp(): void /** * Parse different objects * - * @dataProvider parseObjectProvider - * * @param string $object JSON Object * @param ArrayStructureElement $expected Expected Object output - * - * @covers \PHPDraft\Model\Elements\ArrayStructureElement::parse */ + #[DataProvider('parseObjectProvider')] public function testSuccessfulParse(string $object, ArrayStructureElement $expected): void { $dep = []; @@ -179,7 +180,7 @@ public static function parseObjectProvider(): array */ public function testNewInstance(): void { - $method = $this->get_reflection_method('new_instance'); + $method = $this->getReflectionMethod('new_instance'); $return = $method->invoke($this->class); $this->assertInstanceOf(ArrayStructureElement::class, $return); } diff --git a/src/PHPDraft/Model/Elements/Tests/BasicStructureElementTest.php b/src/PHPDraft/Model/Elements/Tests/BasicStructureElementTest.php index 4fd7806..6f31468 100644 --- a/src/PHPDraft/Model/Elements/Tests/BasicStructureElementTest.php +++ b/src/PHPDraft/Model/Elements/Tests/BasicStructureElementTest.php @@ -9,31 +9,44 @@ namespace PHPDraft\Model\Elements\Tests; -use Lunr\Halo\LunrBaseTest; +use Lunr\Halo\LunrBaseTestCase; use PHPDraft\Model\Elements\ArrayStructureElement; use PHPDraft\Model\Elements\BasicStructureElement; use PHPDraft\Model\Elements\ElementStructureElement; use PHPDraft\Model\Elements\ObjectStructureElement; -use ReflectionClass; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\DataProvider; /** * Class BasicStructureElementTest - * @covers \PHPDraft\Model\Elements\BasicStructureElement */ -class BasicStructureElementTest extends LunrBaseTest +#[CoversClass(BasicStructureElement::class)] +class BasicStructureElementTest extends LunrBaseTestCase { private BasicStructureElement $class; /** * Set up tests - * - * @return void */ public function setUp(): void { - $this->class = $this->getMockBuilder('\PHPDraft\Model\Elements\BasicStructureElement') - ->disableOriginalConstructor() - ->getMockForAbstractClass(); + $this->class = new class extends BasicStructureElement { + public function parse(?object $object, array &$dependencies): BasicStructureElement + { + return $this; + } + + public function __toString(): string + { + return ''; + } + + protected function new_instance(): BasicStructureElement + { + return new self(); + } + }; + $this->baseSetUp($this->class); } @@ -42,24 +55,23 @@ public function setUp(): void */ public function testSetupCorrectly(): void { - $this->assertPropertyEquals('element', NULL); + $this->assertPropertyEquals('element', null); } /** * Test if the value the class is initialized with is correct * - * @dataProvider stringValueProvider - * * @param mixed $value Value to set to the class * @param mixed $string_value Expected string representation */ + #[DataProvider('stringValueProvider')] public function testStringValue(mixed $value, mixed $string_value): void { - $this->set_reflection_property_value('value', $value); + $this->setReflectionPropertyValue('value', $value); - $this->mock_function('rand', fn() => 0); + $this->mockFunction('rand', fn() => 0); $return = $this->class->string_value(); - $this->unmock_function('rand'); + $this->unmockFunction('rand'); $this->assertSame($string_value, $return); } @@ -101,7 +113,7 @@ public function testParseCommonDeps(): void $answer->type = 'cat'; $answer->description = null; - $method = $this->get_reflection_method('parse_common'); + $method = $this->getReflectionMethod('parse_common'); $method->invokeArgs($this->class, [json_decode($json), &$dep]); $this->assertEquals($answer->key, $this->class->key); @@ -114,15 +126,14 @@ public function testParseCommonDeps(): void /** * Test if the value the class is initialized with is correct * - * @dataProvider parseValueProvider - * * @param mixed $value Value to set to the class * @param BasicStructureElement $expected_value Expected string representation */ - public function testParseCommon($value, BasicStructureElement $expected_value): void + #[DataProvider('parseValueProvider')] + public function testParseCommon(mixed $value, BasicStructureElement $expected_value): void { $dep = []; - $method = $this->get_reflection_method('parse_common'); + $method = $this->getReflectionMethod('parse_common'); $method->invokeArgs($this->class, [$value, &$dep]); $this->assertEquals($expected_value->key, $this->class->key); diff --git a/src/PHPDraft/Model/Elements/Tests/ElementStructureElementTest.php b/src/PHPDraft/Model/Elements/Tests/ElementStructureElementTest.php index 1031870..958367f 100644 --- a/src/PHPDraft/Model/Elements/Tests/ElementStructureElementTest.php +++ b/src/PHPDraft/Model/Elements/Tests/ElementStructureElementTest.php @@ -2,15 +2,15 @@ namespace PHPDraft\Model\Elements\Tests; -use Lunr\Halo\LunrBaseTest; +use Lunr\Halo\LunrBaseTestCase; use PHPDraft\Model\Elements\ElementStructureElement; -use ReflectionClass; +use PHPUnit\Framework\Attributes\CoversClass; /** * Class ElementStructureElementTest - * @covers \PHPDraft\Model\Elements\ElementStructureElement */ -class ElementStructureElementTest extends LunrBaseTest +#[CoversClass(ElementStructureElement::class)] +class ElementStructureElementTest extends LunrBaseTestCase { private ElementStructureElement $class; @@ -32,9 +32,6 @@ public function tearDown(): void unset($this->reflection); } - /** - * @covers \PHPDraft\Model\Elements\ElementStructureElement::parse - */ public function testParse(): void { $json = '{"element": "Cow", "content": "stuff", "meta": {"description": {"content": "desc"}}}'; @@ -47,69 +44,51 @@ public function testParse(): void $this->assertSame(['Cow'], $dep); } - /** - * @covers \PHPDraft\Model\Elements\ElementStructureElement::string_value - */ public function testStringValue(): void { - $this->set_reflection_property_value('type', 'string'); - $this->set_reflection_property_value('description', null); + $this->setReflectionPropertyValue('type', 'string'); + $this->setReflectionPropertyValue('description', null); $this->assertSame('
  • string
  • ', $this->class->string_value()); } - /** - * @covers \PHPDraft\Model\Elements\ElementStructureElement::__toString - */ public function testToString(): void { - $this->set_reflection_property_value('type', 'string'); - $this->set_reflection_property_value('description', null); + $this->setReflectionPropertyValue('type', 'string'); + $this->setReflectionPropertyValue('description', null); $this->assertSame('
  • string
  • ', $this->class->__toString()); } - /** - * @covers \PHPDraft\Model\Elements\ElementStructureElement::__toString - */ public function testToStringCustomType(): void { - $this->set_reflection_property_value('type', 'Cow'); - $this->set_reflection_property_value('description', null); + $this->setReflectionPropertyValue('type', 'Cow'); + $this->setReflectionPropertyValue('description', null); $this->assertSame('
  • Cow
  • ', $this->class->__toString()); } - /** - * @covers \PHPDraft\Model\Elements\ElementStructureElement::__toString - */ public function testToStringDescription(): void { - $this->set_reflection_property_value('type', 'Cow'); - $this->set_reflection_property_value('description', 'Something'); + $this->setReflectionPropertyValue('type', 'Cow'); + $this->setReflectionPropertyValue('description', 'Something'); $this->assertSame('
  • Cow - Something
  • ', $this->class->__toString()); } - /** - * @covers \PHPDraft\Model\Elements\ElementStructureElement::__toString - */ public function testToStringValue(): void { - $this->set_reflection_property_value('type', 'Cow'); - $this->set_reflection_property_value('value', 'stuff'); - $this->set_reflection_property_value('description', null); + $this->setReflectionPropertyValue('type', 'Cow'); + $this->setReflectionPropertyValue('value', 'stuff'); + $this->setReflectionPropertyValue('description', null); $this->assertSame('
  • Cow - stuff
  • ', $this->class->__toString()); } - /** - * @covers \PHPDraft\Model\Elements\ElementStructureElement::__toString - */ public function testToStringDescriptionAndValue(): void { - $this->set_reflection_property_value('type', 'Cow'); - $this->set_reflection_property_value('value', 'stuff'); - $this->set_reflection_property_value('description', 'Something'); + $this->setReflectionPropertyValue('type', 'Cow'); + $this->setReflectionPropertyValue('value', 'stuff'); + $this->setReflectionPropertyValue('description', 'Something'); $this->assertSame('
  • Cow - Something - stuff
  • ', $this->class->__toString()); } diff --git a/src/PHPDraft/Model/Elements/Tests/EnumStructureElementTest.php b/src/PHPDraft/Model/Elements/Tests/EnumStructureElementTest.php index 537a4b0..0bc671c 100644 --- a/src/PHPDraft/Model/Elements/Tests/EnumStructureElementTest.php +++ b/src/PHPDraft/Model/Elements/Tests/EnumStructureElementTest.php @@ -9,16 +9,20 @@ namespace PHPDraft\Model\Elements\Tests; -use Lunr\Halo\LunrBaseTest; +use Lunr\Halo\LunrBaseTestCase; use PHPDraft\Model\Elements\ElementStructureElement; use PHPDraft\Model\Elements\EnumStructureElement; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\DataProvider; /** * Class EnumStructureElementTest - * @covers \PHPDraft\Model\Elements\EnumStructureElement */ -class EnumStructureElementTest extends LunrBaseTest +#[CoversClass(EnumStructureElement::class)] +class EnumStructureElementTest extends LunrBaseTestCase { + private EnumStructureElement $class; + /** * Set up tests * @return void @@ -34,7 +38,7 @@ public function setUp(): void */ public function testSetupCorrectly(): void { - $this->assertPropertyEquals('element', NULL); + $this->assertPropertyEquals('element', null); } /** @@ -42,7 +46,7 @@ public function testSetupCorrectly(): void */ public function testNewInstance(): void { - $method = $this->get_reflection_method('new_instance'); + $method = $this->getReflectionMethod('new_instance'); $return = $method->invoke($this->class); $this->assertInstanceOf(EnumStructureElement::class, $return); } @@ -52,7 +56,7 @@ public function testNewInstance(): void */ public function testToStringWithArray(): void { - $this->set_reflection_property_value('description', null); + $this->setReflectionPropertyValue('description', null); $value1 = new ElementStructureElement(); $value1->value = 'hello'; @@ -101,7 +105,7 @@ public function testToStringWithStringComplex(): void */ public function testToStringWithComplexArray(): void { - $this->set_reflection_property_value('description', null); + $this->setReflectionPropertyValue('description', null); $value1 = new ElementStructureElement(); $value1->value = 'hello'; @@ -119,13 +123,10 @@ public function testToStringWithComplexArray(): void /** * Parse different objects * - * @dataProvider parseObjectProvider - * * @param string $object JSON Object * @param EnumStructureElement $expected Expected Object output - * - * @covers \PHPDraft\Model\Elements\EnumStructureElement::parse */ + #[DataProvider('parseObjectProvider')] public function testSuccessfulParse(string $object, EnumStructureElement $expected): void { $dep = []; diff --git a/src/PHPDraft/Model/Elements/Tests/ObjectStructureElementTest.php b/src/PHPDraft/Model/Elements/Tests/ObjectStructureElementTest.php index 193072c..b86bf49 100644 --- a/src/PHPDraft/Model/Elements/Tests/ObjectStructureElementTest.php +++ b/src/PHPDraft/Model/Elements/Tests/ObjectStructureElementTest.php @@ -9,19 +9,19 @@ namespace PHPDraft\Model\Elements\Tests; -use Lunr\Halo\LunrBaseTest; +use Lunr\Halo\LunrBaseTestCase; use PHPDraft\Model\Elements\ArrayStructureElement; use PHPDraft\Model\Elements\ElementStructureElement; use PHPDraft\Model\Elements\EnumStructureElement; use PHPDraft\Model\Elements\ObjectStructureElement; -use ReflectionClass; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\DataProvider; /** * Class ObjectStructureElementTest - * - * @covers \PHPDraft\Model\Elements\ObjectStructureElement */ -class ObjectStructureElementTest extends LunrBaseTest +#[CoversClass(ObjectStructureElement::class)] +class ObjectStructureElementTest extends LunrBaseTestCase { private ObjectStructureElement $class; @@ -38,12 +38,10 @@ public function setUp(): void /** * Test the setup of new instances - * - * @covers \PHPDraft\Model\Elements\ObjectStructureElement::new_instance */ public function testNewInstance(): void { - $method = $this->get_reflection_method('new_instance'); + $method = $this->getReflectionMethod('new_instance'); $return = $method->invoke($this->class); $this->assertInstanceOf(ObjectStructureElement::class, $return); } @@ -51,13 +49,10 @@ public function testNewInstance(): void /** * Parse different objects * - * @dataProvider parseObjectProvider - * * @param string $object JSON Object * @param ObjectStructureElement $expected Expected Object output - * - * @covers \PHPDraft\Model\Elements\ObjectStructureElement::parse */ + #[DataProvider('parseObjectProvider')] public function testSuccessfulParse(string $object, ObjectStructureElement $expected): void { $dep = []; @@ -203,8 +198,6 @@ public static function parseObjectProvider(): array /** * Test the setup of new instances - * - * @covers \PHPDraft\Model\Elements\ObjectStructureElement::parse */ public function testEmptyParse(): void { @@ -219,8 +212,6 @@ public function testEmptyParse(): void /** * Test the setup of new instances - * - * @covers \PHPDraft\Model\Elements\ObjectStructureElement::parse */ public function testArrayContentEnumContentParse(): void { @@ -236,8 +227,6 @@ public function testArrayContentEnumContentParse(): void /** * Test the setup of new instances - * - * @covers \PHPDraft\Model\Elements\ObjectStructureElement::parse */ public function testArrayContentObjectContentParse(): void { @@ -253,8 +242,6 @@ public function testArrayContentObjectContentParse(): void /** * Test the setup of new instances - * - * @covers \PHPDraft\Model\Elements\ObjectStructureElement::parse */ public function testValueStructureEnumContentParse(): void { @@ -268,8 +255,6 @@ public function testValueStructureEnumContentParse(): void /** * Test the setup of new instances - * - * @covers \PHPDraft\Model\Elements\ObjectStructureElement::parse */ public function testValueStructureArrayContentParse(): void { @@ -283,8 +268,6 @@ public function testValueStructureArrayContentParse(): void /** * Test the setup of new instances - * - * @covers \PHPDraft\Model\Elements\ObjectStructureElement::parse */ public function testValueStructureObjectContentParse(): void { @@ -298,8 +281,6 @@ public function testValueStructureObjectContentParse(): void /** * Test the setup of new instances - * - * @covers \PHPDraft\Model\Elements\ObjectStructureElement::parse */ public function testValueStructureObjectContentParseContent(): void { @@ -339,12 +320,10 @@ public function testValueStructureObjectContentParseContent(): void /** * Test the setup of new instances - * - * @covers \PHPDraft\Model\Elements\ObjectStructureElement::__toString */ public function testToStringBasic(): void { - $this->set_reflection_property_value('description', null); + $this->setReflectionPropertyValue('description', null); $return = $this->class->__toString(); $this->assertSame('{ }', $return); @@ -352,8 +331,6 @@ public function testToStringBasic(): void /** * Test the setup of new instances - * - * @covers \PHPDraft\Model\Elements\ObjectStructureElement::__toString */ public function testToStringArray(): void { @@ -371,8 +348,6 @@ public function testToStringArray(): void /** * Test the setup of new instances - * - * @covers \PHPDraft\Model\Elements\ObjectStructureElement::__toString */ public function testToStringNullValue(): void { @@ -386,8 +361,6 @@ public function testToStringNullValue(): void /** * Test the setup of new instances - * - * @covers \PHPDraft\Model\Elements\ObjectStructureElement::__toString */ public function testToStringObjectValue(): void { @@ -401,8 +374,6 @@ public function testToStringObjectValue(): void /** * Test the setup of new instances - * - * @covers \PHPDraft\Model\Elements\ObjectStructureElement::__toString */ public function testToStringArrayValue(): void { @@ -418,8 +389,6 @@ public function testToStringArrayValue(): void /** * Test the setup of new instances - * - * @covers \PHPDraft\Model\Elements\ObjectStructureElement::__toString */ public function testToStringEnumValue(): void { @@ -439,8 +408,6 @@ public function testToStringEnumValue(): void /** * Test the setup of new instances - * - * @covers \PHPDraft\Model\Elements\ObjectStructureElement::__toString */ public function testToStringBoolValue(): void { @@ -454,8 +421,6 @@ public function testToStringBoolValue(): void /** * Test the setup of new instances - * - * @covers \PHPDraft\Model\Elements\ObjectStructureElement::__toString */ public function testToStringOtherValue(): void { @@ -469,8 +434,6 @@ public function testToStringOtherValue(): void /** * Test the setup of new instances - * - * @covers \PHPDraft\Model\Elements\ObjectStructureElement::__toString */ public function testToStringOtherValueTypeKnown(): void { diff --git a/src/PHPDraft/Model/Elements/Tests/RequestBodyElementTest.php b/src/PHPDraft/Model/Elements/Tests/RequestBodyElementTest.php index 334fe1d..3f4d484 100644 --- a/src/PHPDraft/Model/Elements/Tests/RequestBodyElementTest.php +++ b/src/PHPDraft/Model/Elements/Tests/RequestBodyElementTest.php @@ -9,19 +9,23 @@ namespace PHPDraft\Model\Elements\Tests; -use Lunr\Halo\LunrBaseTest; +use Lunr\Halo\LunrBaseTestCase; use PHPDraft\Model\Elements\ArrayStructureElement; use PHPDraft\Model\Elements\ElementStructureElement; use PHPDraft\Model\Elements\EnumStructureElement; use PHPDraft\Model\Elements\ObjectStructureElement; use PHPDraft\Model\Elements\RequestBodyElement; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\DataProvider; /** * Class RequestBodyElementTest - * @covers \PHPDraft\Model\Elements\RequestBodyElement */ -class RequestBodyElementTest extends LunrBaseTest +#[CoversClass(RequestBodyElement::class)] +class RequestBodyElementTest extends LunrBaseTestCase { + private RequestBodyElement $class; + /** * Set up tests * @return void @@ -37,7 +41,7 @@ public function setUp(): void */ public function testSetupCorrectly(): void { - $this->assertPropertyEquals('element', NULL); + $this->assertPropertyEquals('element', null); } /** @@ -45,7 +49,7 @@ public function testSetupCorrectly(): void */ public function testNewInstance(): void { - $method = $this->get_reflection_method('new_instance'); + $method = $this->getReflectionMethod('new_instance'); $return = $method->invoke($this->class); $this->assertInstanceOf(RequestBodyElement::class, $return); @@ -110,13 +114,10 @@ public function testPrintJsonArray(): void /** * Parse different objects * - * @dataProvider parseObjectProvider - * * @param string $object JSON Object * @param ObjectStructureElement $expected Expected Object output - * - * @covers \PHPDraft\Model\Elements\ObjectStructureElement::parse */ + #[DataProvider('parseObjectProvider')] public function testSuccessfulParse(string $object, ObjectStructureElement $expected): void { $dep = []; diff --git a/src/PHPDraft/Model/HTTPRequest.php b/src/PHPDraft/Model/HTTPRequest.php index cc2d378..25bed17 100644 --- a/src/PHPDraft/Model/HTTPRequest.php +++ b/src/PHPDraft/Model/HTTPRequest.php @@ -44,7 +44,7 @@ class HTTPRequest implements Comparable * * @var string|null */ - public ?string $description = NULL; + public ?string $description = null; /** * Parent class. diff --git a/src/PHPDraft/Model/HierarchyElement.php b/src/PHPDraft/Model/HierarchyElement.php index a2d2790..3f53efe 100644 --- a/src/PHPDraft/Model/HierarchyElement.php +++ b/src/PHPDraft/Model/HierarchyElement.php @@ -29,7 +29,7 @@ abstract class HierarchyElement * * @var string|null */ - public ?string $description = NULL; + public ?string $description = null; /** * Child elements. diff --git a/src/PHPDraft/Model/Tests/CategoryTest.php b/src/PHPDraft/Model/Tests/CategoryTest.php index 6ac956f..424140a 100644 --- a/src/PHPDraft/Model/Tests/CategoryTest.php +++ b/src/PHPDraft/Model/Tests/CategoryTest.php @@ -10,12 +10,12 @@ namespace PHPDraft\Model\Tests; use PHPDraft\Model\Category; -use ReflectionClass; +use PHPUnit\Framework\Attributes\CoversClass; /** * Class CategoryTest - * @covers \PHPDraft\Model\Category */ +#[CoversClass(Category::class)] class CategoryTest extends HierarchyElementChildTestBase { private Category $class; @@ -41,7 +41,6 @@ public function tearDown(): void /** * Test if the value the class is initialized with is correct - * @covers \PHPDraft\Model\HierarchyElement */ public function testChildrenSetup(): void { @@ -69,14 +68,14 @@ public function testStructuresSetup(): void */ public function testParseIsCalled(): void { - $this->set_reflection_property_value('parent', $this->parent); + $this->setReflectionPropertyValue('parent', $this->parent); $obj = (object) []; $obj->content = []; $this->class->parse($obj); - $this->assertSame($this->parent, $this->get_reflection_property_value('parent')); + $this->assertSame($this->parent, $this->getReflectionPropertyValue('parent')); } /** @@ -84,15 +83,15 @@ public function testParseIsCalled(): void */ public function testParseIsCalledResource(): void { - $this->set_reflection_property_value('parent', $this->parent); + $this->setReflectionPropertyValue('parent', $this->parent); $json = '{"content":[{"element":"resource", "content":[{"element":"copy", "content":""}]}]}'; $this->class->parse(json_decode($json)); - $this->assertSame($this->parent, $this->get_reflection_property_value('parent')); + $this->assertSame($this->parent, $this->getReflectionPropertyValue('parent')); - $this->assertNotEmpty($this->get_reflection_property_value('children')); + $this->assertNotEmpty($this->getReflectionPropertyValue('children')); } /** @@ -100,14 +99,14 @@ public function testParseIsCalledResource(): void */ public function testParseIsCalledObject(): void { - $this->set_reflection_property_value('parent', $this->parent); + $this->setReflectionPropertyValue('parent', $this->parent); $json = '{"content":[{"element":"dataStructure", "content":{"element": "object", "key":{"content":"none"}, "value":{"element":"none"}}}]}'; $this->class->parse(json_decode($json)); - $this->assertSame($this->parent, $this->get_reflection_property_value('parent')); - $this->assertNotEmpty($this->get_reflection_property_value('structures')); + $this->assertSame($this->parent, $this->getReflectionPropertyValue('parent')); + $this->assertNotEmpty($this->getReflectionPropertyValue('structures')); } /** @@ -115,7 +114,7 @@ public function testParseIsCalledObject(): void */ public function testParseIsCalledObjectMetaID(): void { - $this->set_reflection_property_value('parent', $this->parent); + $this->setReflectionPropertyValue('parent', $this->parent); $json = '{ "element": "category", @@ -167,8 +166,8 @@ public function testParseIsCalledObjectMetaID(): void $this->class->parse(json_decode($json)); - $this->assertSame($this->parent, $this->get_reflection_property_value('parent')); - $this->assertNotEmpty($this->get_reflection_property_value('structures')); + $this->assertSame($this->parent, $this->getReflectionPropertyValue('parent')); + $this->assertNotEmpty($this->getReflectionPropertyValue('structures')); } /** @@ -176,15 +175,15 @@ public function testParseIsCalledObjectMetaID(): void */ public function testParseIsCalledDef(): void { - $this->set_reflection_property_value('parent', $this->parent); + $this->setReflectionPropertyValue('parent', $this->parent); $json = '{"content":[{"element":"henk", "content":[{"element":"copy", "content":""}]}]}'; $this->class->parse(json_decode($json)); - $this->assertSame($this->parent, $this->get_reflection_property_value('parent')); - $this->assertEmpty($this->get_reflection_property_value('children')); - $this->assertEmpty($this->get_reflection_property_value('structures')); + $this->assertSame($this->parent, $this->getReflectionPropertyValue('parent')); + $this->assertEmpty($this->getReflectionPropertyValue('children')); + $this->assertEmpty($this->getReflectionPropertyValue('structures')); } /** @@ -192,8 +191,8 @@ public function testParseIsCalledDef(): void */ public function testGetHrefIsCalledWithParent(): void { - $this->set_reflection_property_value('parent', $this->parent); - $this->set_reflection_property_value('title', 'title'); + $this->setReflectionPropertyValue('parent', $this->parent); + $this->setReflectionPropertyValue('title', 'title'); $this->parent->expects($this->once()) ->method('get_href') diff --git a/src/PHPDraft/Model/Tests/HTTPRequestTest.php b/src/PHPDraft/Model/Tests/HTTPRequestTest.php index 2bbf98a..49b7804 100644 --- a/src/PHPDraft/Model/Tests/HTTPRequestTest.php +++ b/src/PHPDraft/Model/Tests/HTTPRequestTest.php @@ -9,19 +9,18 @@ namespace PHPDraft\Model\Tests; -use Lunr\Halo\LunrBaseTest; +use Lunr\Halo\LunrBaseTestCase; use PHPDraft\Model\HierarchyElement; use PHPDraft\Model\HTTPRequest; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\MockObject\MockObject; -use ReflectionClass; /** * Class HTTPRequestTest - * @covers \PHPDraft\Model\HTTPRequest */ -class HTTPRequestTest extends LunrBaseTest +#[CoversClass(HttpRequest::class)] +class HTTPRequestTest extends LunrBaseTestCase { - private HTTPRequest $class; /** @@ -43,9 +42,9 @@ public function setUp(): void $this->parent = $this->getMockBuilder('\PHPDraft\Model\Transition') ->disableOriginalConstructor() ->getMock(); - $this->mock_function('microtime', fn() => '1000'); + $this->mockFunction('microtime', fn() => '1000'); $this->class = new HTTPRequest($parent); - $this->unmock_function('microtime'); + $this->unmockFunction('microtime'); $this->baseSetUp($this->class); } @@ -62,8 +61,8 @@ public function tearDown(): void */ public function testSetupCorrectly(): void { - $this->assertIsObject($this->get_reflection_property_value('parent')); - $this->assertEquals('a9b7ba70783b617e9998dc4dd82eb3c5', $this->get_reflection_property_value('id')); + $this->assertIsObject($this->getReflectionPropertyValue('parent')); + $this->assertEquals('a9b7ba70783b617e9998dc4dd82eb3c5', $this->getReflectionPropertyValue('id')); } /** @@ -79,7 +78,7 @@ public function testGetId(): void */ public function testEqualOnStatusCode(): void { - $this->set_reflection_property_value('method', 'POST'); + $this->setReflectionPropertyValue('method', 'POST'); $obj = '{"method":200, "body":"hello", "headers":[]}'; @@ -93,7 +92,7 @@ public function testEqualOnStatusCode(): void */ public function testEqualOnDesc(): void { - $this->set_reflection_property_value('body', 'hello'); + $this->setReflectionPropertyValue('body', 'hello'); $obj = '{"method":300, "body":"hello", "headers":[]}'; @@ -107,7 +106,7 @@ public function testEqualOnDesc(): void */ public function testEqualOnHeaders(): void { - $this->set_reflection_property_value('headers', []); + $this->setReflectionPropertyValue('headers', []); $obj = '{"method":300, "body":"hello", "headers":[]}'; @@ -121,8 +120,8 @@ public function testEqualOnHeaders(): void */ public function testEqualOnBoth(): void { - $this->set_reflection_property_value('method', 'GET'); - $this->set_reflection_property_value('title', 'hello'); + $this->setReflectionPropertyValue('method', 'GET'); + $this->setReflectionPropertyValue('title', 'hello'); $obj = '{"attributes":{"method": "GET"}, "meta":{"title":"hello"}}'; $b = new HTTPRequest($this->parent); @@ -136,8 +135,8 @@ public function testEqualOnBoth(): void */ public function testGetCurlCommandNoKey(): void { - $this->set_reflection_property_value('parent', $this->parent); - $this->set_reflection_property_value('method', ''); + $this->setReflectionPropertyValue('parent', $this->parent); + $this->setReflectionPropertyValue('method', ''); $return = $this->class->get_curl_command('https://ur.l'); @@ -149,11 +148,11 @@ public function testGetCurlCommandNoKey(): void */ public function testGetCurlCommandWithHeaders(): void { - $this->set_reflection_property_value('parent', $this->parent); - $this->set_reflection_property_value('method', ''); + $this->setReflectionPropertyValue('parent', $this->parent); + $this->setReflectionPropertyValue('method', ''); $headers = ['header' => 'value']; - $this->set_reflection_property_value('headers', $headers); + $this->setReflectionPropertyValue('headers', $headers); $return = $this->class->get_curl_command('https://ur.l'); @@ -165,9 +164,9 @@ public function testGetCurlCommandWithHeaders(): void */ public function testGetCurlCommandStringBody(): void { - $this->set_reflection_property_value('parent', $this->parent); - $this->set_reflection_property_value('body', 'body'); - $this->set_reflection_property_value('method', 'GET'); + $this->setReflectionPropertyValue('parent', $this->parent); + $this->setReflectionPropertyValue('body', 'body'); + $this->setReflectionPropertyValue('method', 'GET'); $return = $this->class->get_curl_command('https://ur.l'); @@ -179,9 +178,9 @@ public function testGetCurlCommandStringBody(): void */ public function testGetCurlCommandArrayBody(): void { - $this->set_reflection_property_value('parent', $this->parent); - $this->set_reflection_property_value('method', 'GET'); - $this->set_reflection_property_value('body', ['this', 'is', 'a', 'body']); + $this->setReflectionPropertyValue('parent', $this->parent); + $this->setReflectionPropertyValue('method', 'GET'); + $this->setReflectionPropertyValue('body', ['this', 'is', 'a', 'body']); $return = $this->class->get_curl_command('https://ur.l'); @@ -193,9 +192,9 @@ public function testGetCurlCommandArrayBody(): void */ public function testGetCurlCommandStructBodyFilled(): void { - $this->set_reflection_property_value('parent', $this->parent); - $this->set_reflection_property_value('method', 'GET'); - $this->set_reflection_property_value('body', 1000); + $this->setReflectionPropertyValue('parent', $this->parent); + $this->setReflectionPropertyValue('method', 'GET'); + $this->setReflectionPropertyValue('body', 1000); $struct = $this->getMockBuilder('\PHPDraft\Model\Elements\ObjectStructureElement') ->disableOriginalConstructor() @@ -210,7 +209,7 @@ public function testGetCurlCommandStructBodyFilled(): void ->willReturn('TEST'); $struct->value = [ $struct_ar ]; - $this->set_reflection_property_value('struct', $struct); + $this->setReflectionPropertyValue('struct', $struct); $return = $this->class->get_curl_command('https://ur.l'); @@ -222,14 +221,14 @@ public function testGetCurlCommandStructBodyFilled(): void */ public function testParseIsCalled(): void { - $this->set_reflection_property_value('parent', $this->parent); + $this->setReflectionPropertyValue('parent', $this->parent); $obj = '{"attributes":{"method":"TEST"}, "content":[]}'; $this->class->parse(json_decode($obj)); - $this->assertSame($this->parent, $this->get_reflection_property_value('parent')); - $this->assertSame('TEST', $this->get_reflection_property_value('method')); + $this->assertSame($this->parent, $this->getReflectionPropertyValue('parent')); + $this->assertSame('TEST', $this->getReflectionPropertyValue('method')); } /** @@ -237,14 +236,14 @@ public function testParseIsCalled(): void */ public function testParseIsCalledWithHeaders(): void { - $this->set_reflection_property_value('parent', $this->parent); + $this->setReflectionPropertyValue('parent', $this->parent); $obj = '{"attributes":{"method":"TEST", "headers":{"content":[{"content":{"key":{"content":"KEY"}, "value":{"content":"VALUE"}}}]}}, "content":[]}'; $this->class->parse(json_decode($obj)); - $this->assertSame($this->parent, $this->get_reflection_property_value('parent')); - $this->assertSame(['KEY' => 'VALUE'], $this->get_reflection_property_value('headers')); + $this->assertSame($this->parent, $this->getReflectionPropertyValue('parent')); + $this->assertSame(['KEY' => 'VALUE'], $this->getReflectionPropertyValue('headers')); } /** @@ -252,15 +251,15 @@ public function testParseIsCalledWithHeaders(): void */ public function testParseIsCalledWithPOST(): void { - $this->set_reflection_property_value('parent', $this->parent); + $this->setReflectionPropertyValue('parent', $this->parent); $obj = '{"attributes":{"method":"POST"}, "content":[{"element":"gold"}]}'; $this->class->parse(json_decode($obj)); - $this->assertSame($this->parent, $this->get_reflection_property_value('parent')); - $this->assertSame([], $this->get_reflection_property_value('struct')); - $this->assertSame([], $this->get_reflection_property_value('body')); + $this->assertSame($this->parent, $this->getReflectionPropertyValue('parent')); + $this->assertSame([], $this->getReflectionPropertyValue('struct')); + $this->assertSame([], $this->getReflectionPropertyValue('body')); } /** @@ -268,15 +267,15 @@ public function testParseIsCalledWithPOST(): void */ public function testParseIsCalledWithPOSTCopy(): void { - $this->set_reflection_property_value('parent', $this->parent); + $this->setReflectionPropertyValue('parent', $this->parent); $obj = '{"attributes":{"method":"POST"}, "content":[{"element":"copy", "content":"text"}]}'; $this->class->parse(json_decode($obj)); - $this->assertSame($this->parent, $this->get_reflection_property_value('parent')); - $this->assertEquals([], $this->get_reflection_property_value('struct')); - $this->assertEquals('text', $this->get_reflection_property_value('description')); + $this->assertSame($this->parent, $this->getReflectionPropertyValue('parent')); + $this->assertEquals([], $this->getReflectionPropertyValue('struct')); + $this->assertEquals('text', $this->getReflectionPropertyValue('description')); } /** @@ -284,14 +283,14 @@ public function testParseIsCalledWithPOSTCopy(): void */ public function testParseIsCalledWithPOSTStruct(): void { - $this->set_reflection_property_value('parent', $this->parent); + $this->setReflectionPropertyValue('parent', $this->parent); $obj = '{"attributes":{"method":"POST"}, "content":[{"element":"dataStructure", "content": {}}]}'; $this->class->parse(json_decode($obj)); - $this->assertSame($this->parent, $this->get_reflection_property_value('parent')); - $this->assertNotEmpty($this->get_reflection_property_value('struct')); + $this->assertSame($this->parent, $this->getReflectionPropertyValue('parent')); + $this->assertNotEmpty($this->getReflectionPropertyValue('struct')); } /** @@ -299,14 +298,14 @@ public function testParseIsCalledWithPOSTStruct(): void */ public function testParseIsCalledWithPOSTAsset(): void { - $this->set_reflection_property_value('parent', $this->parent); + $this->setReflectionPropertyValue('parent', $this->parent); $obj = '{"attributes":{"method":"POST"}, "content":[{"content":"something", "element":"asset", "meta":{"classes":["messageBody"]}}]}'; $this->class->parse(json_decode($obj)); - $this->assertSame($this->parent, $this->get_reflection_property_value('parent')); - $this->assertSame(['something'], $this->get_reflection_property_value('body')); - $this->assertSame(['Content-Type' => ''], $this->get_reflection_property_value('headers')); + $this->assertSame($this->parent, $this->getReflectionPropertyValue('parent')); + $this->assertSame(['something'], $this->getReflectionPropertyValue('body')); + $this->assertSame(['Content-Type' => ''], $this->getReflectionPropertyValue('headers')); } } diff --git a/src/PHPDraft/Model/Tests/HTTPResponseTest.php b/src/PHPDraft/Model/Tests/HTTPResponseTest.php index 7065bd9..6fe6f3a 100644 --- a/src/PHPDraft/Model/Tests/HTTPResponseTest.php +++ b/src/PHPDraft/Model/Tests/HTTPResponseTest.php @@ -9,20 +9,19 @@ namespace PHPDraft\Model\Tests; -use Lunr\Halo\LunrBaseTest; +use Lunr\Halo\LunrBaseTestCase; use PHPDraft\Model\HierarchyElement; use PHPDraft\Model\HTTPResponse; use PHPDraft\Model\Transition; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\MockObject\MockObject; -use ReflectionClass; /** * Class HTTPResponseTest - * @covers \PHPDraft\Model\HTTPResponse */ -class HTTPResponseTest extends LunrBaseTest +#[CoversClass(HttpResponse::class)] +class HTTPResponseTest extends LunrBaseTestCase { - private HTTPResponse $class; /** @@ -50,9 +49,9 @@ public function setUp(): void $this->parent = $this->getMockBuilder('\PHPDraft\Model\Transition') ->disableOriginalConstructor() ->getMock(); - $this->mock_function('microtime', fn() => '1000'); + $this->mockFunction('microtime', fn() => '1000'); $this->class = new HTTPResponse($this->parent_transition); - $this->unmock_function('microtime'); + $this->unmockFunction('microtime'); $this->baseSetUp($this->class); } @@ -69,8 +68,8 @@ public function tearDown(): void */ public function testSetupCorrectly(): void { - $this->assertSame($this->parent_transition, $this->get_reflection_property_value('parent')); - $this->assertSame('a9b7ba70783b617e9998dc4dd82eb3c5', $this->get_reflection_property_value('id')); + $this->assertSame($this->parent_transition, $this->getReflectionPropertyValue('parent')); + $this->assertSame('a9b7ba70783b617e9998dc4dd82eb3c5', $this->getReflectionPropertyValue('id')); } /** @@ -86,14 +85,14 @@ public function testGetId(): void */ public function testParseIsCalled(): void { - $this->set_reflection_property_value('parent', $this->parent); + $this->setReflectionPropertyValue('parent', $this->parent); $obj = '{"attributes":{"statusCode":1000, "headers":{"content":[]}}, "content":[]}'; $this->class->parse(json_decode($obj)); - $this->assertSame($this->parent, $this->get_reflection_property_value('parent')); - $this->assertSame(1000, $this->get_reflection_property_value('statuscode')); + $this->assertSame($this->parent, $this->getReflectionPropertyValue('parent')); + $this->assertSame(1000, $this->getReflectionPropertyValue('statuscode')); } /** @@ -101,14 +100,14 @@ public function testParseIsCalled(): void */ public function testParseIsCalledExtraHeaders(): void { - $this->set_reflection_property_value('parent', $this->parent); + $this->setReflectionPropertyValue('parent', $this->parent); $obj = '{"attributes":{"statusCode":1000, "headers":{"content":[{"content":{"key":{"content":"contentKEY"}, "value":{"content":"contentVALUE"}}}]}}, "content":[]}'; $this->class->parse(json_decode($obj)); - $this->assertSame($this->parent, $this->get_reflection_property_value('parent')); - $this->assertSame(['contentKEY' => 'contentVALUE'], $this->get_reflection_property_value('headers')); + $this->assertSame($this->parent, $this->getReflectionPropertyValue('parent')); + $this->assertSame(['contentKEY' => 'contentVALUE'], $this->getReflectionPropertyValue('headers')); } /** @@ -116,15 +115,15 @@ public function testParseIsCalledExtraHeaders(): void */ public function testParseIsCalledWOAttributes(): void { - $this->set_reflection_property_value('parent', $this->parent); - $this->set_reflection_property_value('statuscode', 200); + $this->setReflectionPropertyValue('parent', $this->parent); + $this->setReflectionPropertyValue('statuscode', 200); $obj = '{"content":[]}'; $this->class->parse(json_decode($obj)); - $this->assertSame($this->parent, $this->get_reflection_property_value('parent')); - $this->assertSame($this->get_reflection_property_value('statuscode'), 200); + $this->assertSame($this->parent, $this->getReflectionPropertyValue('parent')); + $this->assertSame($this->getReflectionPropertyValue('statuscode'), 200); } /** @@ -132,14 +131,14 @@ public function testParseIsCalledWOAttributes(): void */ public function testParseIsCalledCopyContent(): void { - $this->set_reflection_property_value('parent', $this->parent); + $this->setReflectionPropertyValue('parent', $this->parent); $obj = '{"content":[{"element":"copy", "content":""}]}'; $this->class->parse(json_decode($obj)); - $this->assertSame($this->parent, $this->get_reflection_property_value('parent')); - $this->assertSame('', $this->get_reflection_property_value('description')); + $this->assertSame($this->parent, $this->getReflectionPropertyValue('parent')); + $this->assertSame('', $this->getReflectionPropertyValue('description')); } /** @@ -147,14 +146,14 @@ public function testParseIsCalledCopyContent(): void */ public function testParseIsCalledStructContentEmpty(): void { - $this->set_reflection_property_value('parent', $this->parent); + $this->setReflectionPropertyValue('parent', $this->parent); $obj = '{"content":[{"element":"dataStructure", "content":{"content": {}}}]}'; $this->class->parse(json_decode($obj)); - $this->assertSame($this->parent, $this->get_reflection_property_value('parent')); - $this->assertEmpty($this->get_reflection_property_value('structure')); + $this->assertSame($this->parent, $this->getReflectionPropertyValue('parent')); + $this->assertEmpty($this->getReflectionPropertyValue('structure')); } /** @@ -162,14 +161,14 @@ public function testParseIsCalledStructContentEmpty(): void */ public function testParseIsCalledStructContent(): void { - $this->set_reflection_property_value('parent', $this->parent); + $this->setReflectionPropertyValue('parent', $this->parent); $obj = '{"content":[{"element":"dataStructure", "content":{"content": [{}]}}]}'; $this->class->parse(json_decode($obj)); - $this->assertSame($this->parent, $this->get_reflection_property_value('parent')); - $this->assertNotEmpty($this->get_reflection_property_value('structure')); + $this->assertSame($this->parent, $this->getReflectionPropertyValue('parent')); + $this->assertNotEmpty($this->getReflectionPropertyValue('structure')); } /** @@ -177,12 +176,12 @@ public function testParseIsCalledStructContent(): void */ public function testParseIsCalledStructContentHasAttr(): void { - $this->set_reflection_property_value('parent', $this->parent); + $this->setReflectionPropertyValue('parent', $this->parent); $obj = '{"content":[{"content":"hello", "attributes":{"contentType":"content"}, "element":"asset"}]}'; $this->class->parse(json_decode($obj)); - $prop = $this->get_reflection_property_value('content'); + $prop = $this->getReflectionPropertyValue('content'); $this->assertArrayHasKey('content', $prop); $this->assertSame('hello', $prop['content']); } @@ -192,7 +191,7 @@ public function testParseIsCalledStructContentHasAttr(): void */ public function testEqualOnStatusCode(): void { - $this->set_reflection_property_value('statuscode', 200); + $this->setReflectionPropertyValue('statuscode', 200); $obj = '{"statuscode":200, "description":"hello"}'; @@ -206,7 +205,7 @@ public function testEqualOnStatusCode(): void */ public function testEqualOnDesc(): void { - $this->set_reflection_property_value('description', 'hello'); + $this->setReflectionPropertyValue('description', 'hello'); $obj = '{"statuscode":300, "description":"hello"}'; @@ -220,8 +219,8 @@ public function testEqualOnDesc(): void */ public function testEqualOnBoth(): void { - $this->set_reflection_property_value('statuscode', 200); - $this->set_reflection_property_value('description', 'hello'); + $this->setReflectionPropertyValue('statuscode', 200); + $this->setReflectionPropertyValue('description', 'hello'); $obj = '{"attributes":{"statusCode":200}, "content":[{"element":"copy", "content": "hello"}]}'; $b = new HTTPResponse($this->parent_transition); diff --git a/src/PHPDraft/Model/Tests/HierarchyElementChildTestBase.php b/src/PHPDraft/Model/Tests/HierarchyElementChildTestBase.php index 5812006..ebe7a3a 100644 --- a/src/PHPDraft/Model/Tests/HierarchyElementChildTestBase.php +++ b/src/PHPDraft/Model/Tests/HierarchyElementChildTestBase.php @@ -9,15 +9,14 @@ namespace PHPDraft\Model\Tests; -use Lunr\Halo\LunrBaseTest; +use Lunr\Halo\LunrBaseTestCase; use PHPDraft\Model\HierarchyElement; use PHPUnit\Framework\MockObject\MockObject; /** * Class HierarchyElementChildTest - * @package PHPDraft\Model\Tests */ -abstract class HierarchyElementChildTestBase extends LunrBaseTest +abstract class HierarchyElementChildTestBase extends LunrBaseTestCase { /** * Mock of the parent class diff --git a/src/PHPDraft/Model/Tests/HierarchyElementTest.php b/src/PHPDraft/Model/Tests/HierarchyElementTest.php index 56f9793..02a3323 100644 --- a/src/PHPDraft/Model/Tests/HierarchyElementTest.php +++ b/src/PHPDraft/Model/Tests/HierarchyElementTest.php @@ -9,16 +9,16 @@ namespace PHPDraft\Model\Tests; -use Lunr\Halo\LunrBaseTest; +use Lunr\Halo\LunrBaseTestCase; use PHPDraft\Model\HierarchyElement; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\MockObject\MockObject; -use ReflectionClass; /** * Class HierarchyElementTest - * @covers \PHPDraft\Model\HierarchyElement */ -class HierarchyElementTest extends LunrBaseTest +#[CoversClass(HierarchyElement::class)] +class HierarchyElementTest extends LunrBaseTestCase { private HierarchyElement $class; @@ -38,7 +38,8 @@ public function setUp(): void $this->parent = $this->getMockBuilder('\PHPDraft\Model\Transition') ->disableOriginalConstructor() ->getMock(); - $this->class = $this->getMockForAbstractClass('PHPDraft\Model\HierarchyElement'); + $this->class = new class extends HierarchyElement { + }; $this->baseSetUp($this->class); } @@ -55,7 +56,7 @@ public function tearDown(): void */ public function testSetupCorrectly(): void { - $this->assertPropertyEquals('parent', NULL); + $this->assertPropertyEquals('parent', null); } /** @@ -63,7 +64,7 @@ public function testSetupCorrectly(): void */ public function testParseIsCalled(): void { - $this->set_reflection_property_value('parent', $this->parent); + $this->setReflectionPropertyValue('parent', $this->parent); $obj = '{"meta":{"title":"TEST"}, "content":""}'; @@ -78,7 +79,7 @@ public function testParseIsCalled(): void */ public function testParseIsCalledLoop(): void { - $this->set_reflection_property_value('parent', $this->parent); + $this->setReflectionPropertyValue('parent', $this->parent); $obj = '{"meta":{"title":"TEST"}, "content":[{"element":"copy", "content":"hello"}]}'; @@ -94,7 +95,7 @@ public function testParseIsCalledLoop(): void */ public function testParseIsCalledSlice(): void { - $this->set_reflection_property_value('parent', $this->parent); + $this->setReflectionPropertyValue('parent', $this->parent); $obj = '{"meta":{"title":"TEST"}, "content":[{"element":"copy", "content":"hello"}, {"element":"test", "content":"hello"}]}'; @@ -111,8 +112,8 @@ public function testParseIsCalledSlice(): void */ public function testGetHrefIsCalledWithParent(): void { - $this->set_reflection_property_value('parent', $this->parent); - $this->set_reflection_property_value('title', 'title'); + $this->setReflectionPropertyValue('parent', $this->parent); + $this->setReflectionPropertyValue('title', 'title'); $this->parent->expects($this->once()) ->method('get_href') @@ -128,7 +129,7 @@ public function testGetHrefIsCalledWithParent(): void */ public function testGetHrefIsCalledWithoutParent(): void { - $this->set_reflection_property_value('title', 'title'); + $this->setReflectionPropertyValue('title', 'title'); $result = $this->class->get_href(); $this->assertSame($result, 'title'); @@ -139,8 +140,8 @@ public function testGetHrefIsCalledWithoutParent(): void */ public function testGetHrefIsCalledWithTitleWithSpaces(): void { - $this->set_reflection_property_value('title', 'some title'); - $this->set_reflection_property_value('parent', $this->parent); + $this->setReflectionPropertyValue('title', 'some title'); + $this->setReflectionPropertyValue('parent', $this->parent); $this->parent->expects($this->once()) ->method('get_href') diff --git a/src/PHPDraft/Model/Tests/ObjectElementTest.php b/src/PHPDraft/Model/Tests/ObjectElementTest.php deleted file mode 100644 index bea4b24..0000000 --- a/src/PHPDraft/Model/Tests/ObjectElementTest.php +++ /dev/null @@ -1,96 +0,0 @@ - - */ - -namespace PHPDraft\Model\Tests; - -use Lunr\Halo\LunrBaseTest; -use PHPDraft\Model\Elements\ObjectStructureElement; - -/** - * Class ObjectElementTest - */ -class ObjectElementTest extends LunrBaseTest -{ - - private ObjectStructureElement $class; - - /** - * Set up - */ - public function setUp(): void - { - $this->class = new ObjectStructureElement(); - $this->baseSetUp($this->class); - } - - /** - * Tear down - */ - public function tearDown(): void - { - unset($this->parent); - parent::tearDown(); - } - - /** - * @covers \PHPDraft\Model\Elements\ObjectStructureElement - */ - public function testKeySetup(): void - { - $this->assertSame(null, $this->class->key); - } - - /** - * @covers \PHPDraft\Model\Elements\ObjectStructureElement - */ - public function testTypeSetup(): void - { - $this->assertSame(null, $this->class->type); - } - - /** - * @covers \PHPDraft\Model\Elements\ObjectStructureElement - */ - public function testDescriptionSetup(): void - { - $this->assertSame(null, $this->class->description); - } - - /** - * @covers \PHPDraft\Model\Elements\ObjectStructureElement - */ - public function testElementSetup(): void - { - $this->assertSame(null, $this->class->element); - } - - /** - * @covers \PHPDraft\Model\Elements\ObjectStructureElement - */ - public function testValueSetup(): void - { - $this->assertSame(null, $this->class->value); - } - - /** - * @covers \PHPDraft\Model\Elements\ObjectStructureElement - */ - public function testStatusSetup(): void - { - $this->assertSame([], $this->class->status); - } - - /** - * @covers \PHPDraft\Model\Elements\ObjectStructureElement - */ - public function testDepsSetup(): void - { - $this->assertSame(null, $this->class->deps); - } -} diff --git a/src/PHPDraft/Model/Tests/ResourceTest.php b/src/PHPDraft/Model/Tests/ResourceTest.php index 1447c3f..e03d0ec 100644 --- a/src/PHPDraft/Model/Tests/ResourceTest.php +++ b/src/PHPDraft/Model/Tests/ResourceTest.php @@ -9,26 +9,27 @@ namespace PHPDraft\Model\Tests; -use Lunr\Halo\LunrBaseTest; +use Lunr\Halo\LunrBaseTestCase; +use PHPDraft\Model\Category; use PHPDraft\Model\HierarchyElement; use PHPDraft\Model\Resource; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\MockObject\MockObject; -use ReflectionClass; /** * Class ResourceTest - * @covers \PHPDraft\Model\Resource */ -class ResourceTest extends LunrBaseTest +#[CoversClass(Resource::class)] +class ResourceTest extends LunrBaseTestCase { private Resource $class; /** * Mock of the parent class * - * @var HierarchyElement|MockObject + * @var Category&MockObject */ - protected mixed $parent; + protected Category&MockObject $parent; /** * Set up @@ -38,7 +39,6 @@ public function setUp(): void $this->parent = $this->getMockBuilder('\PHPDraft\Model\Category') ->getMock(); - $this->parent->href = null; $this->class = new Resource($this->parent); $this->baseSetUp($this->class); } @@ -56,7 +56,7 @@ public function tearDown(): void */ public function testSetupCorrectly(): void { - $this->assertSame($this->parent, $this->get_reflection_property_value('parent')); + $this->assertSame($this->parent, $this->getReflectionPropertyValue('parent')); } /** @@ -64,7 +64,7 @@ public function testSetupCorrectly(): void */ public function testParseIsCalled(): void { - $this->set_reflection_property_value('parent', $this->parent); + $this->setReflectionPropertyValue('parent', $this->parent); $obj = '{"attributes":{"href": "something", "hrefVariables":{"content": [{}]}}, "content":[]}'; @@ -75,19 +75,17 @@ public function testParseIsCalled(): void /** * Test basic parse functions - * - * @covers \PHPDraft\Model\Resource::parse */ public function testParseIsCalledNoHREF(): void { - $this->set_reflection_property_value('parent', $this->parent); - $this->set_reflection_property_value('href', null); + $this->setReflectionPropertyValue('parent', $this->parent); + $this->setReflectionPropertyValue('href', null); $obj = '{"content":[]}'; $this->class->parse(json_decode($obj)); - $this->assertNull($this->get_reflection_property_value('href')); + $this->assertNull($this->getReflectionPropertyValue('href')); } /** @@ -95,14 +93,14 @@ public function testParseIsCalledNoHREF(): void */ public function testParseIsCalledIsCopy(): void { - $this->set_reflection_property_value('parent', $this->parent); - $this->set_reflection_property_value('href', null); + $this->setReflectionPropertyValue('parent', $this->parent); + $this->setReflectionPropertyValue('href', null); $obj = '{"content":[{"element":"copy", "content":""},{"element":"hello", "content":""}, {"element":"hello", "content":""}]}'; $this->class->parse(json_decode($obj)); - $this->assertNull($this->get_reflection_property_value('href')); + $this->assertNull($this->getReflectionPropertyValue('href')); } /** @@ -110,15 +108,15 @@ public function testParseIsCalledIsCopy(): void */ public function testParseIsCalledIsNotCopy(): void { - $this->set_reflection_property_value('parent', $this->parent); - $this->set_reflection_property_value('href', null); - $this->assertEmpty($this->get_reflection_property_value('children')); + $this->setReflectionPropertyValue('parent', $this->parent); + $this->setReflectionPropertyValue('href', null); + $this->assertEmpty($this->getReflectionPropertyValue('children')); $obj = '{"content":[{"element":"hello", "content":""}]}'; $this->class->parse(json_decode($obj)); - $this->assertSame($this->parent, $this->get_reflection_property_value('parent')); - $this->assertNotEmpty($this->get_reflection_property_value('children')); + $this->assertSame($this->parent, $this->getReflectionPropertyValue('parent')); + $this->assertNotEmpty($this->getReflectionPropertyValue('children')); } } diff --git a/src/PHPDraft/Model/Tests/TransitionTest.php b/src/PHPDraft/Model/Tests/TransitionTest.php index 445fe05..be652b5 100644 --- a/src/PHPDraft/Model/Tests/TransitionTest.php +++ b/src/PHPDraft/Model/Tests/TransitionTest.php @@ -10,12 +10,13 @@ namespace PHPDraft\Model\Tests; use PHPDraft\Model\Transition; -use ReflectionClass; +use PHPUnit\Framework\Attributes\CoversClass; /** * Class TransitionTest * @covers \PHPDraft\Model\Transition */ +#[CoversClass(Transition::class)] class TransitionTest extends HierarchyElementChildTestBase { private Transition $class; @@ -46,7 +47,6 @@ public function tearDown(): void /** * Test if the value the class is initialized with is correct - * @covers \PHPDraft\Model\HierarchyElement */ public function testChildrenSetup(): void { @@ -58,7 +58,7 @@ public function testChildrenSetup(): void */ public function testSetupCorrectly(): void { - $this->assertSame($this->parent, $this->get_reflection_property_value('parent')); + $this->assertSame($this->parent, $this->getReflectionPropertyValue('parent')); } /** @@ -66,14 +66,14 @@ public function testSetupCorrectly(): void */ public function testParseIsCalled(): void { - $this->set_reflection_property_value('parent', $this->parent); + $this->setReflectionPropertyValue('parent', $this->parent); $obj = '{"attributes":{"href":"something"}, "content":[]}'; $this->class->parse(json_decode($obj)); - $this->assertSame($this->parent, $this->get_reflection_property_value('parent')); - $this->assertSame('something', $this->get_reflection_property_value('href')); + $this->assertSame($this->parent, $this->getReflectionPropertyValue('parent')); + $this->assertSame('something', $this->getReflectionPropertyValue('href')); } /** @@ -81,14 +81,14 @@ public function testParseIsCalled(): void */ public function testParseIsCalledIssetHrefVariables(): void { - $this->set_reflection_property_value('parent', $this->parent); + $this->setReflectionPropertyValue('parent', $this->parent); $json = '{"attributes":{"href":"something", "hrefVariables":{"content": [{"element": "member", "hello":"world"}]}}, "content":[]}'; $obj = json_decode($json); $this->class->parse($obj); - $this->assertSame($this->parent, $this->get_reflection_property_value('parent')); - $this->assertSame('something', $this->get_reflection_property_value('href')); + $this->assertSame($this->parent, $this->getReflectionPropertyValue('parent')); + $this->assertSame('something', $this->getReflectionPropertyValue('href')); } /** @@ -96,14 +96,14 @@ public function testParseIsCalledIssetHrefVariables(): void */ public function testParseIsCalledIssetData(): void { - $this->set_reflection_property_value('parent', $this->parent); + $this->setReflectionPropertyValue('parent', $this->parent); $obj = '{"element": "dataStructure", "attributes":{"href":"something", "data":{"content":{"hello":"world"}}}, "content":[]}'; $this->class->parse(json_decode($obj)); - $this->assertSame($this->parent, $this->get_reflection_property_value('parent')); - $this->assertSame('something', $this->get_reflection_property_value('href')); + $this->assertSame($this->parent, $this->getReflectionPropertyValue('parent')); + $this->assertSame('something', $this->getReflectionPropertyValue('href')); } /** @@ -111,14 +111,14 @@ public function testParseIsCalledIssetData(): void */ public function testParseIsCalledIsNotArrayContent(): void { - $this->set_reflection_property_value('parent', $this->parent); + $this->setReflectionPropertyValue('parent', $this->parent); $obj = '{"element": "dataStructure", "attributes":{"href":"something", "data":{"content":{"hello":"world"}}}, "content":""}'; $this->class->parse(json_decode($obj)); - $this->assertSame($this->parent, $this->get_reflection_property_value('parent')); - $this->assertSame('something', $this->get_reflection_property_value('href')); + $this->assertSame($this->parent, $this->getReflectionPropertyValue('parent')); + $this->assertSame('something', $this->getReflectionPropertyValue('href')); } /** @@ -126,14 +126,14 @@ public function testParseIsCalledIsNotArrayContent(): void */ public function testParseIsCalledIsArrayContentNoChild(): void { - $this->set_reflection_property_value('parent', $this->parent); + $this->setReflectionPropertyValue('parent', $this->parent); $obj = '{"element": "dataStructure", "attributes":{"href":"something", "data":{"content":{"hello":"world"}}}, "content":[{"element":"123", "content":{}}]}'; $this->class->parse(json_decode($obj)); - $this->assertSame($this->parent, $this->get_reflection_property_value('parent')); - $this->assertSame('something', $this->get_reflection_property_value('href')); + $this->assertSame($this->parent, $this->getReflectionPropertyValue('parent')); + $this->assertSame('something', $this->getReflectionPropertyValue('href')); } /** @@ -141,14 +141,14 @@ public function testParseIsCalledIsArrayContentNoChild(): void */ public function testParseIsCalledIsArrayContentWrongChild(): void { - $this->set_reflection_property_value('parent', $this->parent); + $this->setReflectionPropertyValue('parent', $this->parent); $obj = '{"element": "dataStructure", "attributes":{"href":"something", "data":{"content":{"hello":"world"}}}, "content":[{"element":"123", "content":[{"element":"test"}]}]}'; $this->class->parse(json_decode($obj)); - $this->assertSame($this->parent, $this->get_reflection_property_value('parent')); - $this->assertSame('something', $this->get_reflection_property_value('href')); + $this->assertSame($this->parent, $this->getReflectionPropertyValue('parent')); + $this->assertSame('something', $this->getReflectionPropertyValue('href')); } /** @@ -156,14 +156,14 @@ public function testParseIsCalledIsArrayContentWrongChild(): void */ public function testParseIsCalledIsArrayContentRequest(): void { - $this->set_reflection_property_value('parent', $this->parent); + $this->setReflectionPropertyValue('parent', $this->parent); $obj = '{"element": "dataStructure", "attributes":{"href":"something", "data":{"content":{"hello":"world"}}}, "content":[{"element":"123", "content":[{"element":"httpRequest", "attributes":{"method":"TEST"}, "content":{}}]}]}'; $this->class->parse(json_decode($obj)); - $this->assertSame($this->parent, $this->get_reflection_property_value('parent')); - $this->assertSame('something', $this->get_reflection_property_value('href')); + $this->assertSame($this->parent, $this->getReflectionPropertyValue('parent')); + $this->assertSame('something', $this->getReflectionPropertyValue('href')); } /** @@ -171,14 +171,14 @@ public function testParseIsCalledIsArrayContentRequest(): void */ public function testParseIsCalledIsArrayContentResponse(): void { - $this->set_reflection_property_value('parent', $this->parent); + $this->setReflectionPropertyValue('parent', $this->parent); $obj = '{"element": "dataStructure", "attributes":{"href":"something", "data":{"content":{"hello":"world"}}}, "content":[{"element":"123", "content":[{"element":"httpResponse", "content":[], "attributes":{"statusCode":"1000", "headers":{"content":[]}}}]}]}'; $this->class->parse(json_decode($obj)); - $this->assertSame($this->parent, $this->get_reflection_property_value('parent')); - $this->assertSame('something', $this->get_reflection_property_value('href')); + $this->assertSame($this->parent, $this->getReflectionPropertyValue('parent')); + $this->assertSame('something', $this->getReflectionPropertyValue('href')); } /** @@ -186,14 +186,14 @@ public function testParseIsCalledIsArrayContentResponse(): void */ public function testParseIsCalledIsArrayContentDefault(): void { - $this->set_reflection_property_value('parent', $this->parent); + $this->setReflectionPropertyValue('parent', $this->parent); $obj = '{"element": "dataStructure", "attributes":{"href":"something", "data":{"content":{"hello":"world"}}}, "content":[{"element":"123", "content":[{"element":"Cow", "content":[], "attributes":{"statusCode":"1000", "headers":{"content":[]}}}]}]}'; $this->class->parse(json_decode($obj)); - $this->assertSame($this->parent, $this->get_reflection_property_value('parent')); - $this->assertSame('something', $this->get_reflection_property_value('href')); + $this->assertSame($this->parent, $this->getReflectionPropertyValue('parent')); + $this->assertSame('something', $this->getReflectionPropertyValue('href')); } /** @@ -201,7 +201,7 @@ public function testParseIsCalledIsArrayContentDefault(): void */ public function testParseIsCalledIsArrayContentRequestList(): void { - $this->set_reflection_property_value('parent', $this->parent); + $this->setReflectionPropertyValue('parent', $this->parent); $mock_req = $this->getMockBuilder('\PHPDraft\Model\HTTPRequest') ->disableOriginalConstructor() @@ -211,14 +211,14 @@ public function testParseIsCalledIsArrayContentRequestList(): void ->willReturn(true); $requests = [$mock_req]; - $this->set_reflection_property_value('requests', $requests); + $this->setReflectionPropertyValue('requests', $requests); $obj = '{"element": "dataStructure", "attributes":{"href":"something", "data":{"content":{"hello":"world"}}}, "content":[{"element":"123", "content":[{"element":"httpRequest", "attributes":{"method":"TEST"}}]}]}'; $this->class->parse(json_decode($obj)); - $this->assertSame($this->parent, $this->get_reflection_property_value('parent')); - $this->assertSame('something', $this->get_reflection_property_value('href')); + $this->assertSame($this->parent, $this->getReflectionPropertyValue('parent')); + $this->assertSame('something', $this->getReflectionPropertyValue('href')); } /** @@ -245,7 +245,7 @@ public function testGetCurlCommandKey(): void ->willReturn('curl_command'); $requests = [$mock_req]; - $this->set_reflection_property_value('requests', $requests); + $this->setReflectionPropertyValue('requests', $requests); $return = $this->class->get_curl_command('https://ur.l'); @@ -318,8 +318,8 @@ public function testBuildURLOverlap(): void $parent->href = '/url'; - $this->set_reflection_property_value('parent', $parent); - $this->set_reflection_property_value('href', '/url/level'); + $this->setReflectionPropertyValue('parent', $parent); + $this->setReflectionPropertyValue('href', '/url/level'); $return = $this->class->build_url(); @@ -337,14 +337,14 @@ public function testBuildURLClean(): void $parent->href = '/url'; - $this->set_reflection_property_value('parent', $parent); - $this->set_reflection_property_value('href', '/url/level'); + $this->setReflectionPropertyValue('parent', $parent); + $this->setReflectionPropertyValue('href', '/url/level'); - $this->mock_function('strip_tags', fn () => "STRIPPED"); + $this->mockFunction('strip_tags', fn () => "STRIPPED"); $return = $this->class->build_url('', true); - $this->unmock_function('strip_tags'); + $this->unmockFunction('strip_tags'); $this->assertSame('STRIPPED', $return); } @@ -376,9 +376,9 @@ public function testBuildURLVars(): void $var1->key = $key1; - $this->set_reflection_property_value('parent', $parent); - $this->set_reflection_property_value('url_variables', [$var1]); - $this->set_reflection_property_value('href', '/url/level'); + $this->setReflectionPropertyValue('parent', $parent); + $this->setReflectionPropertyValue('url_variables', [$var1]); + $this->setReflectionPropertyValue('href', '/url/level'); $return = $this->class->build_url(); diff --git a/src/PHPDraft/Model/Transition.php b/src/PHPDraft/Model/Transition.php index 359d6a8..f7d419c 100644 --- a/src/PHPDraft/Model/Transition.php +++ b/src/PHPDraft/Model/Transition.php @@ -14,7 +14,6 @@ use PHPDraft\Model\Elements\BasicStructureElement; use PHPDraft\Model\Elements\ObjectStructureElement; -use PHPDraft\Model\Elements\StructureElement; use PHPDraft\Model\Resource as HttpResource; use Rize\UriTemplate; @@ -25,7 +24,7 @@ class Transition extends HierarchyElement * * @var string|null */ - public ?string $method = NULL; + public ?string $method = null; /** * URI. diff --git a/src/PHPDraft/Out/BaseTemplateRenderer.php b/src/PHPDraft/Out/BaseTemplateRenderer.php index b052ab9..76a9c11 100644 --- a/src/PHPDraft/Out/BaseTemplateRenderer.php +++ b/src/PHPDraft/Out/BaseTemplateRenderer.php @@ -12,7 +12,6 @@ namespace PHPDraft\Out; -use Lukasoppermann\Httpstatus\Httpstatus; use PHPDraft\Model\Category; use PHPDraft\Model\Elements\BasicStructureElement; diff --git a/src/PHPDraft/Out/HtmlTemplateRenderer.php b/src/PHPDraft/Out/HtmlTemplateRenderer.php index aed964b..a1733c7 100644 --- a/src/PHPDraft/Out/HtmlTemplateRenderer.php +++ b/src/PHPDraft/Out/HtmlTemplateRenderer.php @@ -13,28 +13,14 @@ namespace PHPDraft\Out; use Lukasoppermann\Httpstatus\Httpstatus; -use PHPDraft\Model\Category; -use PHPDraft\Model\Elements\ArrayStructureElement; -use PHPDraft\Model\Elements\ElementStructureElement; -use PHPDraft\Model\Elements\EnumStructureElement; -use PHPDraft\Model\Elements\ObjectStructureElement; use PHPDraft\Parse\ExecutionException; -use Twig\Environment; use Twig\Error\LoaderError; use Twig\Error\RuntimeError; use Twig\Error\SyntaxError; -use Twig\Extra\Markdown\DefaultMarkdown; -use Twig\Extra\Markdown\MarkdownExtension; -use Twig\Extra\Markdown\MarkdownRuntime; use Twig\Loader\FilesystemLoader; -use Twig\RuntimeLoader\RuntimeLoaderInterface; -use Twig\TwigFilter; -use Twig\TwigTest; class HtmlTemplateRenderer extends BaseTemplateRenderer { - - /** * CSS Files to load. * diff --git a/src/PHPDraft/Out/OpenAPI/OpenApiRenderer.php b/src/PHPDraft/Out/OpenAPI/OpenApiRenderer.php index a95b9dc..6c6f6e5 100644 --- a/src/PHPDraft/Out/OpenAPI/OpenApiRenderer.php +++ b/src/PHPDraft/Out/OpenAPI/OpenApiRenderer.php @@ -4,15 +4,14 @@ use PHPDraft\Model\Elements\BasicStructureElement; use PHPDraft\Model\Elements\ElementStructureElement; -use PHPDraft\Model\Elements\StructureElement; use PHPDraft\Model\HTTPRequest; use PHPDraft\Model\HTTPResponse; use PHPDraft\Model\Resource; use PHPDraft\Model\Transition; use PHPDraft\Out\BaseTemplateRenderer; -class OpenApiRenderer extends BaseTemplateRenderer { - +class OpenApiRenderer extends BaseTemplateRenderer +{ public function init(object $json): self { $this->object = $json; @@ -53,12 +52,13 @@ private function toOpenApiObject(): array * Get generic info for the API * @return array */ - private function getApiInfo(): array { + private function getApiInfo(): array + { return [ - "title"=> $this->base_data['TITLE'], - "version"=> $this->base_data['VERSION'] ?? '1.0.0', - "summary"=> $this->base_data['TITLE'] . ' generated from API Blueprint', - "description"=> $this->base_data['DESC'], + "title" => $this->base_data['TITLE'], + "version" => $this->base_data['VERSION'] ?? '1.0.0', + "summary" => $this->base_data['TITLE'] . ' generated from API Blueprint', + "description" => $this->base_data['DESC'], // "termsOfService"=> "https://example.com/terms/", // "contact"=> [ // "name"=> "API Support", @@ -77,7 +77,8 @@ private function getApiInfo(): array { * * @return array> */ - private function getServers(): array { + private function getServers(): array + { $return = []; $return[] = ['url' => $this->base_data['HOST'], 'description' => 'Main host']; @@ -93,7 +94,8 @@ private function getServers(): array { * * @return object */ - private function getPaths(): object { + private function getPaths(): object + { $return = []; foreach ($this->categories as $category) { /** @var Resource $resource */ @@ -105,22 +107,18 @@ private function getPaths(): object { if ($transition->url_variables !== []) { $parameters += $this->toParameters($transition->url_variables, $transition->href); } - if ($transition->data_variables !== NULL) - { + if ($transition->data_variables !== null) { $parameters += $this->toParameters([$transition->data_variables], $transition->href); } - if ($transition->structures !== []) - { + if ($transition->structures !== []) { $parameters += $this->toParameters($transition->structures, $transition->href); } - if ($parameters !== []) - { + if ($parameters !== []) { $transition_return['parameters'] = $parameters; } /** @var HTTPRequest $request */ - foreach ($transition->requests as $request) - { + foreach ($transition->requests as $request) { $request_return = $this->toOperation(request: $request, transition: $transition, tags: [$category->title]); $request_return['responses'] = $this->toResponses($transition->responses); $transition_return[strtolower($request->method)] = (object) $request_return; @@ -140,22 +138,21 @@ private function getPaths(): object { * * @return array */ - private function toOperation(HTTPRequest $request, Transition $transition, array $tags): array { + private function toOperation(HTTPRequest $request, Transition $transition, array $tags): array + { $operation = [ 'operationId' => $request->get_id(), 'summary' => $request->title ?? $transition->title, 'tags' => $tags, ]; $description = $request->description ?? $transition->description; - if ($description !== NULL) - { + if ($description !== null) { $operation['description'] = $description; } $parameters = []; - if ($request->struct !== NULL) { - if (is_array($request->struct)) - { + if ($request->struct !== null) { + if (is_array($request->struct)) { $parameters += $this->toParameters($request->struct, $transition->href); } else { $parameters += $this->toParameters([$request->struct], $transition->href); @@ -163,9 +160,13 @@ private function toOperation(HTTPRequest $request, Transition $transition, array } foreach ($request->headers as $name => $value) { - if ($name === 'Content-Type') { continue; } - if (isset($this->base_data['API_KEY_HEADER']) - && $this->base_data['API_KEY_HEADER'] === $name) { + if ($name === 'Content-Type') { + continue; + } + if ( + isset($this->base_data['API_KEY_HEADER']) + && $this->base_data['API_KEY_HEADER'] === $name + ) { $operation['security'] = [["api_key" => []]]; continue; } @@ -184,7 +185,7 @@ private function toOperation(HTTPRequest $request, Transition $transition, array $body = $this->toBody($request); if ($body !== []) { - $body['required'] = TRUE; + $body['required'] = true; $operation['requestBody'] = $body; } @@ -199,16 +200,19 @@ private function toOperation(HTTPRequest $request, Transition $transition, array * * @return array> */ - private function toParameters(array $objects, string $href): array { + private function toParameters(array $objects, string $href): array + { $return = []; foreach ($objects as $variable) { - if ($variable->key === NULL) { continue; } + if ($variable->key === null) { + continue; + } $return_tmp = [ 'name' => $variable->key->value, 'in' => str_contains($href, '{' . $variable->key->value . '}') ? 'path' : 'query', - 'required' => in_array('required', $variable->status, TRUE), + 'required' => in_array('required', $variable->status, true), 'schema' => [], ]; if ($this->isRef($variable->type)) { @@ -217,13 +221,11 @@ private function toParameters(array $objects, string $href): array { $return_tmp['schema']['type'] = $variable->type; } - if (isset($variable->value)) - { + if (isset($variable->value)) { $return_tmp['example'] = $variable->value; } - if (isset($variable->description)) - { + if (isset($variable->description)) { $return_tmp['description'] = $variable->description; } $return[] = $return_tmp; @@ -234,7 +236,7 @@ private function toParameters(array $objects, string $href): array { private function isRef(string $type): bool { - return !in_array($type, ["array", "boolean", "integer", "null", "number", "object", "string"], TRUE); + return !in_array($type, ["array", "boolean", "integer", "null", "number", "object", "string"], true); } /** @@ -251,7 +253,9 @@ private function toResponses(array $responses): array foreach ($responses as $response) { $headers = []; foreach ($response->headers as $header => $value) { - if ($header === 'Content-Type') { continue; } + if ($header === 'Content-Type') { + continue; + } $headers[$header] = [ 'schema' => [ 'type' => 'string', @@ -275,7 +279,9 @@ private function toResponses(array $responses): array } foreach ($response->structure as $structure) { - if ($structure->key === NULL) { continue; } + if ($structure->key === null) { + continue; + } $content[$response->headers['Content-Type'] ?? 'text/plain'] = ['schema' => $this->getComponent($structure)]; } @@ -300,13 +306,12 @@ private function toBody(HTTPRequest $request): array { $return = []; - if (!is_array($request->struct) && $request->struct->description !== NULL) { + if (!is_array($request->struct) && $request->struct->description !== null) { $return['description'] = $request->struct->description; } $content_type = $request->headers['Content-Type'] ?? 'text/plain'; - if (isset($request->struct) && $request->struct !== []) - { + if (isset($request->struct) && $request->struct !== []) { $content = $this->getComponent($request->struct); unset($content['required']); $return['content'] = [ @@ -322,7 +327,7 @@ private function toBody(HTTPRequest $request): array // ]; } - if ($request->body !== NULL && $request->body !== []) { + if ($request->body !== null && $request->body !== []) { $return['content'][$content_type]['examples']['base']['value'] = $request->body[0]; } @@ -333,28 +338,31 @@ private function toBody(HTTPRequest $request): array * Get webhook information for the API. * @return object */ - private function getWebhooks(): object { return (object) []; } + private function getWebhooks(): object + { + return (object) []; + } /** * Get component information for the API. * @return object */ - private function getComponents(): object { + private function getComponents(): object + { $return = []; - foreach ($this->base_structures as $structure) - { - $object = $this->getComponent($structure); + foreach ($this->base_structures as $structure) { + $object = $this->getComponent($structure); - if ($structure->ref !== NULL) { - $return[$structure->type] = [ - 'allOf' => [ + if ($structure->ref !== null) { + $return[$structure->type] = [ + 'allOf' => [ ['$ref' => "#/components/schemas/$structure->ref"], $object, - ], - ]; - } else { - $return[$structure->type] = $object; - } + ], + ]; + } else { + $return[$structure->type] = $object; + } } $return_object = ['schemas' => $return ]; if (isset($this->base_data['API_KEY_HEADER'])) { @@ -379,45 +387,47 @@ private function getComponents(): object { */ private function getComponent(BasicStructureElement $structure): array { - $required = []; - $properties = []; - if (is_array($structure->value)) - { - /** @var BasicStructureElement $value */ - foreach ($structure->value as $value) - { - $propery_data = $this->getSchemaProperty($value); - if ($propery_data === NULL) { continue; } - if (in_array('required', $value->status, TRUE)) { $required[] = $value->key->value;} - - $properties[$value->key->value] = $propery_data; + $required = []; + $properties = []; + if (is_array($structure->value)) { + /** @var BasicStructureElement $value */ + foreach ($structure->value as $value) { + $propery_data = $this->getSchemaProperty($value); + if ($propery_data === null) { + continue; + } + if (in_array('required', $value->status, true)) { + $required[] = $value->key->value; + } + + $properties[$value->key->value] = $propery_data; + } } - } - $object = [ + $object = [ 'type' => $structure->element, - ]; - switch ($structure->element) { - case 'enum': - case 'array': - $object['items'] = $properties; - break; - case 'object': - $object['properties'] = $properties; - $object['required'] = $required; - break; - case 'member': - //TODO: Check this case - break; - default: - break; - } - - if ($structure->description !== NULL) { - $object['description'] = $structure->description; - } - - return $object; + ]; + switch ($structure->element) { + case 'enum': + case 'array': + $object['items'] = $properties; + break; + case 'object': + $object['properties'] = $properties; + $object['required'] = $required; + break; + case 'member': + //TODO: Check this case + break; + default: + break; + } + + if ($structure->description !== null) { + $object['description'] = $structure->description; + } + + return $object; } /** @@ -430,59 +440,58 @@ private function getComponent(BasicStructureElement $structure): array private function getSchemaProperty(BasicStructureElement|ElementStructureElement $value): ?array { //TODO: Check this case - if ($value instanceof ElementStructureElement || $value->key === NULL) - { - return NULL; - } - - $propery_data = []; - if ($value->description !== NULL) { - $propery_data['description'] = $value->description; - } - - if ($this->isRef($value->type) && $value->type !== 'enum') - { - $propery_data['$ref'] = '#/components/schemas/' . $value->type; - return $propery_data; - } - - if ($value->type === 'enum') { - $propery_data['type'] = in_array('nullable', $value->status, TRUE) ? [ $value->type, 'null' ] : $value->type; - $options = []; - foreach ($value->value->value as $option) { - if ($option instanceof ElementStructureElement) { - $options[] = ['const' => $option->value, 'title' => $option->value]; - } + if ($value instanceof ElementStructureElement || $value->key === null) { + return null; } - $propery_data['oneOf'] = $options; - return $propery_data; - } + $propery_data = []; + if ($value->description !== null) { + $propery_data['description'] = $value->description; + } - if ($value->type === 'array') { - $propery_data['type'] = array_unique(array_map(fn($item) => $item->type,$value->value->value)); - $propery_data['example'] = array_merge(array_filter(array_map(fn($item) => $item->value,$value->value->value))); + if ($this->isRef($value->type) && $value->type !== 'enum') { + $propery_data['$ref'] = '#/components/schemas/' . $value->type; + return $propery_data; + } - return $propery_data; - } + if ($value->type === 'enum') { + $propery_data['type'] = in_array('nullable', $value->status, true) ? [ $value->type, 'null' ] : $value->type; + $options = []; + foreach ($value->value->value as $option) { + if ($option instanceof ElementStructureElement) { + $options[] = ['const' => $option->value, 'title' => $option->value]; + } + } + $propery_data['oneOf'] = $options; - if ($value->type === 'object') { - $propery_data['type'] = $value->type; - $propery_data['properties'] = $this->getComponent($value->value)['properties']; + return $propery_data; + } - return $propery_data; - } + if ($value->type === 'array') { + $propery_data['type'] = array_unique(array_map(fn($item) => $item->type, $value->value->value)); + $propery_data['example'] = array_merge(array_filter(array_map(fn($item) => $item->value, $value->value->value))); + + return $propery_data; + } + + if ($value->type === 'object') { + $propery_data['type'] = $value->type; + $propery_data['properties'] = $this->getComponent($value->value)['properties']; - $propery_data['type'] = in_array('nullable', $value->status, TRUE) ? [ $value->type, 'null' ] : $value->type; + return $propery_data; + } - return $propery_data; + $propery_data['type'] = in_array('nullable', $value->status, true) ? [ $value->type, 'null' ] : $value->type; + + return $propery_data; } /** * Get security information for the API * @return array>> */ - private function getSecurity(): array { + private function getSecurity(): array + { if (isset($this->base_data['API_KEY_LOCK_ALL']) && filter_var($this->base_data['API_KEY_LOCK_ALL'], FILTER_VALIDATE_BOOLEAN)) { return [["api_key" => []]]; } @@ -496,13 +505,14 @@ private function getSecurity(): array { * Get tags for the API * @return array> */ - private function getTags(): array { + private function getTags(): array + { $return = []; foreach ($this->categories as $category) { $data = [ 'name' => $category->title, ]; - if ($category->description !== NULL) { + if ($category->description !== null) { $data['description'] = $category->description; } @@ -511,5 +521,4 @@ private function getTags(): array { return $return; } - } diff --git a/src/PHPDraft/Out/OpenAPI/Tests/OpenApiRendererTest.php b/src/PHPDraft/Out/OpenAPI/Tests/OpenApiRendererTest.php index a5fd744..8704be3 100644 --- a/src/PHPDraft/Out/OpenAPI/Tests/OpenApiRendererTest.php +++ b/src/PHPDraft/Out/OpenAPI/Tests/OpenApiRendererTest.php @@ -1,14 +1,13 @@ get_reflection_method('getTags'); + $method = $this->getReflectionMethod('getTags'); $result = $method->invokeArgs($this->class, []); $this->assertArrayEmpty($result); @@ -45,7 +44,7 @@ public function testGetTags(): void public function testGetSecurity(): void { - $method = $this->get_reflection_method('getSecurity'); + $method = $this->getReflectionMethod('getSecurity'); $result = $method->invokeArgs($this->class, []); $this->assertArrayEmpty($result); @@ -53,41 +52,41 @@ public function testGetSecurity(): void public function testGetComponents(): void { - $method = $this->get_reflection_method('getComponents'); + $method = $this->getReflectionMethod('getComponents'); $result = $method->invokeArgs($this->class, []); - $this->assertEquals((object)['schemas' => []],$result); + $this->assertEquals((object)['schemas' => []], $result); } public function testGetDocs(): void { $this->markTestSkipped('Not implemented'); - $method = $this->get_reflection_method('getDocs'); + $method = $this->getReflectionMethod('getDocs'); $result = $method->invokeArgs($this->class, []); - $this->assertEquals((object)[],$result); + $this->assertEquals((object)[], $result); } public function testGetPaths(): void { - $method = $this->get_reflection_method('getPaths'); + $method = $this->getReflectionMethod('getPaths'); $result = $method->invokeArgs($this->class, []); - $this->assertEquals((object)[],$result); + $this->assertEquals((object)[], $result); } public function testGetServers(): void { - $method = $this->get_reflection_method('getServers'); + $method = $this->getReflectionMethod('getServers'); $result = $method->invokeArgs($this->class, []); - $this->assertEquals([['url' => null,'description' => 'Main host'], ['url' => '']],$result); + $this->assertEquals([['url' => null,'description' => 'Main host'], ['url' => '']], $result); } public function testGetApiInfo(): void { - $method = $this->get_reflection_method('getApiInfo'); + $method = $this->getReflectionMethod('getApiInfo'); $result = $method->invokeArgs($this->class, []); $this->assertEquals([ @@ -95,15 +94,15 @@ public function testGetApiInfo(): void 'version' => '1.0.0', 'summary' => ' generated from API Blueprint', 'description' => null, - ],$result); + ], $result); } public function testToResponses(): void { - $method = $this->get_reflection_method('toResponses'); + $method = $this->getReflectionMethod('toResponses'); $result = $method->invokeArgs($this->class, [[]]); - $this->assertEquals([],$result); + $this->assertEquals([], $result); } public function testToBody(): void @@ -112,21 +111,17 @@ public function testToBody(): void ->disableOriginalConstructor() ->getMock(); - $method = $this->get_reflection_method('toBody'); + $method = $this->getReflectionMethod('toBody'); $result = $method->invokeArgs($this->class, [$mock]); - $this->assertEquals([],$result); + $this->assertEquals([], $result); } public function testToParameters(): void { - $mock = $this->getMockBuilder(HttpRequest::class) - ->disableOriginalConstructor() - ->getMock(); - - $method = $this->get_reflection_method('toParameters'); + $method = $this->getReflectionMethod('toParameters'); $result = $method->invokeArgs($this->class, [[], 'href']); - $this->assertEquals([],$result); + $this->assertEquals([], $result); } -} \ No newline at end of file +} diff --git a/src/PHPDraft/Out/Tests/HtmlTemplateRendererTest.php b/src/PHPDraft/Out/Tests/HtmlTemplateRendererTest.php index d4020ee..1683ab3 100644 --- a/src/PHPDraft/Out/Tests/HtmlTemplateRendererTest.php +++ b/src/PHPDraft/Out/Tests/HtmlTemplateRendererTest.php @@ -9,15 +9,17 @@ namespace PHPDraft\Out\Tests; -use Lunr\Halo\LunrBaseTest; +use Lunr\Halo\LunrBaseTestCase; use PHPDraft\Out\HtmlTemplateRenderer; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Group; /** * Class TemplateGeneratorTest - * - * @covers \PHPDraft\Out\HtmlTemplateRenderer */ -class HtmlTemplateRendererTest extends LunrBaseTest +#[CoversClass(HtmlTemplateRenderer::class)] +class HtmlTemplateRendererTest extends LunrBaseTestCase { /** * @var HtmlTemplateRenderer @@ -47,7 +49,7 @@ public static function parsableDataProvider(): array ], ], - $expected_base + ['TITLE' => 'Title'], + $expected_base + ['TITLE' => 'Title'], ]; $return['title and metadata'] = [ @@ -80,7 +82,7 @@ public static function parsableDataProvider(): array ], ], - $expected_base + ['TITLE' => 'Title', 'Some_key' => 'Value', 'Some_key2' => 'Value2'], + $expected_base + ['TITLE' => 'Title', 'Some_key' => 'Value', 'Some_key2' => 'Value2'], ]; $return['title and metadata and description'] = [ @@ -118,7 +120,7 @@ public static function parsableDataProvider(): array ], ], - $expected_base + ['TITLE' => 'Title', 'Some_key' => 'Value', 'Some_key2' => 'Value2', 'DESC' => 'Some description'], + $expected_base + ['TITLE' => 'Title', 'Some_key' => 'Value', 'Some_key2' => 'Value2', 'DESC' => 'Some description'], ]; return $return; @@ -179,19 +181,15 @@ public function setUp(): void /** * Test if the value the class is initialized with is correct - * - * @covers \PHPDraft\Out\HtmlTemplateRenderer */ public function testSetupCorrectly(): void { - $this->assertSame('default', $this->get_reflection_property_value('template')); - $this->assertEquals('none', $this->get_reflection_property_value('image')); + $this->assertSame('default', $this->getReflectionPropertyValue('template')); + $this->assertEquals('none', $this->getReflectionPropertyValue('image')); } /** * Test if the value the class is initialized with is correct - * - * @covers \PHPDraft\Out\HtmlTemplateRenderer::strip_link_spaces */ public function testStripSpaces(): void { @@ -202,13 +200,10 @@ public function testStripSpaces(): void /** * Test if the value the class is initialized with is correct * - * @dataProvider responseStatusProvider - * * @param int $code HTTP code * @param string $text Class to return - * - * @covers \PHPDraft\Out\HtmlTemplateRenderer::get_response_status */ + #[DataProvider('responseStatusProvider')] public function testResponseStatus(int $code, string $text): void { $return = HtmlTemplateRenderer::get_response_status($code); @@ -218,13 +213,10 @@ public function testResponseStatus(int $code, string $text): void /** * Test if the value the class is initialized with is correct * - * @dataProvider requestMethodProvider - * * @param string $method HTTP Method * @param string $text Class to return - * - * @covers \PHPDraft\Out\HtmlTemplateRenderer::get_method_icon */ + #[DataProvider('requestMethodProvider')] public function testRequestMethod(string $method, string $text): void { $return = HtmlTemplateRenderer::get_method_icon($method); @@ -233,8 +225,6 @@ public function testRequestMethod(string $method, string $text): void /** * Test if the value the class is initialized with is correct - * - * @covers \PHPDraft\Out\HtmlTemplateRenderer::find_include_file */ public function testIncludeFileDefault(): void { @@ -244,8 +234,6 @@ public function testIncludeFileDefault(): void /** * Test if the value the class is initialized with is correct - * - * @covers \PHPDraft\Out\HtmlTemplateRenderer::find_include_file */ public function testIncludeFileFallback(): void { @@ -255,19 +243,15 @@ public function testIncludeFileFallback(): void /** * Test if the value the class is initialized with is correct - * - * @covers \PHPDraft\Out\HtmlTemplateRenderer::find_include_file */ public function testIncludeFileNone(): void { $return = $this->class->find_include_file('gfsdfdsf', 'xyz'); - $this->assertEquals(NULL, $return); + $this->assertEquals(null, $return); } /** * Test if the value the class is initialized with is correct - * - * @covers \PHPDraft\Out\HtmlTemplateRenderer::find_include_file */ public function testIncludeFileSingle(): void { @@ -278,8 +262,6 @@ public function testIncludeFileSingle(): void /** * Test if the value the class is initialized with is correct - * - * @covers \PHPDraft\Out\HtmlTemplateRenderer::find_include_file */ public function testIncludeFileMultiple(): void { @@ -294,23 +276,17 @@ public function testIncludeFileMultiple(): void $this->assertEquals('templates/text/text.txt', $return); } - /** - * @covers \PHPDraft\Out\HtmlTemplateRenderer::get - */ public function testGetTemplateFailsEmpty(): void { $this->expectException('PHPDraft\Parse\ExecutionException'); $this->expectExceptionMessage('Couldn\'t find template \'cow\''); - $this->set_reflection_property_value('template', 'cow'); + $this->setReflectionPropertyValue('template', 'cow'); $json = '{"content": [{"content": "hello"}]}'; $this->assertStringEqualsFile(TEST_STATICS . '/empty_html_template', $this->class->get(json_decode($json))); } - /** - * @covers \PHPDraft\Out\HtmlTemplateRenderer::get - * @group twig - */ + #[Group('twig')] public function testGetTemplate(): void { $json = '{"content": [{"content": "hello"}]}'; @@ -318,25 +294,19 @@ public function testGetTemplate(): void $this->assertStringEqualsFile(TEST_STATICS . '/empty_html_template', $this->class->get(json_decode($json))); } - /** - * @covers \PHPDraft\Out\HtmlTemplateRenderer::get - * @group twig - */ + #[Group('twig')] public function testGetTemplateSorting(): void { - $this->set_reflection_property_value('sorting', 3); + $this->setReflectionPropertyValue('sorting', 3); $json = '{"content": [{"content": "hello"}]}'; $this->assertStringEqualsFile(TEST_STATICS . '/empty_html_template', $this->class->get(json_decode($json))); } - /** - * @covers \PHPDraft\Out\HtmlTemplateRenderer::get - * @group twig - */ + #[Group('twig')] public function testGetTemplateMetaData(): void { - $this->set_reflection_property_value('sorting', 3); + $this->setReflectionPropertyValue('sorting', 3); $json = <<<'TAG' {"content": [{"content": [], "attributes": { "metadata": {"content": [ @@ -349,13 +319,10 @@ public function testGetTemplateMetaData(): void $this->assertStringEqualsFile(TEST_STATICS . '/basic_html_template', $this->class->get(json_decode($json))); } - /** - * @covers \PHPDraft\Out\HtmlTemplateRenderer::get - * @group twig - */ + #[Group('twig')] public function testGetTemplateCategories(): void { - $this->set_reflection_property_value('sorting', 3); + $this->setReflectionPropertyValue('sorting', 3); $json = <<<'TAG' {"content": [ {"content": [{"element": "copy", "content": "__desc__"}, {"element": "category", "content": []}], @@ -370,13 +337,10 @@ public function testGetTemplateCategories(): void $this->assertStringEqualsFile(TEST_STATICS . '/full_html_template', $this->class->get(json_decode($json))); } - /** - * @covers \PHPDraft\Out\BaseTemplateRenderer::parse_base_data - * @dataProvider parsableDataProvider - */ + #[DataProvider('parsableDataProvider')] public function testParseBaseData(array $input, array $expected): void { - $method = $this->get_reflection_method('parse_base_data'); + $method = $this->getReflectionMethod('parse_base_data'); $method->invokeArgs($this->class, [ json_decode(json_encode($input)) ]); $this->assertPropertyEquals('base_data', $expected); diff --git a/src/PHPDraft/Out/Tests/SortingTest.php b/src/PHPDraft/Out/Tests/SortingTest.php index 66b55b3..18a169e 100644 --- a/src/PHPDraft/Out/Tests/SortingTest.php +++ b/src/PHPDraft/Out/Tests/SortingTest.php @@ -9,22 +9,20 @@ namespace PHPDraft\Out\Tests; -use Lunr\Halo\LunrBaseTest; +use Lunr\Halo\LunrBaseTestCase; +use PHPDraft\Model\Category; use PHPDraft\Out\Sorting; -use PHPDraft\Out\Version; -use ReflectionClass; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\CoversFunction; /** * Class SortingTest - * - * @covers \PHPDraft\Out\Sorting */ -class SortingTest extends LunrBaseTest +#[CoversClass(Sorting::class)] +class SortingTest extends LunrBaseTestCase { /** * Test if service sorting is determined correctly. - * - * @covers \PHPDraft\Out\Sorting::sortServices */ public function testSortsServicesIfNeeded(): void { @@ -37,8 +35,6 @@ public function testSortsServicesIfNeeded(): void /** * Test if structure sorting is determined correctly. - * - * @covers \PHPDraft\Out\Sorting::sortStructures */ public function testSortsStructureIfNeeded(): void { diff --git a/src/PHPDraft/Out/Tests/TwigFactoryTest.php b/src/PHPDraft/Out/Tests/TwigFactoryTest.php index 2fbc6c0..f764ca2 100644 --- a/src/PHPDraft/Out/Tests/TwigFactoryTest.php +++ b/src/PHPDraft/Out/Tests/TwigFactoryTest.php @@ -2,19 +2,20 @@ namespace PHPDraft\Out\Tests; -use Lunr\Halo\LunrBaseTest; +use Lunr\Halo\LunrBaseTestCase; use PHPDraft\Out\TwigFactory; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use Twig\Environment; use Twig\Loader\ArrayLoader; -class TwigFactoryTest extends LunrBaseTest +#[CoversClass(TwigFactory::class)] +class TwigFactoryTest extends LunrBaseTestCase { /** * Check factory - * - * @covers \PHPDraft\Out\TwigFactory::get - * @group twig */ + #[Group('twig')] public function testFactory(): void { $loader = new ArrayLoader(); diff --git a/src/PHPDraft/Out/Tests/VersionTest.php b/src/PHPDraft/Out/Tests/VersionTest.php index 6f0bc1f..1e16f28 100644 --- a/src/PHPDraft/Out/Tests/VersionTest.php +++ b/src/PHPDraft/Out/Tests/VersionTest.php @@ -9,16 +9,16 @@ namespace PHPDraft\Out\Tests; -use Lunr\Halo\LunrBaseTest; +use Lunr\Halo\LunrBaseTestCase; use PHPDraft\Out\Version; +use PHPUnit\Framework\Attributes\CoversClass; use ReflectionClass; /** * Class VersionTest - * - * @covers \PHPDraft\Out\Version */ -class VersionTest extends LunrBaseTest +#[CoversClass(Version::class)] +class VersionTest extends LunrBaseTestCase { /** * Set up tests @@ -28,7 +28,7 @@ class VersionTest extends LunrBaseTest public function setUp(): void { $this->class = new Version(); - $this->reflection = new ReflectionClass('PHPDraft\Out\Version'); + $this->baseSetUp($this->class); } /** @@ -36,11 +36,11 @@ public function setUp(): void */ public function testReleaseIDIsNull(): void { - $this->constant_redefine('VERSION', '0'); - $this->mock_function('exec', fn() => '12'); + $this->redefineConstant('VERSION', '0'); + $this->mockFunction('exec', fn() => '12'); $return = $this->class->release_id(); $this->assertSame('12', $return); - $this->unmock_function('exec'); + $this->unmockFunction('exec'); } /** @@ -48,7 +48,7 @@ public function testReleaseIDIsNull(): void */ public function testReleaseIDIsNotNull(): void { - $this->constant_redefine('VERSION', '1.2.3'); + $this->redefineConstant('VERSION', '1.2.3'); $return = $this->class->release_id(); $this->assertSame('1.2.3', $return); } @@ -58,7 +58,7 @@ public function testReleaseIDIsNotNull(): void */ public function testVersion(): void { - $this->constant_redefine('VERSION', '1.2.4'); + $this->redefineConstant('VERSION', '1.2.4'); $this->class->version(); $this->expectOutputString('PHPDraft: 1.2.4'); } @@ -68,7 +68,7 @@ public function testVersion(): void */ public function testSeries(): void { - $this->constant_redefine('VERSION', '1.2.4'); + $this->redefineConstant('VERSION', '1.2.4'); $return = $this->class->series(); $this->assertSame('1.2', $return); } @@ -78,7 +78,7 @@ public function testSeries(): void */ public function testReleaseChannel(): void { - $this->constant_redefine('VERSION', '1.2.4-beta'); + $this->redefineConstant('VERSION', '1.2.4-beta'); $return = $this->class->getReleaseChannel(); $this->assertSame('-nightly', $return); } @@ -88,7 +88,7 @@ public function testReleaseChannel(): void */ public function testReleaseChannelNormal(): void { - $this->constant_redefine('VERSION', '1.2.4'); + $this->redefineConstant('VERSION', '1.2.4'); $return = $this->class->getReleaseChannel(); $this->assertSame('', $return); } @@ -98,7 +98,7 @@ public function testReleaseChannelNormal(): void */ public function testSeriesNightly(): void { - $this->constant_redefine('VERSION', '1.2.4-beta'); + $this->redefineConstant('VERSION', '1.2.4-beta'); $return = $this->class->series(); $this->assertSame('1.2', $return); } diff --git a/src/PHPDraft/Out/Version.php b/src/PHPDraft/Out/Version.php index f325c3d..37e6d13 100644 --- a/src/PHPDraft/Out/Version.php +++ b/src/PHPDraft/Out/Version.php @@ -36,7 +36,7 @@ public static function version(): void public static function release_id(): string { $env_id = getenv('PHPDRAFT_RELEASE_ID'); - if ($env_id !== FALSE) { + if ($env_id !== false) { return $env_id; } diff --git a/src/PHPDraft/Parse/Drafter.php b/src/PHPDraft/Parse/Drafter.php index ab8f695..7f07792 100644 --- a/src/PHPDraft/Parse/Drafter.php +++ b/src/PHPDraft/Parse/Drafter.php @@ -52,8 +52,7 @@ public function init(ApibFileParser $apib): BaseParser public static function location(): false|string { $returnVal = shell_exec('which drafter 2> /dev/null'); - if ($returnVal === NULL) - { + if ($returnVal === null) { return false; } @@ -88,8 +87,7 @@ public static function available(): bool $path = self::location(); $version = shell_exec('drafter -v 2> /dev/null'); - if ($version === NULL) - { + if ($version === null) { return false; } diff --git a/src/PHPDraft/Parse/Tests/BaseParserTest.php b/src/PHPDraft/Parse/Tests/BaseParserTest.php index a3e57f1..591e5ba 100644 --- a/src/PHPDraft/Parse/Tests/BaseParserTest.php +++ b/src/PHPDraft/Parse/Tests/BaseParserTest.php @@ -9,45 +9,61 @@ namespace PHPDraft\Parse\Tests; -use Lunr\Halo\LunrBaseTest; +use Lunr\Halo\LunrBaseTestCase; use PHPDraft\In\ApibFileParser; +use PHPDraft\Parse\BaseParser; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\MockObject\MockObject; -use ReflectionClass; /** * Class BaseParserTest - * @covers \PHPDraft\Parse\BaseParser */ -class BaseParserTest extends LunrBaseTest +#[CoversClass(BaseParser::class)] +class BaseParserTest extends LunrBaseTestCase { /** * Shared instance of the file parser. * * @var ApibFileParser&MockObject */ - private $parser; + private ApibFileParser&MockObject $parser; + + /** + * Shared instance of the base parser. + * + * @var BaseParser&MockObject + */ + private BaseParser $class; /** * Set up */ public function setUp(): void { - $this->mock_function('sys_get_temp_dir', fn() => TEST_STATICS); - $this->mock_function('shell_exec', fn() => "/some/dir/drafter\n"); + $this->mockFunction('sys_get_temp_dir', fn() => TEST_STATICS); + $this->mockFunction('shell_exec', fn() => "/some/dir/drafter\n"); $this->parser = $this->getMockBuilder('\PHPDraft\In\ApibFileParser') ->disableOriginalConstructor() ->getMock(); - $this->class = $this->getMockBuilder('\PHPDraft\Parse\BaseParser') - ->getMockForAbstractClass(); + $this->class = new class extends BaseParser { + protected function parse(): void + { + } + + public static function available(): bool + { + return true; + } + }; $this->parser->set_apib_content(file_get_contents(TEST_STATICS . '/drafter/apib/index.apib')); $this->class->init($this->parser); $this->baseSetUp($this->class); - $this->unmock_function('shell_exec'); - $this->unmock_function('sys_get_temp_dir'); + $this->unmockFunction('shell_exec'); + $this->unmockFunction('sys_get_temp_dir'); } /** @@ -62,24 +78,17 @@ public function tearDown(): void /** * Test if the value the class is initialized with is correct - * - * @covers \PHPDraft\Parse\BaseParser::parseToJson() */ public function testSetupCorrectly(): void { - $this->assertInstanceOf('\PHPDraft\In\ApibFileParser', $this->get_reflection_property_value('apib')); + $this->assertInstanceOf('\PHPDraft\In\ApibFileParser', $this->getReflectionPropertyValue('apib')); } /** * Check if parsing the APIB to JSON gives the expected result - * - * @covers \PHPDraft\Parse\BaseParser::parseToJson() */ public function testParseToJSON(): void { - $this->class->expects($this->once()) - ->method('parse'); - $this->class->json = json_decode(file_get_contents(TEST_STATICS . '/drafter/json/index.json')); $this->class->parseToJson(); $this->assertEquals(json_decode(file_get_contents(TEST_STATICS . '/drafter/json/index.json')), $this->class->json); @@ -87,14 +96,9 @@ public function testParseToJSON(): void /** * Check if parsing the APIB to JSON gives the expected result - * - * @covers \PHPDraft\Parse\BaseParser::parseToJson() */ public function testParseToJSONMkDir(): void { - $this->class->expects($this->once()) - ->method('parse'); - $this->class->json = json_decode(file_get_contents(TEST_STATICS . '/drafter/json/index.json')); $this->class->parseToJson(); $this->assertEquals(json_decode(file_get_contents(TEST_STATICS . '/drafter/json/index.json')), $this->class->json); @@ -102,8 +106,6 @@ public function testParseToJSONMkDir(): void /** * Check if parsing the APIB to JSON gives the expected result - * - * @covers \PHPDraft\Parse\BaseParser::parseToJson() */ public function testParseToJSONMkTmp(): void { @@ -115,10 +117,7 @@ public function testParseToJSONMkTmp(): void rmdir($tmp_dir); } - $this->set_reflection_property_value('tmp_dir', $tmp_dir); - - $this->class->expects($this->once()) - ->method('parse'); + $this->setReflectionPropertyValue('tmp_dir', $tmp_dir); $this->class->json = json_decode(file_get_contents(TEST_STATICS . '/drafter/json/index.json')); $this->class->parseToJson(); @@ -128,23 +127,18 @@ public function testParseToJSONMkTmp(): void /** * Check if parsing the fails when invalid JSON - * - * @covers \PHPDraft\Parse\BaseParser::parseToJson() */ public function testParseToJSONWithInvalidJSON(): void { - $this->class->expects($this->once()) - ->method('parse'); - $this->expectException('\PHPDraft\Parse\ExecutionException'); $this->expectExceptionMessage('Drafter generated invalid JSON (ERROR)'); $this->expectExceptionCode(2); - $this->mock_function('json_last_error', fn() => JSON_ERROR_DEPTH); - $this->mock_function('json_last_error_msg', fn() => "ERROR"); + $this->mockFunction('json_last_error', fn() => JSON_ERROR_DEPTH); + $this->mockFunction('json_last_error_msg', fn() => "ERROR"); $this->class->parseToJson(); $this->expectOutputString('ERROR: invalid json in /tmp/drafter/index.json'); - $this->unmock_function('json_last_error_msg'); - $this->unmock_function('json_last_error'); + $this->unmockFunction('json_last_error_msg'); + $this->unmockFunction('json_last_error'); } } diff --git a/src/PHPDraft/Parse/Tests/DrafterAPITest.php b/src/PHPDraft/Parse/Tests/DrafterAPITest.php index b4dbfec..6968740 100644 --- a/src/PHPDraft/Parse/Tests/DrafterAPITest.php +++ b/src/PHPDraft/Parse/Tests/DrafterAPITest.php @@ -9,24 +9,24 @@ namespace PHPDraft\Parse\Tests; -use Lunr\Halo\LunrBaseTest; +use Lunr\Halo\LunrBaseTestCase; use PHPDraft\In\ApibFileParser; use PHPDraft\Parse\DrafterAPI; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\MockObject\MockObject; -use ReflectionClass; /** * Class DrafterAPITest - * @covers \PHPDraft\Parse\DrafterAPI */ -class DrafterAPITest extends LunrBaseTest +#[CoversClass(DrafterAPI::class)] +class DrafterAPITest extends LunrBaseTestCase { /** * Shared instance of the file parser. * - * @var ApibFileParser|MockObject + * @var ApibFileParser&MockObject */ - private mixed $parser; + private ApibFileParser&MockObject $parser; private DrafterAPI $class; @@ -35,7 +35,7 @@ class DrafterAPITest extends LunrBaseTest */ public function setUp(): void { - $this->mock_function('sys_get_temp_dir', fn() => TEST_STATICS); + $this->mockFunction('sys_get_temp_dir', fn() => TEST_STATICS); $this->parser = $this->getMockBuilder('\PHPDraft\In\ApibFileParser') ->disableOriginalConstructor() @@ -48,7 +48,7 @@ public function setUp(): void $this->class->init($this->parser); - $this->unmock_function('sys_get_temp_dir'); + $this->unmockFunction('sys_get_temp_dir'); } /** @@ -62,50 +62,42 @@ public function tearDown(): void /** * Test if the value the class is initialized with is correct - * - * @covers \PHPDraft\Parse\DrafterAPI::parseToJson() */ public function testSetupCorrectly(): void { - $this->assertInstanceOf('\PHPDraft\In\ApibFileParser', $this->get_reflection_property_value('apib')); + $this->assertInstanceOf('\PHPDraft\In\ApibFileParser', $this->getReflectionPropertyValue('apib')); } /** * Test if the drafter api can be used - * - * @covers \PHPDraft\Parse\DrafterAPI::parseToJson() */ public function testAvailableFails(): void { - $this->mock_function('curl_exec', fn() => "/some/dir/drafter\n"); - $this->mock_function('curl_errno', fn() => 1); + $this->mockFunction('curl_exec', fn() => "/some/dir/drafter\n"); + $this->mockFunction('curl_errno', fn() => 1); $this->assertFalse(DrafterAPI::available()); - $this->unmock_function('curl_errno'); - $this->unmock_function('curl_exec'); + $this->unmockFunction('curl_errno'); + $this->unmockFunction('curl_exec'); } /** * Test if the drafter api can be used - * - * @covers \PHPDraft\Parse\DrafterAPI::parseToJson() */ public function testAvailableSuccess(): void { - $this->mock_function('curl_exec', fn() => "/some/dir/drafter\n"); - $this->mock_function('curl_errno', fn() => 0); + $this->mockFunction('curl_exec', fn() => "/some/dir/drafter\n"); + $this->mockFunction('curl_errno', fn() => 0); $this->assertFalse(DrafterAPI::available()); - $this->unmock_function('curl_errno'); - $this->unmock_function('curl_exec'); + $this->unmockFunction('curl_errno'); + $this->unmockFunction('curl_exec'); } /** * Check if parsing the fails without drafter - * - * @covers \PHPDraft\Parse\DrafterAPI::parseToJson() */ public function testParseWithFailingWebservice(): void { @@ -113,27 +105,25 @@ public function testParseWithFailingWebservice(): void $this->expectExceptionMessage('Drafter webservice failed to parse input'); $this->expectExceptionCode(1); - $this->mock_function('curl_errno', fn() => 1); + $this->mockFunction('curl_errno', fn() => 1); $this->class->parseToJson(); - $this->unmock_function('curl_errno'); + $this->unmockFunction('curl_errno'); } /** * Check if parsing the succeeds - * - * @covers \PHPDraft\Parse\DrafterAPI::parseToJson() */ public function testParseSuccess(): void { - $this->mock_function('json_last_error', fn() => 0); - $this->mock_function('curl_errno', fn() => 0); - $this->mock_function('curl_exec', fn() => '{"content":[{"element":"world"}]}'); + $this->mockFunction('json_last_error', fn() => 0); + $this->mockFunction('curl_errno', fn() => 0); + $this->mockFunction('curl_exec', fn() => '{"content":[{"element":"world"}]}'); $this->class->parseToJson(); - $this->unmock_function('curl_exec'); - $this->unmock_function('curl_errno'); - $this->unmock_function('json_last_error'); + $this->unmockFunction('curl_exec'); + $this->unmockFunction('curl_errno'); + $this->unmockFunction('json_last_error'); $obj = (object)[]; $obj2 = (object)[]; diff --git a/src/PHPDraft/Parse/Tests/DrafterTest.php b/src/PHPDraft/Parse/Tests/DrafterTest.php index 9305a73..55ba2d2 100644 --- a/src/PHPDraft/Parse/Tests/DrafterTest.php +++ b/src/PHPDraft/Parse/Tests/DrafterTest.php @@ -9,34 +9,34 @@ namespace PHPDraft\Parse\Tests; -use Lunr\Halo\LunrBaseTest; +use Lunr\Halo\LunrBaseTestCase; use PHPDraft\In\ApibFileParser; use PHPDraft\Parse\Drafter; -use PHPDraft\Parse\ExecutionException; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\MockObject\MockObject; -use ReflectionClass; /** * Class DrafterTest - * - * @covers \PHPDraft\Parse\Drafter */ -class DrafterTest extends LunrBaseTest +#[CoversClass(Drafter::class)] +class DrafterTest extends LunrBaseTestCase { /** * Shared instance of the file parser. * - * @var ApibFileParser|MockObject + * @var ApibFileParser&MockObject */ - private mixed $parser; + private ApibFileParser&MockObject $parser; + + private Drafter $class; /** * Set up */ public function setUp(): void { - $this->mock_function('sys_get_temp_dir', fn() => TEST_STATICS); - $this->mock_function('shell_exec', fn() => "/some/dir/drafter\n"); + $this->mockFunction('sys_get_temp_dir', fn() => TEST_STATICS); + $this->mockFunction('shell_exec', fn() => "/some/dir/drafter\n"); $this->parser = $this->getMockBuilder('\PHPDraft\In\ApibFileParser') ->disableOriginalConstructor() @@ -49,8 +49,8 @@ public function setUp(): void $this->class->init($this->parser); - $this->unmock_function('shell_exec'); - $this->unmock_function('sys_get_temp_dir'); + $this->unmockFunction('shell_exec'); + $this->unmockFunction('sys_get_temp_dir'); } /** @@ -71,12 +71,10 @@ public function tearDown(): void /** * Test if the value the class is initialized with is correct - * - * @covers \PHPDraft\Parse\Drafter::parseToJson() */ public function testSetupCorrectly(): void { - $this->assertInstanceOf('\PHPDraft\In\ApibFileParser', $this->get_reflection_property_value('apib')); + $this->assertInstanceOf('\PHPDraft\In\ApibFileParser', $this->getReflectionPropertyValue('apib')); } /** @@ -84,8 +82,8 @@ public function testSetupCorrectly(): void */ public function testParseToJSON(): void { - $this->mock_function('json_last_error', fn() => JSON_ERROR_NONE); - $this->mock_function('shell_exec', fn() => ""); + $this->mockFunction('json_last_error', fn() => JSON_ERROR_NONE); + $this->mockFunction('shell_exec', fn() => ""); file_put_contents( TEST_STATICS . '/drafter/index.json', file_get_contents(TEST_STATICS . '/drafter/json/index.json') @@ -95,19 +93,17 @@ public function testParseToJSON(): void json_decode(file_get_contents(TEST_STATICS . '/drafter/json/index.json')), $this->class->json ); - $this->unmock_function('shell_exec'); - $this->unmock_function('json_last_error'); + $this->unmockFunction('shell_exec'); + $this->unmockFunction('json_last_error'); } /** * Check if parsing the APIB to JSON gives the expected result with inheritance - * - * @covers \PHPDraft\Parse\Drafter::parseToJson() */ public function testParseToJSONInheritance(): void { - $this->mock_function('json_last_error', fn() => JSON_ERROR_NONE); - $this->mock_function('shell_exec', fn() => ''); + $this->mockFunction('json_last_error', fn() => JSON_ERROR_NONE); + $this->mockFunction('shell_exec', fn() => ''); file_put_contents( TEST_STATICS . '/drafter/index.json', file_get_contents(TEST_STATICS . '/drafter/json/inheritance.json') @@ -117,14 +113,12 @@ public function testParseToJSONInheritance(): void json_decode(file_get_contents(TEST_STATICS . '/drafter/json/inheritance.json')), $this->class->json ); - $this->unmock_function('shell_exec'); - $this->unmock_function('json_last_error'); + $this->unmockFunction('shell_exec'); + $this->unmockFunction('json_last_error'); } /** * Check if parsing the APIB to JSON gives the expected result - * - * @covers \PHPDraft\Parse\Drafter::parseToJson() */ public function testParseToJSONWithErrors(): void { @@ -132,32 +126,28 @@ public function testParseToJSONWithErrors(): void $this->expectExceptionMessage('Parsing encountered errors and stopped'); $this->expectExceptionCode(2); - $this->mock_function('shell_exec', fn() => ''); + $this->mockFunction('shell_exec', fn() => ''); file_put_contents( TEST_STATICS . '/drafter/index.json', file_get_contents(TEST_STATICS . '/drafter/json/error.json') ); $this->class->parseToJson(); $this->expectOutputString("WARNING: ignoring unrecognized block\nWARNING: no headers specified\nWARNING: ignoring unrecognized block\nWARNING: empty request message-body"); - $this->unmock_function('shell_exec'); + $this->unmockFunction('shell_exec'); } /** * Check if parsing the fails without drafter - * - * @covers \PHPDraft\Parse\Drafter::available() */ public function testSetupWithoutDrafter(): void { - $this->mock_function('shell_exec', fn() => ''); + $this->mockFunction('shell_exec', fn() => ''); $this->assertFalse(Drafter::available()); - $this->unmock_function('shell_exec'); + $this->unmockFunction('shell_exec'); } /** * Check if parsing the fails when invalid JSON - * - * @covers \PHPDraft\Parse\Drafter::parseToJson() */ public function testParseToJSONWithInvalidJSON(): void { @@ -165,12 +155,12 @@ public function testParseToJSONWithInvalidJSON(): void $this->expectExceptionMessage('Drafter generated invalid JSON (ERROR)'); $this->expectExceptionCode(2); - $this->mock_function('json_last_error', fn() => JSON_ERROR_DEPTH); - $this->mock_function('json_last_error_msg', fn() => 'ERROR'); + $this->mockFunction('json_last_error', fn() => JSON_ERROR_DEPTH); + $this->mockFunction('json_last_error_msg', fn() => 'ERROR'); file_put_contents(TEST_STATICS . '/drafter/index.json', '["hello: \'world}'); $this->class->parseToJson(); $this->expectOutputString('ERROR: invalid json in /tmp/drafter/index.json'); - $this->unmock_function('json_last_error_msg'); - $this->unmock_function('json_last_error'); + $this->unmockFunction('json_last_error_msg'); + $this->unmockFunction('json_last_error'); } } diff --git a/src/PHPDraft/Parse/Tests/HtmlGeneratorTest.php b/src/PHPDraft/Parse/Tests/HtmlGeneratorTest.php index 723ad8d..0cb1abb 100644 --- a/src/PHPDraft/Parse/Tests/HtmlGeneratorTest.php +++ b/src/PHPDraft/Parse/Tests/HtmlGeneratorTest.php @@ -9,15 +9,16 @@ namespace PHPDraft\Parse\Tests; -use Lunr\Halo\LunrBaseTest; +use Lunr\Halo\LunrBaseTestCase; use PHPDraft\Parse\HtmlGenerator; -use ReflectionClass; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\RequiresPhpExtension; /** - * Class JsonToHTMLTest - * @covers \PHPDraft\Parse\HtmlGenerator + * Class HtmlGeneratorTest */ -class HtmlGeneratorTest extends LunrBaseTest +#[CoversClass(HtmlGenerator::class)] +class HtmlGeneratorTest extends LunrBaseTestCase { /** * Test Class @@ -27,8 +28,8 @@ class HtmlGeneratorTest extends LunrBaseTest /** * Set up - * @requires ext-uopz */ + #[RequiresPhpExtension('uopz')] public function setUp(): void { define('ID_STATIC', 'SOME_ID'); @@ -46,26 +47,25 @@ public function setUp(): void */ public function tearDown(): void { - $this->constant_undefine('ID_STATIC'); + $this->undefineConstant('ID_STATIC'); unset($this->class); unset($this->reflection); } /** * Tests if the constructor sets the property correctly - * - * @requires ext-uopz */ + #[RequiresPhpExtension('uopz')] public function testSetupCorrectly(): void { $json = json_decode(file_get_contents(TEST_STATICS . '/drafter/json/index.json')); - $this->assertEquals($json, $this->get_reflection_property_value('object')); + $this->assertEquals($json, $this->getReflectionPropertyValue('object')); } /** * Tests if the constructor sets the property correctly - * @requires ext-uopz */ + #[RequiresPhpExtension('uopz')] public function testGetHTML(): void { $this->class->build_html(); @@ -78,8 +78,8 @@ public function testGetHTML(): void /** * Tests if the constructor sets the property correctly - * @requires ext-uopz */ + #[RequiresPhpExtension('uopz')] public function testGetHTMLMaterial(): void { $this->class->build_html('material'); @@ -92,8 +92,8 @@ public function testGetHTMLMaterial(): void /** * Tests if the constructor sets the property correctly - * @requires ext-uopz */ + #[RequiresPhpExtension('uopz')] public function testGetHTMLAdvanced(): void { $this->class->build_html('material', 'img.jpg', 'test.css,index.css', 'index.js,test.js'); diff --git a/src/PHPDraft/Parse/Tests/ParserFactoryTest.php b/src/PHPDraft/Parse/Tests/ParserFactoryTest.php index 2cf1890..1108727 100644 --- a/src/PHPDraft/Parse/Tests/ParserFactoryTest.php +++ b/src/PHPDraft/Parse/Tests/ParserFactoryTest.php @@ -2,114 +2,100 @@ namespace PHPDraft\Parse\Tests; -use Lunr\Halo\LunrBaseTest; +use Lunr\Halo\LunrBaseTestCase; +use PHPDraft\Out\OpenAPI\OpenApiRenderer; +use PHPDraft\Parse\Drafter; +use PHPDraft\Parse\DrafterAPI; +use PHPDraft\Parse\HtmlGenerator; use PHPDraft\Parse\ParserFactory; +use PHPDraft\Parse\ResourceException; +use PHPUnit\Framework\Attributes\CoversClass; /** * Class ParserFactoryTest - * @covers \PHPDraft\Parse\ParserFactory */ -class ParserFactoryTest extends LunrBaseTest +#[CoversClass(ParserFactory::class)] +class ParserFactoryTest extends LunrBaseTestCase { - /** - * @covers \PHPDraft\Parse\ParserFactory::getDrafter - */ public function testGetDrafter(): void { - $this->mock_method(['\PHPDraft\Parse\Drafter', 'available'], fn() => true); + $this->mockMethod([Drafter::class, 'available'], fn() => true); - $this->assertInstanceOf('\PHPDraft\Parse\Drafter', ParserFactory::getDrafter()); + $this->assertInstanceOf(Drafter::class, ParserFactory::getDrafter()); - $this->unmock_method(['\PHPDraft\Parse\Drafter', 'available']); + $this->unmockMethod([Drafter::class, 'available']); } - /** - * @covers \PHPDraft\Parse\ParserFactory::getDrafter - */ public function testGetDrafterAPI(): void { - $this->mock_method(['\PHPDraft\Parse\Drafter', 'available'], fn() => false); - $this->mock_method(['\PHPDraft\Parse\DrafterAPI', 'available'], fn() => true); + $this->mockMethod([Drafter::class, 'available'], fn() => false); + $this->mockMethod([DrafterApi::class, 'available'], fn() => true); - $this->assertInstanceOf('\PHPDraft\Parse\DrafterAPI', ParserFactory::getDrafter()); + $this->assertInstanceOf(DrafterApi::class, ParserFactory::getDrafter()); - $this->unmock_method(['\PHPDraft\Parse\Drafter', 'available']); - $this->unmock_method(['\PHPDraft\Parse\DrafterAPI', 'available']); + $this->unmockMethod([Drafter::class, 'available']); + $this->unmockMethod([DrafterApi::class, 'available']); } - /** - * @covers \PHPDraft\Parse\ParserFactory::getDrafter - */ public function testGetDrafterFails(): void { $this->expectException('\PHPDraft\Parse\ResourceException'); $this->expectExceptionMessage('Couldn\'t get an APIB parser'); - $this->mock_method(['\PHPDraft\Parse\Drafter', 'available'], fn() => false); - $this->mock_method(['\PHPDraft\Parse\DrafterAPI', 'available'], fn() => false); + $this->mockMethod([Drafter::class, 'available'], fn() => false); + $this->mockMethod([DrafterApi::class, 'available'], fn() => false); ParserFactory::getDrafter(); - $this->unmock_method(['\PHPDraft\Parse\Drafter', 'available']); - $this->unmock_method(['\PHPDraft\Parse\DrafterAPI', 'available']); + $this->unmockMethod([Drafter::class, 'available']); + $this->unmockMethod([DrafterApi::class, 'available']); } - /** - * @covers \PHPDraft\Parse\ParserFactory::getJson - */ public function testGetJson(): void { - $this->mock_method(['\PHPDraft\Parse\Drafter', 'available'], fn() => false); - $this->mock_method(['\PHPDraft\Parse\DrafterAPI', 'available'], fn() => true); + $this->mockMethod([Drafter::class, 'available'], fn() => false); + $this->mockMethod([DrafterApi::class, 'available'], fn() => true); - $this->assertInstanceOf('\PHPDraft\Parse\HtmlGenerator', ParserFactory::getJson()); + $this->assertInstanceOf(HtmlGenerator::class, ParserFactory::getJson()); - $this->unmock_method(['\PHPDraft\Parse\Drafter', 'available']); - $this->unmock_method(['\PHPDraft\Parse\DrafterAPI', 'available']); + $this->unmockMethod([Drafter::class, 'available']); + $this->unmockMethod([DrafterApi::class, 'available']); } - /** - * @covers \PHPDraft\Parse\ParserFactory::getJson - */ public function testGetJsonFails(): void { - $this->expectException('\PHPDraft\Parse\ResourceException'); + $this->expectException(ResourceException::class); $this->expectExceptionMessage('Couldn\'t get a JSON parser'); - $this->mock_method(['\PHPDraft\Parse\Drafter', 'available'], fn() => false); - $this->mock_method(['\PHPDraft\Parse\DrafterAPI', 'available'], fn() => false); + + $this->mockMethod([Drafter::class, 'available'], fn() => false); + $this->mockMethod([DrafterApi::class, 'available'], fn() => false); ParserFactory::getJson(); - $this->unmock_method(['\PHPDraft\Parse\Drafter', 'available']); - $this->unmock_method(['\PHPDraft\Parse\DrafterAPI', 'available']); + $this->unmockMethod([Drafter::class, 'available']); + $this->unmockMethod([DrafterApi::class, 'available']); } - /** - * @covers \PHPDraft\Parse\ParserFactory::getOpenAPI - */ public function testGetOpenAPI(): void { - $this->mock_method(['\PHPDraft\Parse\Drafter', 'available'], fn() => false); - $this->mock_method(['\PHPDraft\Parse\DrafterAPI', 'available'], fn() => true); + $this->mockMethod([Drafter::class, 'available'], fn() => false); + $this->mockMethod([DrafterApi::class, 'available'], fn() => true); - $this->assertInstanceOf('\PHPDraft\Out\OpenAPI\OpenApiRenderer', ParserFactory::getOpenAPI()); + $this->assertInstanceOf(OpenApiRenderer::class, ParserFactory::getOpenAPI()); - $this->unmock_method(['\PHPDraft\Parse\Drafter', 'available']); - $this->unmock_method(['\PHPDraft\Parse\DrafterAPI', 'available']); + $this->unmockMethod([Drafter::class, 'available']); + $this->unmockMethod([DrafterApi::class, 'available']); } - /** - * @covers \PHPDraft\Parse\ParserFactory::getOpenAPI - */ public function testGetOpenAPIFails(): void { - $this->expectException('\PHPDraft\Parse\ResourceException'); + $this->expectException(ResourceException::class); $this->expectExceptionMessage('Couldn\'t get an OpenAPI renderer'); - $this->mock_method(['\PHPDraft\Parse\Drafter', 'available'], fn() => false); - $this->mock_method(['\PHPDraft\Parse\DrafterAPI', 'available'], fn() => false); + $this->mockMethod([Drafter::class, 'available'], fn() => false); + $this->mockMethod([DrafterApi::class, 'available'], fn() => false); ParserFactory::getOpenAPI(); - $this->unmock_method(['\PHPDraft\Parse\Drafter', 'available']); - $this->unmock_method(['\PHPDraft\Parse\DrafterAPI', 'available']); + $this->unmockMethod([Drafter::class, 'available']); + $this->unmockMethod([DrafterApi::class, 'available']); } }