Skip to content

Commit 9ae960c

Browse files
committed
Merge branch 'onavascuez-Adding_php83'
2 parents fc3e73e + 9b7f746 commit 9ae960c

File tree

11 files changed

+71
-18
lines changed

11 files changed

+71
-18
lines changed

.github/workflows/php.yml

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,11 @@ jobs:
2020
- "7.4"
2121
- "8.0"
2222
- "8.1"
23+
- "8.3"
2324
dependencies:
2425
- "lowest"
2526
- "highest"
26-
symfony-yaml: ['^3.4', '^4', '^5', '^6']
27+
symfony-yaml: ['^3.4', '^4', '^5', '^6', '^7']
2728
include:
2829
- os: "windows-latest"
2930
php: "8.0"
@@ -46,11 +47,27 @@ jobs:
4647
symfony-yaml: '^6'
4748
- php: '7.4'
4849
symfony-yaml: '^6'
50+
# symfony/yaml v7 does not run on PHP 7.*
51+
- php: '7.1'
52+
symfony-yaml: '^7'
53+
- php: '7.2'
54+
symfony-yaml: '^7'
55+
- php: '7.3'
56+
symfony-yaml: '^7'
57+
- php: '7.4'
58+
symfony-yaml: '^7'
59+
# symfony/yaml v7 does not run on PHP 8.0 & 8.1
60+
- php: '8.0'
61+
symfony-yaml: '^7'
62+
- php: '8.1'
63+
symfony-yaml: '^7'
4964
# symfony/yaml v3.4 is not compatible with PHP 8.0 but has no upper-bound, so it installs on it
5065
- php: '8.0'
5166
symfony-yaml: '^3.4'
5267
- php: '8.1'
5368
symfony-yaml: '^3.4'
69+
- php: '8.3'
70+
symfony-yaml: '^3.4'
5471

5572
runs-on: ${{ matrix.os }}
5673

@@ -71,6 +88,10 @@ jobs:
7188
run: "composer require phpunit/phpunit '^9.5' --dev --no-interaction --ansi --no-install"
7289
if: matrix.php == '8.1'
7390

91+
- name: Require newer phpunit/phpunit version
92+
run: "composer require phpunit/phpunit '^11.4' --dev --no-interaction --ansi --no-install"
93+
if: matrix.php == '8.3'
94+
7495
- name: "Install dependencies with Composer"
7596
uses: "ramsey/composer-install@v2"
7697
with:
@@ -81,6 +102,11 @@ jobs:
81102

82103
- name: PHPUnit tests
83104
run: make test
105+
if: matrix.php < '8.3'
106+
107+
- name: PHPUnit tests
108+
run: make test-debug
109+
if: matrix.php == '8.3'
84110

85111
- name: Code coverage
86112
run: make coverage

Makefile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,11 @@ test: unit test-recursion.json test-recursion2.yaml test-recursion3_index.yaml t
4646
unit:
4747
$(DOCKER_PHP) php $(PHPARGS) $(XPHPARGS) vendor/bin/phpunit --verbose --colors=always $(TESTCASE)
4848

