From d6b95a954be4369b6bc7c1277defe6d480198d43 Mon Sep 17 00:00:00 2001 From: andig Date: Thu, 19 Oct 2017 17:13:46 +0200 Subject: [PATCH] Update test for HTTP 413 --- .../RequestBodyBufferMiddlewareTest.php | 20 ++++--------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/tests/Middleware/RequestBodyBufferMiddlewareTest.php b/tests/Middleware/RequestBodyBufferMiddlewareTest.php index 2a130575..750ee440 100644 --- a/tests/Middleware/RequestBodyBufferMiddlewareTest.php +++ b/tests/Middleware/RequestBodyBufferMiddlewareTest.php @@ -10,7 +10,6 @@ use React\EventLoop\Factory; use React\Tests\Http\TestCase; use RingCentral\Psr7\BufferStream; -use Clue\React\Block; final class RequestBodyBufferMiddlewareTest extends TestCase { @@ -70,33 +69,22 @@ public function testExcessiveSizeReturnsError413() $loop = Factory::create(); $stream = new ThroughStream(); + $stream->end('aa'); $serverRequest = new ServerRequest( 'GET', 'https://example.com/', array(), - new HttpBodyStream($stream) + new HttpBodyStream($stream, 2) ); $buffer = new RequestBodyBufferMiddleware(1); - $promise = $buffer( + $response = $buffer( $serverRequest, function (ServerRequestInterface $request) { return $request; } ); - $stream->write('aa'); - - $exposedResponse = null; - $promise->then( - function($response) use (&$exposedResponse) { - $exposedResponse = $response; - }, - $this->expectCallableNever() - ); - - $this->assertSame(413, $exposedResponse->getStatusCode()); - - Block\await($promise, $loop); + $this->assertSame(413, $response->getStatusCode()); } }