diff --git a/tests/ResponseTest.php b/tests/ResponseTest.php index 0141888..7b73488 100644 --- a/tests/ResponseTest.php +++ b/tests/ResponseTest.php @@ -22,12 +22,6 @@ use function fopen; use function property_exists; -final class TestException implements \Stringable { - public function __toString(): string { - return 'Slim OK'; - } -} - class ResponseTest extends TestCase { public function testConstructorWithDefaultArgs() @@ -148,7 +142,7 @@ public function testReasonPhraseContainsLineFeed() public function testWithStatusValidReasonPhraseObject() { $response = new Response(); - $response = $response->withStatus(200, new TestException()); + $response = $response->withStatus(200, new StringableTestObject('Slim OK')); $this->assertEquals('Slim OK', $response->getReasonPhrase()); } diff --git a/tests/StringableTestObject.php b/tests/StringableTestObject.php new file mode 100644 index 0000000..36a6785 --- /dev/null +++ b/tests/StringableTestObject.php @@ -0,0 +1,23 @@ +value; + } +} diff --git a/tests/UriTest.php b/tests/UriTest.php index 97c1347..aeb3a85 100644 --- a/tests/UriTest.php +++ b/tests/UriTest.php @@ -15,15 +15,6 @@ use Slim\Psr7\Uri; use stdClass; -final class TestObject implements \Stringable { - - public function __construct(private readonly string $value) {} - - public function __toString(): string { - return $this->value; - } -} - class UriTest extends TestCase { public function uriFactory(): Uri @@ -142,7 +133,7 @@ public function testWithHost() public function testWithHostValidObject() { - $mock = new TestObject('host.test'); + $mock = new StringableTestObject('host.test'); $uri = $this->uriFactory()->withHost($mock); $this->assertEquals('host.test', $uri->getHost()); @@ -304,7 +295,7 @@ public function testWithQueryEmpty() public function testWithQueryValidObject() { - $mock = new TestObject('xyz=123'); + $mock = new StringableTestObject('xyz=123'); $uri = $this->uriFactory()->withQuery($mock); $this->assertEquals('xyz=123', $uri->getQuery()); @@ -353,7 +344,7 @@ public function testWithFragmentEmpty() public function testWithFragmentValidObject() { - $mock = new TestObject('other-fragment'); + $mock = new StringableTestObject('other-fragment'); $uri = $this->uriFactory()->withFragment($mock); $this->assertEquals('other-fragment', $uri->getFragment());