From b87a115ba08205e864a815721a2aa39c1eb02bce Mon Sep 17 00:00:00 2001 From: tomas-novotny Date: Sat, 20 Apr 2024 16:08:08 +0200 Subject: [PATCH] Update test tools --- .github/workflows/master.yml | 2 ++ composer-require-checker.json | 5 ----- composer.json | 24 ++++++++---------------- phive.xml | 6 ------ phpstan.neon | 4 ---- phpunit.xml.dist | 2 -- src/Builder/BaseNode.php | 4 ++-- src/Formatter/BaseConfig.php | 2 +- src/Formatter/FlattenConfig.php | 2 +- src/Formatter/FullResponseConfig.php | 2 +- tests/Reader/DefaultReaderTest.php | 3 ++- 11 files changed, 17 insertions(+), 39 deletions(-) delete mode 100644 composer-require-checker.json delete mode 100644 phive.xml diff --git a/.github/workflows/master.yml b/.github/workflows/master.yml index 7ed5e46..006ee63 100644 --- a/.github/workflows/master.yml +++ b/.github/workflows/master.yml @@ -12,6 +12,7 @@ jobs: matrix: php: - '8.2' + - '8.3' steps: - uses: actions/checkout@v2 with: @@ -36,6 +37,7 @@ jobs: run: | vendor/bin/phpcs src tests vendor/bin/phpstan analyse -c phpstan.neon + vendor/bin/composer-dependency-analyser - name: Run tests run: | vendor/bin/phpunit --coverage-text --coverage-clover=coverage.clover diff --git a/composer-require-checker.json b/composer-require-checker.json deleted file mode 100644 index 8a85c18..0000000 --- a/composer-require-checker.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "symbol-whitelist" : [ - "DOMXpath" - ] -} diff --git a/composer.json b/composer.json index 4f95119..443158b 100755 --- a/composer.json +++ b/composer.json @@ -28,10 +28,11 @@ "inspirum/arrayable": "^1.2" }, "require-dev": { - "inspirum/coding-standard": "^1.3", + "inspirum/coding-standard": "^1.4", "phpstan/phpstan": "^1.10", - "phpunit/phpunit": "^10.1", - "squizlabs/php_codesniffer": "^3.7" + "phpunit/phpunit": "^10.3", + "shipmonk/composer-dependency-analyser": "^1.5", + "squizlabs/php_codesniffer": "^3.9" }, "autoload": { "psr-4": { @@ -54,8 +55,7 @@ "@style:phpcs", "@test:unit", "@style:phpstan", - "@check:requirement", - "@check:unused" + "@check:dependency" ], "test:test": [ "@test:unit" @@ -66,9 +66,6 @@ "test:coverage": [ "@phpunit --coverage-text --coverage-html=var/phpunit/coverage" ], - "test:infection": [ - "@infection" - ], "style:phpcs": [ "@phpcs" ], @@ -82,18 +79,13 @@ "style:fix": [ "@phpcbf src tests" ], - "check:requirement": [ - "@composerRequireChecker" - ], - "check:unused": [ - "@composerUnused" + "check:dependency": [ + "@composer-dependency-analyser" ], "phpunit": "./vendor/bin/phpunit", "phpcs": "./vendor/bin/phpcs -p -s --extensions=php --colors --report-width=140 || true", "phpstan": "./vendor/bin/phpstan analyse -c phpstan.neon", "phpcbf": "./vendor/bin/phpcbf -p --extensions=php", - "infection": "./tools/infection", - "composerRequireChecker": "./tools/composer-require-checker check --config-file=$PWD/composer-require-checker.json", - "composerUnused": "./tools/composer-unused" + "composer-dependency-analyser": "./vendor/bin/composer-dependency-analyser" } } diff --git a/phive.xml b/phive.xml deleted file mode 100644 index 69d7ea9..0000000 --- a/phive.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/phpstan.neon b/phpstan.neon index f7d97a7..4bd8ee6 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -11,7 +11,3 @@ parameters: path: src/Reader/DefaultReader.php count: 5 reportUnmatched: false - - - message: '#^Method .+\:\:toArray\(\) should return array\<.+\> but returns array\.$#' - path: src/Builder/BaseNode.php - count: 1 diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 0efc223..e12880a 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -3,8 +3,6 @@ - - diff --git a/src/Builder/BaseNode.php b/src/Builder/BaseNode.php index 4c7ca0f..e63001d 100644 --- a/src/Builder/BaseNode.php +++ b/src/Builder/BaseNode.php @@ -10,7 +10,7 @@ use DOMException; use DOMNode; use DOMText; -use DOMXpath; +use DOMXPath; use Inspirum\XML\Exception\Handler; use Inspirum\XML\Formatter\Config; use Inspirum\XML\Formatter\DefaultConfig; @@ -301,7 +301,7 @@ private function getAttributesFromNode(DOMNode $node, bool $autoCast = false): a */ public function xpath(string $expression): ?array { - $xpath = new DOMXpath($this->toDOMDocument()); + $xpath = new DOMXPath($this->toDOMDocument()); $nodes = $xpath->query($expression); if ($nodes === false) { diff --git a/src/Formatter/BaseConfig.php b/src/Formatter/BaseConfig.php index d5addd0..d7a5375 100644 --- a/src/Formatter/BaseConfig.php +++ b/src/Formatter/BaseConfig.php @@ -16,7 +16,7 @@ * @param list|true $alwaysArray */ public function __construct( - private array | true $alwaysArray = [], + private array|true $alwaysArray = [], private bool $autoCast = false, private ?string $attributesName = null, private ?string $valueName = null, diff --git a/src/Formatter/FlattenConfig.php b/src/Formatter/FlattenConfig.php index a121ba4..6af6d30 100644 --- a/src/Formatter/FlattenConfig.php +++ b/src/Formatter/FlattenConfig.php @@ -10,7 +10,7 @@ * @param list|true $alwaysArray */ public function __construct( - array | true $alwaysArray = [], + array|true $alwaysArray = [], bool $autoCast = false, private ?string $flattenNodes = null, private ?string $flattenAttributes = null, diff --git a/src/Formatter/FullResponseConfig.php b/src/Formatter/FullResponseConfig.php index bb5ac3d..9d1e533 100644 --- a/src/Formatter/FullResponseConfig.php +++ b/src/Formatter/FullResponseConfig.php @@ -10,7 +10,7 @@ * @param list|true $alwaysArray */ public function __construct( - array | true $alwaysArray = [], + array|true $alwaysArray = [], bool $autoCast = false, ?string $attributesName = null, ?string $valueName = null, diff --git a/tests/Reader/DefaultReaderTest.php b/tests/Reader/DefaultReaderTest.php index 13339fa..de60681 100644 --- a/tests/Reader/DefaultReaderTest.php +++ b/tests/Reader/DefaultReaderTest.php @@ -401,9 +401,10 @@ public function testIterateWithSimpleLoadString(string $file, bool $withNamespac /** * @param array|string> $expected + * @param array|string>|null $expectedOverride */ #[DataProvider('provideIterateXpath')] - public function testIterateWithXpath(string $file, bool $withNamespaces, string $path, array $expected): void + public function testIterateWithXpath(string $file, bool $withNamespaces, string $path, array $expected, ?array $expectedOverride = null): void { $reader = $this->newReader(self::getTestFilePath($file));