Skip to content

Commit 8f7cd91

Browse files
committed
Isolating output buffering issues
1 parent caf9ac9 commit 8f7cd91

1 file changed

Lines changed: 20 additions & 14 deletions

File tree

tests/system/Test/TestCaseEmissionsTest.php

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,19 @@
1515
class TestCaseEmissionsTest extends \CIUnitTestCase
1616
{
1717

18-
public function setUp()
19-
{
20-
// while( count( ob_list_handlers() ) > 0 )
18+
// public function setUp()
19+
// {
20+
// while( count( ob_list_handlers() ) > 1 )
2121
// {
2222
// ob_end_clean();
2323
// }
24-
ob_start(null, 0, PHP_OUTPUT_HANDLER_CLEANABLE);
25-
}
26-
27-
public function tearDown()
28-
{
29-
ob_end_clean();
30-
}
24+
// ob_start(null, 0, PHP_OUTPUT_HANDLER_CLEANABLE);
25+
// }
26+
//
27+
// public function tearDown()
28+
// {
29+
// ob_end_clean();
30+
// }
3131

3232
//--------------------------------------------------------------------
3333
/**
@@ -57,18 +57,24 @@ public function testHeaderEmitted()
5757
$response->setCookie('foo', 'bar');
5858
$this->assertTrue($response->hasCookie('foo'));
5959
$this->assertTrue($response->hasCookie('foo', 'bar'));
60-
61-
// send it
60+
6261
$response->setBody($body);
62+
63+
//echo 'ob level at '.ob_get_level();
64+
ob_end_clean();
65+
ob_start(null, 0, PHP_OUTPUT_HANDLER_CLEANABLE);
66+
//$buffer = ob_get_clean(); // flush previous
67+
// send it
68+
// $buffer = ob_get_clean();
6369
$response->send();
64-
70+
$buffer = ob_end_clean();
6571
// and what actually got sent?; test both ways
6672
$actual = $response->getBody(); // what we thought was sent
67-
// $buffer = ob_get_clean();
6873

6974
$this->assertEquals($expected, $actual);
7075
$this->assertHeaderEmitted("Set-Cookie: foo=bar;");
7176
$this->assertHeaderEmitted("set-cookie: FOO=bar", true);
77+
7278
}
7379

7480
/**

0 commit comments

Comments
 (0)