Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow installation of justinrainbow/json-schema:6.0 #108

Merged
merged 3 commits into from
Jul 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
9 changes: 8 additions & 1 deletion tests/unit/Codeception/Module/RestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

declare(strict_types=1);

use Composer\InstalledVersions;
use Codeception\Configuration;
use Codeception\Exception\ModuleException;
use Codeception\Lib\Interfaces\API;
Expand Down Expand Up @@ -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"]
];
Expand Down
Loading