Skip to content

Commit

Permalink
test(hydra): tests changed because context json changed
Browse files Browse the repository at this point in the history
  • Loading branch information
Valentin Dassonville committed Oct 14, 2024
1 parent 30f0566 commit 917a0df
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 47 deletions.
6 changes: 1 addition & 5 deletions features/hydra/docs.feature
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,6 @@ Feature: Documentation support
And the JSON node "@context[1].range.@type" should be equal to "@id"
And the JSON node "@context[1].subClassOf.@id" should be equal to "rdfs:subClassOf"
And the JSON node "@context[1].subClassOf.@type" should be equal to "@id"
And the JSON node "@context[1].expects.@id" should be equal to "hydra:expects"
And the JSON node "@context[1].expects.@type" should be equal to "@id"
And the JSON node "@context[1].returns.@id" should be equal to "hydra:returns"
And the JSON node "@context[1].returns.@type" should be equal to "@id"
# Root properties
And the JSON node "@id" should be equal to "/docs.jsonld"
And the JSON node "hydra:title" should be equal to "My Dummy API"
Expand Down Expand Up @@ -80,7 +76,7 @@ Feature: Documentation support
And the value of the node "hydra:method" of the operation "GET" of the Hydra class "Dummy" is "GET"
And the value of the node "hydra:title" of the operation "GET" of the Hydra class "Dummy" is "Retrieves a Dummy resource."
And the value of the node "rdfs:label" of the operation "GET" of the Hydra class "Dummy" is "Retrieves a Dummy resource."
And the value of the node "returns" of the operation "GET" of the Hydra class "Dummy" is "#Dummy"
And the value of the node "returns" of the operation "GET" of the Hydra class "Dummy" is "Dummy"
And the value of the node "hydra:title" of the operation "PUT" of the Hydra class "Dummy" is "Replaces the Dummy resource."
And the value of the node "hydra:title" of the operation "DELETE" of the Hydra class "Dummy" is "Deletes the Dummy resource."
And the value of the node "returns" of the operation "DELETE" of the Hydra class "Dummy" is "owl:Nothing"
Expand Down
60 changes: 18 additions & 42 deletions src/Hydra/Tests/Serializer/DocumentationNormalizerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,14 +127,6 @@ private function doTestNormalize($resourceMetadataFactory = null): void
'@id' => 'rdfs:subClassOf',
'@type' => '@id',
],
'expects' => [
'@id' => 'hydra:expects',
'@type' => '@id',
],
'returns' => [
'@id' => 'hydra:returns',
'@type' => '@id',
],
],
],
'@id' => '/doc',
Expand Down Expand Up @@ -229,23 +221,23 @@ private function doTestNormalize($resourceMetadataFactory = null): void
'hydra:method' => 'GET',
'hydra:title' => 'foobar',
'rdfs:label' => 'foobar',
'returns' => '#dummy',
'returns' => 'dummy',
'hydra:foo' => 'bar',
],
[
'@type' => ['hydra:Operation', 'schema:ReplaceAction'],
'expects' => '#dummy',
'expects' => 'dummy',
'hydra:method' => 'PUT',
'hydra:title' => 'Replaces the dummy resource.',
'rdfs:label' => 'Replaces the dummy resource.',
'returns' => '#dummy',
'returns' => 'dummy',
],
[
'@type' => ['hydra:Operation', 'schema:FindAction'],
'hydra:method' => 'GET',
'hydra:title' => 'Retrieves a relatedDummy resource.',
'rdfs:label' => 'Retrieves a relatedDummy resource.',
'returns' => '#relatedDummy',
'returns' => 'relatedDummy',
],
],
],
Expand Down Expand Up @@ -280,11 +272,11 @@ private function doTestNormalize($resourceMetadataFactory = null): void
],
[
'@type' => ['hydra:Operation', 'schema:CreateAction'],
'expects' => '#dummy',
'expects' => 'dummy',
'hydra:method' => 'POST',
'hydra:title' => 'Creates a dummy resource.',
'rdfs:label' => 'Creates a dummy resource.',
'returns' => '#dummy',
'returns' => 'dummy',
],
],
],
Expand All @@ -297,7 +289,7 @@ private function doTestNormalize($resourceMetadataFactory = null): void
'@type' => 'hydra:Operation',
'hydra:method' => 'GET',
'rdfs:label' => 'The API entrypoint.',
'returns' => '#EntryPoint',
'returns' => 'EntryPoint',
],
],
[
Expand Down Expand Up @@ -435,14 +427,6 @@ public function testNormalizeInputOutputClass(): void
'@id' => 'rdfs:subClassOf',
'@type' => '@id',
],
'expects' => [
'@id' => 'hydra:expects',
'@type' => '@id',
],
'returns' => [
'@id' => 'hydra:returns',
'@type' => '@id',
],
],
],
'@id' => '/doc',
Expand Down Expand Up @@ -527,7 +511,7 @@ public function testNormalizeInputOutputClass(): void
'hydra:method' => 'GET',
'hydra:title' => 'Retrieves a dummy resource.',
'rdfs:label' => 'Retrieves a dummy resource.',
'returns' => '#dummy',
'returns' => 'dummy',
],
[
'@type' => [
Expand All @@ -538,7 +522,7 @@ public function testNormalizeInputOutputClass(): void
'hydra:method' => 'PUT',
'hydra:title' => 'Replaces the dummy resource.',
'rdfs:label' => 'Replaces the dummy resource.',
'returns' => '#dummy',
'returns' => 'dummy',
],
],
'hydra:description' => 'dummy',
Expand Down Expand Up @@ -586,7 +570,7 @@ public function testNormalizeInputOutputClass(): void
'hydra:Operation',
'schema:CreateAction',
],
'expects' => '#dummy',
'expects' => 'dummy',
'hydra:method' => 'POST',
'hydra:title' => 'Creates a dummy resource.',
'rdfs:label' => 'Creates a dummy resource.',
Expand All @@ -603,7 +587,7 @@ public function testNormalizeInputOutputClass(): void
'@type' => 'hydra:Operation',
'hydra:method' => 'GET',
'rdfs:label' => 'The API entrypoint.',
'returns' => '#EntryPoint',
'returns' => 'EntryPoint',
],
],
2 => [
Expand Down Expand Up @@ -803,14 +787,6 @@ public function testNormalizeWithoutPrefix(): void
'@id' => 'rdfs:subClassOf',
'@type' => '@id',
],
'expects' => [
'@id' => 'expects',
'@type' => '@id',
],
'returns' => [
'@id' => 'returns',
'@type' => '@id',
],
],
],
'@id' => '/doc',
Expand Down Expand Up @@ -905,23 +881,23 @@ public function testNormalizeWithoutPrefix(): void
'method' => 'GET',
'title' => 'foobar',
'rdfs:label' => 'foobar',
'returns' => '#dummy',
'returns' => 'dummy',
'foo' => 'bar',
],
[
'@type' => ['Operation', 'schema:ReplaceAction'],
'expects' => '#dummy',
'expects' => 'dummy',
'method' => 'PUT',
'title' => 'Replaces the dummy resource.',
'rdfs:label' => 'Replaces the dummy resource.',
'returns' => '#dummy',
'returns' => 'dummy',
],
[
'@type' => ['Operation', 'schema:FindAction'],
'method' => 'GET',
'title' => 'Retrieves a relatedDummy resource.',
'rdfs:label' => 'Retrieves a relatedDummy resource.',
'returns' => '#relatedDummy',
'returns' => 'relatedDummy',
],
],
],
Expand Down Expand Up @@ -956,11 +932,11 @@ public function testNormalizeWithoutPrefix(): void
],
[
'@type' => ['Operation', 'schema:CreateAction'],
'expects' => '#dummy',
'expects' => 'dummy',
'method' => 'POST',
'title' => 'Creates a dummy resource.',
'rdfs:label' => 'Creates a dummy resource.',
'returns' => '#dummy',
'returns' => 'dummy',
],
],
],
Expand All @@ -973,7 +949,7 @@ public function testNormalizeWithoutPrefix(): void
'@type' => 'Operation',
'method' => 'GET',
'rdfs:label' => 'The API entrypoint.',
'returns' => '#EntryPoint',
'returns' => 'EntryPoint',
],
],
[
Expand Down

0 comments on commit 917a0df

Please sign in to comment.