From 917a0df871b5a57a37531a6ba588da2fe88c3f48 Mon Sep 17 00:00:00 2001 From: Valentin Dassonville Date: Mon, 14 Oct 2024 15:39:14 +0200 Subject: [PATCH] test(hydra): tests changed because context json changed --- features/hydra/docs.feature | 6 +- .../DocumentationNormalizerTest.php | 60 ++++++------------- 2 files changed, 19 insertions(+), 47 deletions(-) diff --git a/features/hydra/docs.feature b/features/hydra/docs.feature index 17784b0a9c..6e3501d3bc 100644 --- a/features/hydra/docs.feature +++ b/features/hydra/docs.feature @@ -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" @@ -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" diff --git a/src/Hydra/Tests/Serializer/DocumentationNormalizerTest.php b/src/Hydra/Tests/Serializer/DocumentationNormalizerTest.php index 1521db5cfb..f54c56a0bb 100644 --- a/src/Hydra/Tests/Serializer/DocumentationNormalizerTest.php +++ b/src/Hydra/Tests/Serializer/DocumentationNormalizerTest.php @@ -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', @@ -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', ], ], ], @@ -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', ], ], ], @@ -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', ], ], [ @@ -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', @@ -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' => [ @@ -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', @@ -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.', @@ -603,7 +587,7 @@ public function testNormalizeInputOutputClass(): void '@type' => 'hydra:Operation', 'hydra:method' => 'GET', 'rdfs:label' => 'The API entrypoint.', - 'returns' => '#EntryPoint', + 'returns' => 'EntryPoint', ], ], 2 => [ @@ -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', @@ -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', ], ], ], @@ -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', ], ], ], @@ -973,7 +949,7 @@ public function testNormalizeWithoutPrefix(): void '@type' => 'Operation', 'method' => 'GET', 'rdfs:label' => 'The API entrypoint.', - 'returns' => '#EntryPoint', + 'returns' => 'EntryPoint', ], ], [