49+
test-debug: unit-debug test-recursion.json test-recursion2.yaml test-recursion3_index.yaml test-empty-maps.json
50+
51+
unit-debug:
52+
$(DOCKER_PHP) php $(PHPARGS) $(XPHPARGS) vendor/bin/phpunit --debug --testdox --colors=always -c phpunit11.xml.dist $(TESTCASE)
53+
4954
# test specific JSON files in tests/spec/data/
5055
# e.g. test-recursion will run validation on tests/spec/data/recursion.json
5156
test-%: tests/spec/data/%

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
},
3030
"require-dev": {
3131
"cebe/indent": "*",
32-
"phpunit/phpunit": "^6.5 || ^7.5 || ^8.5 || ^9.4",
32+
"phpunit/phpunit": "^6.5 || ^7.5 || ^8.5 || ^9.4 || ^11.4",
3333

3434
"oai/openapi-specification-3.0": "3.0.3",
3535
"oai/openapi-specification-3.1": "3.1.0",

phpunit11.xml.dist

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<phpunit
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/11.4/phpunit.xsd"
5+
bootstrap="./tests/bootstrap.php"
6+
colors="true"
7+
stopOnFailure="false">
8+
<testsuites>
9+
<testsuite name="Test Suite">
10+
<directory suffix="Test.php">./tests</directory>
11+
</testsuite>
12+
</testsuites>
13+
<coverage>
14+
<include>
15+
<directory>./src</directory>
16+
</include>
17+
<exclude>
18+
<directory>./vendor</directory>
19+
<directory>./tests</directory>
20+
</exclude>
21+
</coverage>
22+
</phpunit>

tests/ReferenceContextTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
class ReferenceContextTest extends \PHPUnit\Framework\TestCase
88
{
9-
public function resolveUriProvider()
9+
public static function resolveUriProvider()
1010
{
1111
$data = [
1212
[
@@ -124,7 +124,7 @@ public function testResolveUri($baseUri, $referencedUri, $expected)
124124
$this->assertEquals($expected, $context->resolveRelativeUri($referencedUri));
125125
}
126126

127-
public function normalizeUriProvider()
127+
public static function normalizeUriProvider()
128128
{
129129
$data = [
130130
[

tests/json/JsonPointerTest.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
class JsonPointerTest extends \PHPUnit\Framework\TestCase
77
{
8-
public function encodeDecodeData()
8+
public static function encodeDecodeData()
99
{
1010
return [
1111
['~0', '~'],
@@ -41,7 +41,7 @@ public function testDecode($encoded, $decoded)
4141
/**
4242
* @link https://tools.ietf.org/html/rfc6901#section-5
4343
*/
44-
public function rfcJsonDocument()
44+
public static function rfcJsonDocument()
4545
{
4646
return <<<JSON
4747
{
@@ -63,10 +63,10 @@ public function rfcJsonDocument()
6363
/**
6464
* @link https://tools.ietf.org/html/rfc6901#section-5
6565
*/
66-
public function rfcExamples()
66+
public static function rfcExamples()
6767
{
6868
$return = [
69-
["" , "#" , json_decode($this->rfcJsonDocument())],
69+
["" , "#" , json_decode(self::rfcJsonDocument())],
7070
["/foo" , "#/foo" , ["bar", "baz"]],
7171
["/foo/0", "#/foo/0", "bar"],
7272
["/" , "#/" , 0],
@@ -80,14 +80,14 @@ public function rfcExamples()
8080
["/m~0n" , "#/m~0n" , 8],
8181
];
8282
foreach ($return as $example) {
83-
$example[3] = $this->rfcJsonDocument();
83+
$example[3] = self::rfcJsonDocument();
8484
yield $example;
8585
}
8686
}
8787

88-
public function allExamples()
88+
public static function allExamples()
8989
{
90-
yield from $this->rfcExamples();
90+
yield from self::rfcExamples();
9191

9292
yield ["/a#b" , "#/a%23b" , 16, '{"a#b": 16}'];
9393
}
@@ -117,11 +117,11 @@ public function testUriEncoding($jsonPointer, $uriJsonPointer, $expectedEvaluati
117117
*/
118118
public function testEvaluation($jsonPointer, $uriJsonPointer, $expectedEvaluation)
119119
{
120-
$document = json_decode($this->rfcJsonDocument());
120+
$document = json_decode(self::rfcJsonDocument());
121121
$pointer = new JsonPointer($jsonPointer);
122122
$this->assertEquals($expectedEvaluation, $pointer->evaluate($document));
123123

124-
$document = json_decode($this->rfcJsonDocument());
124+
$document = json_decode(self::rfcJsonDocument());
125125
$reference = JsonReference::createFromReference($uriJsonPointer);
126126
$this->assertEquals($expectedEvaluation, $reference->getJsonPointer()->evaluate($document));
127127
}

tests/spec/MediaTypeTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ public function testCreateionFromObjects()
103103
$this->assertInstanceOf(\cebe\openapi\spec\Encoding::class, $mediaType->encoding['profileImage']);
104104
}
105105

106-
public function badEncodingProvider()
106+
public static function badEncodingProvider()
107107
{
108108
yield [['encoding' => ['id' => 'foo']], 'Encoding MUST be either array or Encoding object, "string" given'];
109109
yield [['encoding' => ['id' => 42]], 'Encoding MUST be either array or Encoding object, "integer" given'];

tests/spec/OpenApiTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ public function assertAllInstanceOf($className, $array)
8989
}
9090
}
9191

92-
public function specProvider()
92+
public static function specProvider()
9393
{
9494
// examples from https://github.com/OAI/OpenAPI-Specification/tree/master/examples/v3.0
9595
$oaiExamples = [

tests/spec/PathTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ public function testCreationFromObjects()
8888
$this->assertSame('The pets list is gone 🙀', $paths->getPath('/pets')->get->responses->getResponse(404)->description);
8989
}
9090

91-
public function badPathsConfigProvider()
91+
public static function badPathsConfigProvider()
9292
{
9393
yield [['/pets' => 'foo'], 'Path MUST be either array or PathItem object, "string" given'];
9494
yield [['/pets' => 42], 'Path MUST be either array or PathItem object, "integer" given'];

tests/spec/ResponseTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ public function testCreateionFromObjects()
174174
$this->assertSame('The pets list is gone 🙀', $responses->getResponse(404)->description);
175175
}
176176

177-
public function badResponseProvider()
177+
public static function badResponseProvider()
178178
{
179179
yield [['200' => 'foo'], 'Response MUST be either an array, a Response or a Reference object, "string" given'];
180180
yield [['200' => 42], 'Response MUST be either an array, a Response or a Reference object, "integer" given'];

tests/spec/SchemaTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ public function testCreateionFromObjects()
225225
}
226226

227227

228-
public function badSchemaProvider()
228+
public static function badSchemaProvider()
229229
{
230230
yield [['properties' => ['a' => 'foo']], 'Unable to instantiate cebe\openapi\spec\Schema Object with data \'foo\''];
231231
yield [['properties' => ['a' => 42]], 'Unable to instantiate cebe\openapi\spec\Schema Object with data \'42\''];

0 commit comments

Comments
 (0)