Skip to content

Commit

Permalink
Add test for ParsingMiddleware
Browse files Browse the repository at this point in the history
  • Loading branch information
kelunik committed Jan 9, 2019
1 parent afb2378 commit 40103b2
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions test/ParsingMiddlewareTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,16 @@ public function testNonForm()

wait($handler->handleRequest($request));
}

public function testNone()
{
$handler = stack(new CallableRequestHandler(function (Request $request) {
$this->assertTrue($request->hasAttribute(Form::class)); // attribute is set either way
$this->assertSame('{}', yield $request->getBody()->buffer());
}), new ParsingMiddleware);

$request = new Request($this->createMock(Client::class), 'GET', Uri\Http::createFromString('/'), [], '{}');

wait($handler->handleRequest($request));
}
}

0 comments on commit 40103b2

Please sign in to comment.