From 21fc11ff374cb42d510a15780ef2ac38adee83db Mon Sep 17 00:00:00 2001 From: Adam Fisher Date: Tue, 4 Aug 2026 14:21:03 +0000 Subject: [PATCH] Fix skeleton test to pass and expose testable code Tests.php asserted assertSame(true, false), which always fails. code.php echoed output and returned nothing, so there was nothing to assert on. It now exposes a greeting() function and guards the direct invocation so the file can be required without side effects. The test asserts on the return value. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- php/Tests.php | 6 +++--- php/code.php | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/php/Tests.php b/php/Tests.php index dee4e4d..65dc131 100644 --- a/php/Tests.php +++ b/php/Tests.php @@ -2,12 +2,12 @@ use PHPUnit\Framework\TestCase; +require_once __DIR__ . '/code.php'; + class Tests extends TestCase { public function testSkeleton() { - $this->assertSame(true, false); + $this->assertSame("Hi there!", greeting()); } } - -?> \ No newline at end of file diff --git a/php/code.php b/php/code.php index ca8fd95..05ca84e 100644 --- a/php/code.php +++ b/php/code.php @@ -1,9 +1,9 @@ \ No newline at end of file +if (basename(__FILE__) === basename($_SERVER['SCRIPT_FILENAME'] ?? '')) { + echo greeting() . "\n"; +}