Skip to content

Commit

Permalink
Use a new class TestObject
Browse files Browse the repository at this point in the history
  • Loading branch information
williamdes committed Jun 9, 2024
1 parent 5c306f3 commit 382e260
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 16 deletions.
8 changes: 1 addition & 7 deletions tests/ResponseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -148,7 +142,7 @@ public function testReasonPhraseContainsLineFeed()
public function testWithStatusValidReasonPhraseObject()
{
$response = new Response();
$response = $response->withStatus(200, new TestException());
$response = $response->withStatus(200, new TestObject('Slim OK'));
$this->assertEquals('Slim OK', $response->getReasonPhrase());
}

Expand Down
23 changes: 23 additions & 0 deletions tests/TestObject.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php

/**
* Slim Framework (https://slimframework.com)
*
* @license https://github.com/slimphp/Slim-Psr7/blob/master/LICENSE.md (MIT License)
*/

declare(strict_types=1);

namespace Slim\Tests\Psr7;

final class TestObject implements \Stringable
{
public function __construct(private string $value)
{
}

public function __toString(): string
{
return $this->value;
}
}
9 changes: 0 additions & 9 deletions tests/UriTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 382e260

Please sign in to comment.