diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 254cd22..da00fd9 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -11,7 +11,8 @@ jobs: strategy: matrix: - php: [8.1, 8.2, 8.3] + php: [8.1, 8.2, 8.3, 8.4] + composer-options: ["", "--prefer-lowest"] steps: - name: Checkout code @@ -27,7 +28,7 @@ jobs: run: composer validate - name: Install dependencies - run: composer install --prefer-dist --no-progress --no-interaction --no-suggest + run: composer update --prefer-dist --no-progress --no-interaction --no-suggest ${{ matrix.composer-options }} - name: Run test suite run: php vendor/bin/codecept run diff --git a/composer.json b/composer.json index d02a361..6b09a18 100644 --- a/composer.json +++ b/composer.json @@ -19,7 +19,7 @@ "ext-json": "*", "codeception/codeception": "^5.0.8", "codeception/lib-xml": "^1.0", - "justinrainbow/json-schema": "^5.2.9", + "justinrainbow/json-schema": "^5.2.9 || ^6", "softcreatr/jsonpath": "^0.8 || ^0.9" }, "require-dev": { diff --git a/tests/unit/Codeception/Module/RestTest.php b/tests/unit/Codeception/Module/RestTest.php index d78cc8f..563d345 100644 --- a/tests/unit/Codeception/Module/RestTest.php +++ b/tests/unit/Codeception/Module/RestTest.php @@ -2,6 +2,7 @@ declare(strict_types=1); +use Composer\InstalledVersions; use Codeception\Configuration; use Codeception\Exception\ModuleException; use Codeception\Lib\Interfaces\API; @@ -715,10 +716,16 @@ public function testRestExecute(string $configUrl, string $requestUrl, string $e public static function schemaAndResponse(): array { + if (version_compare(InstalledVersions::getVersion('justinrainbow/json-schema'), '6', '>=')) { + $errorInvalidBasicSchema = 'Must have a minimum value greater than or equal to 0'; + } else { + $errorInvalidBasicSchema = 'Must have a minimum value of 0'; + } + return [ //schema, responsefile, valid ['schemas/basic-schema.json', 'responses/valid-basic-schema.json', true, ""], - ['schemas/basic-schema.json', 'responses/invalid-basic-schema.json', false, "Must have a minimum value of 0"], + ['schemas/basic-schema.json', 'responses/invalid-basic-schema.json', false, $errorInvalidBasicSchema], ['schemas/complex-schema.json', 'responses/valid-complex-schema.json', true, ""], ['schemas/complex-schema.json', 'responses/invalid-complex-schema.json', false, "String value found, but a boolean is required"] ];