From cebc945fbe07b1171c966183e26008e9bc5b72f3 Mon Sep 17 00:00:00 2001 From: Koda Date: Fri, 24 Apr 2026 09:06:45 +0000 Subject: [PATCH 1/2] Stabilize Scalar docs response assertions --- tests/Feature/Api/PublicApiDocumentationTest.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/tests/Feature/Api/PublicApiDocumentationTest.php b/tests/Feature/Api/PublicApiDocumentationTest.php index d06a961..361e632 100644 --- a/tests/Feature/Api/PublicApiDocumentationTest.php +++ b/tests/Feature/Api/PublicApiDocumentationTest.php @@ -8,10 +8,13 @@ class PublicApiDocumentationTest extends TestCase { public function test_scalar_api_docs_are_public(): void { - $this->get('/api/docs') - ->assertOk() - ->assertSee('"hideClientButton":true', false) - ->assertSee('"mcp":{"disabled":true}', false); + $response = $this->get('/api/docs') + ->assertOk(); + + $content = (string) $response->getContent(); + + $this->assertMatchesRegularExpression('/"hideClientButton"\s*:\s*true/', $content); + $this->assertMatchesRegularExpression('/"mcp"\s*:\s*\{\s*"disabled"\s*:\s*true\s*\}/', $content); } public function test_openapi_document_is_publicly_served(): void -- 2.54.0 From 9f87c2eca07256f35d878513d08ed51827ffdc22 Mon Sep 17 00:00:00 2001 From: Koda Date: Fri, 24 Apr 2026 09:07:34 +0000 Subject: [PATCH 2/2] Loosen MCP docs assertion to avoid brittle matching --- tests/Feature/Api/PublicApiDocumentationTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Feature/Api/PublicApiDocumentationTest.php b/tests/Feature/Api/PublicApiDocumentationTest.php index 361e632..74c8180 100644 --- a/tests/Feature/Api/PublicApiDocumentationTest.php +++ b/tests/Feature/Api/PublicApiDocumentationTest.php @@ -14,7 +14,7 @@ class PublicApiDocumentationTest extends TestCase $content = (string) $response->getContent(); $this->assertMatchesRegularExpression('/"hideClientButton"\s*:\s*true/', $content); - $this->assertMatchesRegularExpression('/"mcp"\s*:\s*\{\s*"disabled"\s*:\s*true\s*\}/', $content); + $this->assertMatchesRegularExpression('/"mcp"\s*:\s*\{[^}]*"disabled"\s*:\s*true/', $content); } public function test_openapi_document_is_publicly_served(): void -- 2.54.0