From 8a872183099219aad398058b99b5ae09cac4e7cb Mon Sep 17 00:00:00 2001 From: Hafiz Muhammad Moaz Date: Wed, 22 Jul 2026 16:19:33 +0500 Subject: [PATCH] fix: update stale route names and 404 assertions The `test` job on main was failing with 3 failures. The tests had drifted from the application. - `boot/routes.php` names the routes `api.home.index` and `api.home.about`, but the tests still expected `api.index` and `api.about`. - `respond_not_found()` returns the JSON error envelope from `error_response()` (`"message": "Not Found"` plus `path` and `method`), but the test looked for the string `Route not found`. Now asserts on the actual payload, including the requested path. Verified locally: `vendor/bin/phpunit` is 4/4 green. Co-Authored-By: Claude Opus 4.8 --- .phpunit.cache/test-results | 1 + tests/OneTest.php | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) create mode 100644 .phpunit.cache/test-results diff --git a/.phpunit.cache/test-results b/.phpunit.cache/test-results new file mode 100644 index 0000000..722ec3d --- /dev/null +++ b/.phpunit.cache/test-results @@ -0,0 +1 @@ +{"version":2,"defects":[],"times":{"Tests\\Api\\OneTest::testConfigs":6.205,"Tests\\Api\\OneTest::testIndex":0.195,"Tests\\Api\\OneTest::testAbout":0.04,"Tests\\Api\\OneTest::testNotFound":0.038}} \ No newline at end of file diff --git a/tests/OneTest.php b/tests/OneTest.php index aa448a0..d3b212a 100644 --- a/tests/OneTest.php +++ b/tests/OneTest.php @@ -33,7 +33,7 @@ public function testIndex() : void $response = $this->runApi($this->baseUrl); self::assertSame(200, $response['code']); self::assertStringContainsString('API is running', $response['body']); - self::assertSame('api.index', App::router()->getMatchedRoute()->getName()); + self::assertSame('api.home.index', App::router()->getMatchedRoute()->getName()); } public function testAbout() : void @@ -41,13 +41,14 @@ public function testAbout() : void $response = $this->runApi($this->baseUrl . 'about'); self::assertSame(200, $response['code']); self::assertStringContainsString('API project powered by Webisters framework', $response['body']); - self::assertSame('api.about', App::router()->getMatchedRoute()->getName()); + self::assertSame('api.home.about', App::router()->getMatchedRoute()->getName()); } public function testNotFound() : void { $response = $this->runApi($this->baseUrl . 'wakawaka'); self::assertSame(404, $response['code']); - self::assertStringContainsString('Route not found', $response['body']); + self::assertStringContainsString('"message": "Not Found"', $response['body']); + self::assertStringContainsString('"path": "/wakawaka"', $response['body']); } }