diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml
index 02c4cfb..b77fcce 100644
--- a/.github/workflows/php.yml
+++ b/.github/workflows/php.yml
@@ -21,10 +21,11 @@ jobs:
- "8.0"
- "8.1"
- "8.2"
+ - "8.3"
dependencies:
- "lowest"
- "highest"
- symfony-yaml: ['^3.4', '^4', '^5', '^6']
+ symfony-yaml: ['^3.4', '^4', '^5', '^6', '^7']
include:
- os: "windows-latest"
php: "8.0"
@@ -47,6 +48,20 @@ jobs:
symfony-yaml: '^6'
- php: '7.4'
symfony-yaml: '^6'
+ # symfony/yaml v7 does not run on PHP 7.*
+ - php: '7.1'
+ symfony-yaml: '^7'
+ - php: '7.2'
+ symfony-yaml: '^7'
+ - php: '7.3'
+ symfony-yaml: '^7'
+ - php: '7.4'
+ symfony-yaml: '^7'
+ # symfony/yaml v7 does not run on PHP 8.0 & 8.1
+ - php: '8.0'
+ symfony-yaml: '^7'
+ - php: '8.1'
+ symfony-yaml: '^7'
# symfony/yaml v3.4 is not compatible with PHP 8.0 but has no upper-bound, so it installs on it
- php: '8.0'
symfony-yaml: '^3.4'
@@ -54,6 +69,8 @@ jobs:
symfony-yaml: '^3.4'
- php: '8.2'
symfony-yaml: '^3.4'
+ - php: '8.3'
+ symfony-yaml: '^3.4'
runs-on: ${{ matrix.os }}
@@ -74,6 +91,10 @@ jobs:
run: "composer require phpunit/phpunit '^9.5' --dev --no-interaction --ansi --no-install"
if: matrix.php == '8.1'
+ - name: Require newer phpunit/phpunit version
+ run: "composer require phpunit/phpunit '^11.4' --dev --no-interaction --ansi --no-install"
+ if: matrix.php == '8.3'
+
- name: "Install dependencies with Composer"
uses: "ramsey/composer-install@v2"
with:
@@ -84,6 +105,11 @@ jobs:
- name: PHPUnit tests
run: make test
+ if: matrix.php < '8.3'
+
+ - name: PHPUnit tests
+ run: make test-debug
+ if: matrix.php == '8.3'
- name: Code coverage
run: make coverage
diff --git a/Makefile b/Makefile
index 3662f26..421c571 100644
--- a/Makefile
+++ b/Makefile
@@ -46,6 +46,11 @@ test: unit test-recursion.json test-recursion2.yaml test-recursion3_index.yaml t
unit:
$(DOCKER_PHP) php $(PHPARGS) $(XPHPARGS) vendor/bin/phpunit --verbose --colors=always $(TESTCASE)
+test-debug: unit-debug test-recursion.json test-recursion2.yaml test-recursion3_index.yaml test-empty-maps.json
+
+unit-debug:
+ $(DOCKER_PHP) php $(PHPARGS) $(XPHPARGS) vendor/bin/phpunit --debug --testdox --colors=always -c phpunit11.xml.dist $(TESTCASE)
+
# test specific JSON files in tests/spec/data/
# e.g. test-recursion will run validation on tests/spec/data/recursion.json
test-%: tests/spec/data/%
diff --git a/composer.json b/composer.json
index 1257b9c..079368a 100755
--- a/composer.json
+++ b/composer.json
@@ -25,11 +25,11 @@
"php": ">=7.1.0",
"ext-json": "*",
"symfony/yaml": "^3.4 || ^4 || ^5 || ^6 || ^7",
- "justinrainbow/json-schema": "^5.2"
+ "justinrainbow/json-schema": "^5.2 || ^6.0"
},
"require-dev": {
"cebe/indent": "*",
- "phpunit/phpunit": "^6.5 || ^7.5 || ^8.5 || ^9.4",
+ "phpunit/phpunit": "^6.5 || ^7.5 || ^8.5 || ^9.4 || ^11.4",
"oai/openapi-specification-3.0": "3.0.3",
"oai/openapi-specification-3.1": "3.1.0",
@@ -41,6 +41,9 @@
"conflict": {
"symfony/yaml": "3.4.0 - 3.4.4 || 4.0.0 - 4.4.17 || 5.0.0 - 5.1.9 || 5.2.0"
},
+ "replace": {
+ "cebe/php-openapi":"1.7.0"
+ },
"autoload": {
"psr-4": {
"cebe\\openapi\\": "src/"
@@ -96,10 +99,9 @@
"package": {
"name": "apis-guru/openapi-directory",
"version": "1.0.0",
- "source": {
- "url": "https://github.com/APIs-guru/openapi-directory",
- "type": "git",
- "reference": "openapi3.0.0"
+ "dist": {
+ "url": "https://github.com/APIs-guru/openapi-directory/archive/refs/heads/openapi3.0.0.zip",
+ "type": "zip"
}
}
}
diff --git a/phpunit11.xml.dist b/phpunit11.xml.dist
new file mode 100644
index 0000000..972a3f3
--- /dev/null
+++ b/phpunit11.xml.dist
@@ -0,0 +1,22 @@
+
+
+
+
+ ./tests
+
+
+
+
+ ./src
+
+
+ ./vendor
+ ./tests
+
+
+
diff --git a/tests/ReferenceContextTest.php b/tests/ReferenceContextTest.php
index b06eb5f..549aec1 100644
--- a/tests/ReferenceContextTest.php
+++ b/tests/ReferenceContextTest.php
@@ -6,7 +6,7 @@
class ReferenceContextTest extends \PHPUnit\Framework\TestCase
{
- public function resolveUriProvider()
+ public static function resolveUriProvider()
{
$data = [
[
@@ -124,7 +124,7 @@ public function testResolveUri($baseUri, $referencedUri, $expected)
$this->assertEquals($expected, $context->resolveRelativeUri($referencedUri));
}
- public function normalizeUriProvider()
+ public static function normalizeUriProvider()
{
$data = [
[
diff --git a/tests/json/JsonPointerTest.php b/tests/json/JsonPointerTest.php
index eddd0ed..af54ffc 100644
--- a/tests/json/JsonPointerTest.php
+++ b/tests/json/JsonPointerTest.php
@@ -5,7 +5,7 @@
class JsonPointerTest extends \PHPUnit\Framework\TestCase
{
- public function encodeDecodeData()
+ public static function encodeDecodeData()
{
return [
['~0', '~'],
@@ -41,7 +41,7 @@ public function testDecode($encoded, $decoded)
/**
* @link https://tools.ietf.org/html/rfc6901#section-5
*/
- public function rfcJsonDocument()
+ public static function rfcJsonDocument()
{
return <<rfcJsonDocument())],
+ ["" , "#" , json_decode(self::rfcJsonDocument())],
["/foo" , "#/foo" , ["bar", "baz"]],
["/foo/0", "#/foo/0", "bar"],
["/" , "#/" , 0],
@@ -80,14 +80,14 @@ public function rfcExamples()
["/m~0n" , "#/m~0n" , 8],
];
foreach ($return as $example) {
- $example[3] = $this->rfcJsonDocument();
+ $example[3] = self::rfcJsonDocument();
yield $example;
}
}
- public function allExamples()
+ public static function allExamples()
{
- yield from $this->rfcExamples();
+ yield from self::rfcExamples();
yield ["/a#b" , "#/a%23b" , 16, '{"a#b": 16}'];
}
@@ -117,11 +117,11 @@ public function testUriEncoding($jsonPointer, $uriJsonPointer, $expectedEvaluati
*/
public function testEvaluation($jsonPointer, $uriJsonPointer, $expectedEvaluation)
{
- $document = json_decode($this->rfcJsonDocument());
+ $document = json_decode(self::rfcJsonDocument());
$pointer = new JsonPointer($jsonPointer);
$this->assertEquals($expectedEvaluation, $pointer->evaluate($document));
- $document = json_decode($this->rfcJsonDocument());
+ $document = json_decode(self::rfcJsonDocument());
$reference = JsonReference::createFromReference($uriJsonPointer);
$this->assertEquals($expectedEvaluation, $reference->getJsonPointer()->evaluate($document));
}
diff --git a/tests/spec/MediaTypeTest.php b/tests/spec/MediaTypeTest.php
index 125e721..65b3e75 100644
--- a/tests/spec/MediaTypeTest.php
+++ b/tests/spec/MediaTypeTest.php
@@ -103,7 +103,7 @@ public function testCreateionFromObjects()
$this->assertInstanceOf(\cebe\openapi\spec\Encoding::class, $mediaType->encoding['profileImage']);
}
- public function badEncodingProvider()
+ public static function badEncodingProvider()
{
yield [['encoding' => ['id' => 'foo']], 'Encoding MUST be either array or Encoding object, "string" given'];
yield [['encoding' => ['id' => 42]], 'Encoding MUST be either array or Encoding object, "integer" given'];
diff --git a/tests/spec/OpenApiTest.php b/tests/spec/OpenApiTest.php
index dcde181..8c8856a 100755
--- a/tests/spec/OpenApiTest.php
+++ b/tests/spec/OpenApiTest.php
@@ -89,7 +89,7 @@ public function assertAllInstanceOf($className, $array)
}
}
- public function specProvider()
+ public static function specProvider()
{
// examples from https://github.com/OAI/OpenAPI-Specification/tree/master/examples/v3.0
$oaiExamples = [
diff --git a/tests/spec/PathTest.php b/tests/spec/PathTest.php
index d028258..b901aa7 100644
--- a/tests/spec/PathTest.php
+++ b/tests/spec/PathTest.php
@@ -88,7 +88,7 @@ public function testCreationFromObjects()
$this->assertSame('The pets list is gone 🙀', $paths->getPath('/pets')->get->responses->getResponse(404)->description);
}
- public function badPathsConfigProvider()
+ public static function badPathsConfigProvider()
{
yield [['/pets' => 'foo'], 'Path MUST be either array or PathItem object, "string" given'];
yield [['/pets' => 42], 'Path MUST be either array or PathItem object, "integer" given'];
diff --git a/tests/spec/ResponseTest.php b/tests/spec/ResponseTest.php
index d11b8e2..be240bc 100644
--- a/tests/spec/ResponseTest.php
+++ b/tests/spec/ResponseTest.php
@@ -174,7 +174,7 @@ public function testCreateionFromObjects()
$this->assertSame('The pets list is gone 🙀', $responses->getResponse(404)->description);
}
- public function badResponseProvider()
+ public static function badResponseProvider()
{
yield [['200' => 'foo'], 'Response MUST be either an array, a Response or a Reference object, "string" given'];
yield [['200' => 42], 'Response MUST be either an array, a Response or a Reference object, "integer" given'];
diff --git a/tests/spec/SchemaTest.php b/tests/spec/SchemaTest.php
index 4c307b2..2cad357 100644
--- a/tests/spec/SchemaTest.php
+++ b/tests/spec/SchemaTest.php
@@ -225,7 +225,7 @@ public function testCreateionFromObjects()
}
- public function badSchemaProvider()
+ public static function badSchemaProvider()
{
yield [['properties' => ['a' => 'foo']], 'Unable to instantiate cebe\openapi\spec\Schema Object with data \'foo\''];
yield [['properties' => ['a' => 42]], 'Unable to instantiate cebe\openapi\spec\Schema Object with data \'42\''];