Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions system/HTTP/Response.php
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ public function __construct($config)
*
* @return $this
*
* @internal For testing purposes only.
* @testTag only available to test code
*/
public function pretend(bool $pretend = true)
Expand Down
27 changes: 0 additions & 27 deletions tests/system/Test/TestCaseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@

use CodeIgniter\CLI\CLI;
use CodeIgniter\Events\Events;
use CodeIgniter\HTTP\Response;
use Config\App;
use Tests\Support\Test\TestForReflectionHelper;

/**
Expand Down Expand Up @@ -74,31 +72,6 @@ public function testStreamFilter(): void
$this->assertSame($expected, $this->getStreamFilterBuffer());
}

/**
* PHPunit emits headers before we get nominal control of
* the output stream, making header testing awkward, to say
* the least. This test is intended to make sure that this
* is happening as expected.
*
* TestCaseEmissionsTest is intended to circumvent PHPunit,
* and allow us to test our own header emissions.
*/
public function testPHPUnitHeadersEmitted(): void
{
$response = new Response(new App());
$response->pretend(true);

$body = 'Hello';
$response->setBody($body);

ob_start();
$response->send();
ob_end_clean();

$this->assertHeaderEmitted('Content-type: text/html;');
$this->assertHeaderNotEmitted('Set-Cookie: foo=bar;');
}

public function testCloseEnough(): void
{
$this->assertCloseEnough(1, 1);
Expand Down