@@ -52,11 +52,11 @@ protected function setUp(): void
5252 ->willReturn (
5353 new ResourceMetadataCollection ('DummyResource ' , [ // todo mock $dummy_resource
5454 new ApiResource (operations: [
55- new Get (uriTemplate: '/dummy_resources/{dummyResourceId}{._format} ' , name: 'get ' ),
56- new GetCollection (uriTemplate: '/dummy_resources{._format} ' , name: 'get_collections ' ),
57- new Post (uriTemplate: '/dummy_resources{._format} ' , outputFormats: ['jsonld ' => ['application/ld+json ' ], 'text/turtle ' => ['text/turtle ' ]], name: 'post ' ),
58- new Delete (uriTemplate: '/dummy_resources/{dummyResourceId}{._format} ' , name: 'delete ' ),
59- new Put (uriTemplate: '/dummy_resources/{dummyResourceId}{._format} ' , name: 'put ' ),
55+ new Get (uriTemplate: '/dummy_resources/{dummyResourceId}{._format} ' , class: ' DummyResource ' , name: 'get ' ),
56+ new GetCollection (uriTemplate: '/dummy_resources{._format} ' , class: ' DummyResource ' , name: 'get_collections ' ),
57+ new Post (uriTemplate: '/dummy_resources{._format} ' , outputFormats: ['jsonld ' => ['application/ld+json ' ], 'text/turtle ' => ['text/turtle ' ]], class: ' DummyResource ' , name: 'post ' ),
58+ new Delete (uriTemplate: '/dummy_resources/{dummyResourceId}{._format} ' , class: ' DummyResource ' , name: 'delete ' ),
59+ new Put (uriTemplate: '/dummy_resources/{dummyResourceId}{._format} ' , class: ' DummyResource ' , name: 'put ' ),
6060 ]),
6161 ])
6262 );
@@ -67,7 +67,7 @@ protected function setUp(): void
6767
6868 public function testHeadersAcceptPostIsReturnWhenPostAllowed (): void
6969 {
70- $ operation = (new HttpOperation ('GET ' , '/dummy_resources{._format} ' ));
70+ $ operation = (new HttpOperation ('GET ' , '/dummy_resources{._format} ' , class: ' DummyResource ' ));
7171
7272 $ context = $ this ->getContext ();
7373
@@ -84,7 +84,7 @@ public function testHeadersAcceptPostIsReturnWhenPostAllowed(): void
8484
8585 public function testHeadersAcceptPostIsNotSetWhenPostIsNotAllowed (): void
8686 {
87- $ operation = (new HttpOperation ('GET ' , '/dummy_resources/{dummyResourceId}{._format} ' ));
87+ $ operation = (new HttpOperation ('GET ' , '/dummy_resources/{dummyResourceId}{._format} ' , class: ' DummyResource ' ));
8888 $ context = $ this ->getContext ();
8989
9090 $ processor = new LinkedDataPlatformProcessor (
@@ -100,7 +100,7 @@ public function testHeadersAcceptPostIsNotSetWhenPostIsNotAllowed(): void
100100
101101 public function testHeaderAllowReflectsResourceAllowedMethods (): void
102102 {
103- $ operation = (new HttpOperation ('GET ' , '/dummy_resources{._format} ' ));
103+ $ operation = (new HttpOperation ('GET ' , '/dummy_resources{._format} ' , class: ' DummyResource ' ));
104104 $ context = $ this ->getContext ();
105105
106106 $ processor = new LinkedDataPlatformProcessor (
@@ -116,7 +116,7 @@ public function testHeaderAllowReflectsResourceAllowedMethods(): void
116116 $ this ->assertStringContainsString ('GET ' , $ allowHeader );
117117 $ this ->assertStringContainsString ('POST ' , $ allowHeader );
118118
119- $ operation = (new HttpOperation ('GET ' , '/dummy_resources/{dummyResourceId}{._format} ' ));
119+ $ operation = (new HttpOperation ('GET ' , '/dummy_resources/{dummyResourceId}{._format} ' , class: ' DummyResource ' ));
120120
121121 /** @var Response $response */
122122 $ processor = new LinkedDataPlatformProcessor (
@@ -136,32 +136,12 @@ public function testHeaderAllowReflectsResourceAllowedMethods(): void
136136
137137 public function testProcessorWithoutRequiredConditionReturnOriginalResponse (): void
138138 {
139- $ operation = (new HttpOperation ('GET ' , '/dummy_resources/{dummyResourceId}{._format} ' ));
140-
141- // No collection factory
142- $ processor = new LinkedDataPlatformProcessor ($ this ->decorated , $ this ->resourceClassResolver , null );
143- /** @var Response $response */
144- $ response = $ processor ->process (null , $ operation , [], $ this ->getContext ());
145-
146- $ this ->assertNull ($ response ->headers ->get ('Allow ' ));
147-
148- // No uri variable in context
149- $ processor = new LinkedDataPlatformProcessor ($ this ->decorated , null , $ this ->resourceMetadataCollectionFactory );
150- $ response = $ processor ->process (null , $ operation , [], $ this ->getContext ());
151- $ this ->assertNull ($ response ->headers ->get ('Allow ' ));
139+ $ operation = (new HttpOperation ('GET ' , '/dummy_resources/{dummyResourceId}{._format} ' , class: 'DummyResource ' ));
152140
153141 // Operation is an Error
154142 $ processor = new LinkedDataPlatformProcessor ($ this ->decorated , $ this ->resourceClassResolver , $ this ->resourceMetadataCollectionFactory );
155143 $ response = $ processor ->process (null , new Error (), $ this ->getContext ());
156144 $ this ->assertNull ($ response ->headers ->get ('Allow ' ));
157-
158- // Not a resource class
159- $ this ->resourceClassResolver
160- ->method ('isResourceClass ' )
161- ->willReturn (false );
162- $ processor = new LinkedDataPlatformProcessor ($ this ->decorated , $ this ->resourceClassResolver , $ this ->resourceMetadataCollectionFactory );
163- $ response = $ processor ->process (null , $ operation , []);
164- $ this ->assertNull ($ response ->headers ->get ('Allow ' ));
165145 }
166146
167147 private function createGetRequest (): Request
0 commit comments