From 18706c9cce848ca0b1059ebe8fcf2f93e24547cf Mon Sep 17 00:00:00 2001 From: rahal Date: Fri, 8 Dec 2023 00:07:56 +0100 Subject: [PATCH] Fixed support for php8.2, added testing action --- .github/workflows/php.yml | 45 +++++++++++++++++++++++++++++++++++++++ composer.json | 7 ++++-- src/Schematron.php | 5 ++--- 3 files changed, 52 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/php.yml diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml new file mode 100644 index 0000000..beb527e --- /dev/null +++ b/.github/workflows/php.yml @@ -0,0 +1,45 @@ +name: validate and test + +on: + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] + +permissions: + contents: read + +jobs: + build: + runs-on: ubuntu-latest + + strategy: + matrix: + php-versions: ['8.0', '8.1' , '8.2' , '8.3'] + + steps: + - uses: actions/checkout@v3 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php-versions }} + extensions: libxml, xml, dom + + - name: Cache Composer packages + id: composer-cache + uses: actions/cache@v3 + with: + path: vendor + key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }} + restore-keys: | + ${{ runner.os }}-php- + + - name: Install dependencies + run: composer install --no-interaction --dev + + - name: check test env + run: php vendor/bin/tester -i + + - name: Run test suite + run: php vendor/bin/tester -C -s tests diff --git a/composer.json b/composer.json index deaa659..835de80 100644 --- a/composer.json +++ b/composer.json @@ -14,9 +14,12 @@ "ext-dom": "*" }, "require-dev": { - "nette/tester": "~1.1.0" + "nette/tester": "^2.5" }, "autoload": { "classmap": ["src/Schematron.php"] - } + }, + "scripts": { + "test": "vendor/bin/tester -s tests" + } } diff --git a/src/Schematron.php b/src/Schematron.php index d4a725c..cac4528 100644 --- a/src/Schematron.php +++ b/src/Schematron.php @@ -7,7 +7,6 @@ use DOMDocument, DOMElement, DOMNode, - DOMNodeList, DOMXPath; use ErrorException, @@ -999,7 +998,7 @@ class SchematronXPath extends DOMXPath /** * ($registerNodeNS is FALSE in opposition to DOMXPath default value) */ - public function query($expression, DOMNode $context = NULL, $registerNodeNS = FALSE) + public function query($expression, DOMNode $context = NULL, $registerNodeNS = FALSE): mixed { return parent::query($expression, $context, $registerNodeNS); } @@ -1009,7 +1008,7 @@ public function query($expression, DOMNode $context = NULL, $registerNodeNS = FA /** * ($registerNodeNS is FALSE in opposition to DOMXPath default value) */ - public function evaluate($expression, DOMNode $context = NULL, $registerNodeNS = FALSE) + public function evaluate($expression, DOMNode $context = NULL, $registerNodeNS = FALSE): mixed { return parent::evaluate($expression, $context, $registerNodeNS); }