Skip to content

Commit

Permalink
Adding test to cover creating ServerRequest with a string body.
Browse files Browse the repository at this point in the history
  • Loading branch information
brentscheffler committed Mar 10, 2020
1 parent e7c4b78 commit 4945d2e
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions tests/ServerRequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use Capsule\Factory\UriFactory;
use Capsule\ServerRequest;
use Capsule\Stream\BufferStream;
use Capsule\UploadedFile;
use PHPUnit\Framework\TestCase;

Expand Down Expand Up @@ -63,6 +64,20 @@ public function test_create_with_uri_instance()
);
}

public function test_create_with_string_body_creates_buffer_stream()
{
$request = new ServerRequest(
"post",
"http://example.org/foo/bar?q=search",
\json_encode(["email" => "test@example.com", "name" => "Testy Test"])
);

$this->assertInstanceOf(
BufferStream::class,
$request->getBody()
);
}

public function test_create_with_array_body()
{
$request = new ServerRequest(
Expand Down

0 comments on commit 4945d2e

Please sign in to comment.