From 67094790d2d9db5c99e7c136f49061a78698e57d Mon Sep 17 00:00:00 2001 From: nsfisis Date: Mon, 24 Nov 2025 04:58:38 +0900 Subject: Add vhosts/t/phpcon-kagawa-2025/ --- vhosts/t/phpcon-kagawa-2025/tests/test_404.sh | 61 +++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100755 vhosts/t/phpcon-kagawa-2025/tests/test_404.sh (limited to 'vhosts/t/phpcon-kagawa-2025/tests/test_404.sh') diff --git a/vhosts/t/phpcon-kagawa-2025/tests/test_404.sh b/vhosts/t/phpcon-kagawa-2025/tests/test_404.sh new file mode 100755 index 0000000..509dfdb --- /dev/null +++ b/vhosts/t/phpcon-kagawa-2025/tests/test_404.sh @@ -0,0 +1,61 @@ +#!/bin/bash +# Test for 404 Not Found response + +BASE_URL="${BASE_URL:-http://127.0.0.1:8080}" +PASSED=0 +FAILED=0 + +echo "Testing 404 Not Found" +echo "=====================" + +# Test 1: GET / returns 404 +echo -n "Test 1: GET / returns 404... " +response=$(curl -s -o /dev/null -w "%{http_code}" "$BASE_URL/") +if [ "$response" = "404" ]; then + echo "PASSED" + ((PASSED++)) +else + echo "FAILED (got $response)" + ((FAILED++)) +fi + +# Test 2: GET /nonexistent returns 404 +echo -n "Test 2: GET /nonexistent returns 404... " +response=$(curl -s -o /dev/null -w "%{http_code}" "$BASE_URL/nonexistent") +if [ "$response" = "404" ]; then + echo "PASSED" + ((PASSED++)) +else + echo "FAILED (got $response)" + ((FAILED++)) +fi + +# Test 3: GET /foo/bar returns 404 +echo -n "Test 3: GET /foo/bar returns 404... " +response=$(curl -s -o /dev/null -w "%{http_code}" "$BASE_URL/foo/bar") +if [ "$response" = "404" ]; then + echo "PASSED" + ((PASSED++)) +else + echo "FAILED (got $response)" + ((FAILED++)) +fi + +# Test 4: 404 response body contains "404 Not Found" +echo -n "Test 4: 404 response body contains '404 Not Found'... " +content=$(curl -s "$BASE_URL/nonexistent") +if [ "$content" = "404 Not Found" ]; then + echo "PASSED" + ((PASSED++)) +else + echo "FAILED (got '$content')" + ((FAILED++)) +fi + +echo "" +echo "Results: $PASSED passed, $FAILED failed" + +if [ $FAILED -gt 0 ]; then + exit 1 +fi +exit 0 -- cgit v1.2.3-70-g09d2