Skip to content

Commit 110fca6

Browse files
authored
Allow installation of justinrainbow/json-schema:6.0 (#108)
* Allow installation of justinrainbow/json-schema:6 * Test against lowest dependency versions * Test against PHP 8.4
1 parent 086762e commit 110fca6

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed

.github/workflows/main.yml

+3-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ jobs:
1111

1212
strategy:
1313
matrix:
14-
php: [8.1, 8.2, 8.3]
14+
php: [8.1, 8.2, 8.3, 8.4]
15+
composer-options: ["", "--prefer-lowest"]
1516

1617
steps:
1718
- name: Checkout code
@@ -27,7 +28,7 @@ jobs:
2728
run: composer validate
2829

2930
- name: Install dependencies
30-
run: composer install --prefer-dist --no-progress --no-interaction --no-suggest
31+
run: composer update --prefer-dist --no-progress --no-interaction --no-suggest ${{ matrix.composer-options }}
3132

3233
- name: Run test suite
3334
run: php vendor/bin/codecept run

composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"ext-json": "*",
2020
"codeception/codeception": "^5.0.8",
2121
"codeception/lib-xml": "^1.0",
22-
"justinrainbow/json-schema": "^5.2.9",
22+
"justinrainbow/json-schema": "^5.2.9 || ^6",
2323
"softcreatr/jsonpath": "^0.8 || ^0.9"
2424
},
2525
"require-dev": {

tests/unit/Codeception/Module/RestTest.php

+8-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
declare(strict_types=1);
44

5+
use Composer\InstalledVersions;
56
use Codeception\Configuration;
67
use Codeception\Exception\ModuleException;
78
use Codeception\Lib\Interfaces\API;
@@ -715,10 +716,16 @@ public function testRestExecute(string $configUrl, string $requestUrl, string $e
715716

716717
public static function schemaAndResponse(): array
717718
{
719+
if (version_compare(InstalledVersions::getVersion('justinrainbow/json-schema'), '6', '>=')) {
720+
$errorInvalidBasicSchema = 'Must have a minimum value greater than or equal to 0';
721+
} else {
722+
$errorInvalidBasicSchema = 'Must have a minimum value of 0';
723+
}
724+
718725
return [
719726
//schema, responsefile, valid
720727
['schemas/basic-schema.json', 'responses/valid-basic-schema.json', true, ""],
721-
['schemas/basic-schema.json', 'responses/invalid-basic-schema.json', false, "Must have a minimum value of 0"],
728+
['schemas/basic-schema.json', 'responses/invalid-basic-schema.json', false, $errorInvalidBasicSchema],
722729
['schemas/complex-schema.json', 'responses/valid-complex-schema.json', true, ""],
723730
['schemas/complex-schema.json', 'responses/invalid-complex-schema.json', false, "String value found, but a boolean is required"]
724731
];

0 commit comments

Comments
 (0)