Skip to content

Commit a582629

Browse files
committed
fix: fix tests
1 parent 3f1eae1 commit a582629

4 files changed

Lines changed: 61 additions & 7 deletions

File tree

tests/Functional/BackedEnumResourceTest.php

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,15 @@ public static function providerEnumItemsJson(): iterable
6969
'@context' => '/contexts/Availability',
7070
'@id' => '/availabilities/'.$case->value,
7171
'@type' => 'Availability',
72+
'operation' => [
73+
[
74+
'@type' => ['hydra:Operation', 'schema:FindAction'],
75+
'hydra:method' => 'GET',
76+
'hydra:title' => 'getAvailability',
77+
'hydra:description' => 'Retrieves a Availability resource.',
78+
'returns' => 'Availability',
79+
],
80+
],
7281
'value' => $case->value,
7382
]];
7483
}
@@ -100,6 +109,15 @@ public static function providerEnumItemsJson(): iterable
100109
'@context' => '/contexts/AvailabilityStatus',
101110
'@id' => '/availability_statuses/'.$case->value,
102111
'@type' => 'AvailabilityStatus',
112+
'operation' => [
113+
[
114+
'@type' => ['hydra:Operation', 'schema:FindAction'],
115+
'hydra:method' => 'GET',
116+
'hydra:title' => 'getAvailabilityStatus',
117+
'hydra:description' => 'Retrieves a AvailabilityStatus resource.',
118+
'returns' => 'AvailabilityStatus',
119+
],
120+
],
103121
'value' => $case->value,
104122
]];
105123
}
@@ -457,6 +475,15 @@ public static function providerItem(): iterable
457475
'@context' => '/contexts/BackedEnumIntegerResource',
458476
'@id' => '/backed_enum_integer_resources/1',
459477
'@type' => 'BackedEnumIntegerResource',
478+
'operation' => [
479+
[
480+
'@type' => ['hydra:Operation', 'schema:FindAction'],
481+
'hydra:method' => 'GET',
482+
'hydra:title' => 'getBackedEnumIntegerResource',
483+
'hydra:description' => 'Retrieves a BackedEnumIntegerResource resource.',
484+
'returns' => 'BackedEnumIntegerResource',
485+
],
486+
],
460487
'name' => 'Yes',
461488
'value' => 1,
462489
'description' => 'We say yes',

tests/Functional/MathNumberTest.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,15 @@ public function testGetMathNumber(): void
5454
'@context' => '/contexts/MathNumber',
5555
'@id' => '/math_numbers/1',
5656
'@type' => 'MathNumber',
57+
'operation' => [
58+
[
59+
'@type' => ['hydra:Operation', 'schema:FindAction'],
60+
'hydra:method' => 'GET',
61+
'hydra:title' => 'getMathNumber',
62+
'hydra:description' => 'Retrieves a MathNumber resource.',
63+
'returns' => 'MathNumber',
64+
],
65+
],
5766
'id' => 1,
5867
'value' => '300.55',
5968
]);
@@ -74,6 +83,15 @@ public function testPostMathNumber(): void
7483
'@context' => '/contexts/MathNumber',
7584
'@id' => '/math_numbers/2',
7685
'@type' => 'MathNumber',
86+
'operation' => [
87+
[
88+
'@type' => ['hydra:Operation', 'schema:FindAction'],
89+
'hydra:method' => 'GET',
90+
'hydra:title' => 'getMathNumber',
91+
'hydra:description' => 'Retrieves a MathNumber resource.',
92+
'returns' => 'MathNumber',
93+
],
94+
],
7795
'id' => 2,
7896
'value' => '120.23',
7997
]);

tests/JsonLd/Serializer/ItemNormalizerTest.php

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -90,12 +90,15 @@ public function testNormalize(): void
9090
);
9191
$normalizer->setSerializer($serializerProphecy->reveal());
9292

93-
$expected = [
94-
'@context' => '/contexts/Dummy',
95-
'@id' => '/dummies/1988',
96-
'@type' => 'Dummy',
97-
'name' => 'hello',
98-
];
99-
$this->assertEquals($expected, $normalizer->normalize($dummy));
93+
$result = $normalizer->normalize($dummy);
94+
95+
$this->assertEquals('/contexts/Dummy', $result['@context']);
96+
$this->assertEquals('/dummies/1988', $result['@id']);
97+
$this->assertEquals('Dummy', $result['@type']);
98+
$this->assertEquals('hello', $result['name']);
99+
100+
$this->assertArrayHasKey('operation', $result);
101+
$this->assertIsArray($result['operation']);
102+
$this->assertCount(1, $result['operation']);
100103
}
101104
}

tests/Symfony/Bundle/Test/ApiTestCaseTest.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -365,6 +365,12 @@ public function testGetMercureMessages(): void
365365
"readOnly": true,
366366
"type": "string"
367367
},
368+
"operation": {
369+
"type": "array",
370+
"items": {
371+
"type": "object"
372+
}
373+
},
368374
"id": {
369375
"type": "number"
370376
},

0 commit comments

Comments
 (0)