Created
April 7, 2017 15:34
-
-
Save sasezaki/722ec67c9e94682b76c2ef82cda01e25 to your computer and use it in GitHub Desktop.
testEmitsBufferLevel
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
public function testEmitsBufferLevel() | |
{ | |
ob_start(); | |
echo "level". ob_get_level() . " "; // 2 | |
ob_start(); | |
echo "level". ob_get_level() . " "; // 3 | |
ob_start(); | |
echo "level". ob_get_level() . " "; // 4 | |
$response = (new Response()) | |
->withStatus(200) | |
->withAddedHeader('Content-Type', 'text/plain'); | |
$response->getBody()->write('Content!'); | |
ob_start(); | |
$this->emitter->emit($response); | |
$this->assertEquals('Content!', ob_get_contents()); | |
ob_end_clean(); | |
$this->assertEquals('level4 ', ob_get_contents(), 'current buffer level string must remains after emit'); | |
ob_end_clean(); | |
$this->emitter->emit($response, 2); | |
$this->assertEquals('level2 level3 Content!', ob_get_contents(), 'must buffer until specified level'); | |
ob_end_clean(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment