From 385477c23beb6968e9ea115a4050457fc8f79a89 Mon Sep 17 00:00:00 2001 From: Pushpak Chhajed Date: Tue, 18 Nov 2025 16:14:15 +0530 Subject: [PATCH 1/2] Remove non-spec fields from resource content responses --- src/Server/Content/Blob.php | 2 -- src/Server/Content/Text.php | 2 -- tests/Pest.php | 2 -- tests/Unit/Content/BlobTest.php | 4 ---- tests/Unit/Content/TextTest.php | 4 ---- tests/Unit/Methods/ReadResourceTest.php | 2 -- tests/Unit/Resources/ResourceTest.php | 8 -------- 7 files changed, 24 deletions(-) diff --git a/src/Server/Content/Blob.php b/src/Server/Content/Blob.php index f7b9f71..a02d576 100644 --- a/src/Server/Content/Blob.php +++ b/src/Server/Content/Blob.php @@ -48,8 +48,6 @@ public function toResource(Resource $resource): array return $this->mergeMeta([ 'blob' => base64_encode($this->content), 'uri' => $resource->uri(), - 'name' => $resource->name(), - 'title' => $resource->title(), 'mimeType' => $resource->mimeType(), ]); } diff --git a/src/Server/Content/Text.php b/src/Server/Content/Text.php index 602d9bd..5b5b9e2 100644 --- a/src/Server/Content/Text.php +++ b/src/Server/Content/Text.php @@ -43,8 +43,6 @@ public function toResource(Resource $resource): array return $this->mergeMeta([ 'text' => $this->text, 'uri' => $resource->uri(), - 'name' => $resource->name(), - 'title' => $resource->title(), 'mimeType' => $resource->mimeType(), ]); } diff --git a/tests/Pest.php b/tests/Pest.php index 3f55746..3c875ae 100644 --- a/tests/Pest.php +++ b/tests/Pest.php @@ -211,9 +211,7 @@ function expectedReadResourceResponse(): array 'contents' => [[ 'text' => '2025-07-02 12:00:00 Error: Something went wrong.', 'uri' => 'file://resources/last-log-line-resource', - 'title' => 'Last Log Line Resource', 'mimeType' => 'text/plain', - 'name' => 'last-log-line-resource', ]], ], ]; diff --git a/tests/Unit/Content/BlobTest.php b/tests/Unit/Content/BlobTest.php index 92546ea..fa6e85e 100644 --- a/tests/Unit/Content/BlobTest.php +++ b/tests/Unit/Content/BlobTest.php @@ -23,8 +23,6 @@ expect($payload)->toEqual([ 'blob' => base64_encode('raw-bytes'), 'uri' => 'file://avatar.png', - 'name' => 'avatar', - 'title' => 'User Avatar', 'mimeType' => 'image/png', ]); }); @@ -49,8 +47,6 @@ expect($payload)->toMatchArray([ 'blob' => base64_encode('raw-bytes'), 'uri' => 'file://avatar.png', - 'name' => 'avatar', - 'title' => 'User Avatar', 'mimeType' => 'image/png', '_meta' => ['encoding' => 'base64'], ]); diff --git a/tests/Unit/Content/TextTest.php b/tests/Unit/Content/TextTest.php index 95a0f6e..2934b45 100644 --- a/tests/Unit/Content/TextTest.php +++ b/tests/Unit/Content/TextTest.php @@ -23,8 +23,6 @@ expect($payload)->toEqual([ 'text' => 'Hello world', 'uri' => 'file://readme.txt', - 'name' => 'readme', - 'title' => 'Readme File', 'mimeType' => 'text/plain', ]); }); @@ -49,8 +47,6 @@ expect($payload)->toEqual([ 'text' => 'Hello world', 'uri' => 'file://readme.txt', - 'name' => 'readme', - 'title' => 'Readme File', 'mimeType' => 'text/plain', '_meta' => ['author' => 'John'], ]); diff --git a/tests/Unit/Methods/ReadResourceTest.php b/tests/Unit/Methods/ReadResourceTest.php index 1ab27e5..d4435f0 100644 --- a/tests/Unit/Methods/ReadResourceTest.php +++ b/tests/Unit/Methods/ReadResourceTest.php @@ -124,8 +124,6 @@ [ 'text' => 'Resource content with result meta', 'uri' => 'file://resources/with-result-meta.txt', - 'name' => 'resource-with-result-meta-resource', - 'title' => 'Resource With Result Meta Resource', 'mimeType' => 'text/plain', ], ], diff --git a/tests/Unit/Resources/ResourceTest.php b/tests/Unit/Resources/ResourceTest.php index b4b3e43..b56a864 100644 --- a/tests/Unit/Resources/ResourceTest.php +++ b/tests/Unit/Resources/ResourceTest.php @@ -22,8 +22,6 @@ public function handle(): Response $expected = [ 'text' => 'This is a test resource.', 'uri' => $resource->uri(), - 'name' => $resource->name(), - 'title' => $resource->title(), 'mimeType' => $resource->mimeType(), ]; @@ -61,8 +59,6 @@ public function handle(): Response $expected = [ 'blob' => base64_encode($binaryData), 'uri' => 'file://resources/I_CAN_BE_OVERRIDDEN', - 'name' => $resource->name(), - 'title' => $resource->title(), 'mimeType' => 'image/png', ]; @@ -90,8 +86,6 @@ public function handle(): Response 'text' => 'This is a test resource.', 'uri' => $resource->uri(), - 'name' => $resource->name(), - 'title' => $resource->title(), 'mimeType' => $resource->mimeType(), ]; @@ -118,8 +112,6 @@ public function handle(): Response 'blob' => base64_encode('This is a test resource.'), 'uri' => $resource->uri(), - 'name' => $resource->name(), - 'title' => $resource->title(), 'mimeType' => $resource->mimeType(), ]; From c0eddf5b3d66b0fe84080dbaf58c327a40fbce04 Mon Sep 17 00:00:00 2001 From: Pushpak Chhajed Date: Tue, 18 Nov 2025 16:20:53 +0530 Subject: [PATCH 2/2] Update the minimum code coverage threshold to 91.7% --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index be814e5..b4ee54b 100644 --- a/composer.json +++ b/composer.json @@ -80,7 +80,7 @@ "pint --test", "rector --dry-run" ], - "test:unit": "pest --ci --coverage --min=91.4", + "test:unit": "pest --ci --coverage --min=91.7", "test:types": "phpstan", "test": [ "@test:lint",