Skip to content

Commit 6c80091

Browse files
author
oriol.navascuez
committed
PHPUnit 11 and PHP8.3 all data providers have to be static
1 parent 078e7ff commit 6c80091

File tree

7 files changed

+16
-16
lines changed

7 files changed

+16
-16
lines changed

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)