Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

clean up buffer tweak in FeatureTestCaseTest #2805

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
19 changes: 9 additions & 10 deletions system/Test/FeatureTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,15 @@ public function skipEvents()
*/
public function call(string $method, string $path, array $params = null)
{
// Clean up any open output buffers
// not relevant to unit testing
// @codeCoverageIgnoreStart
if (\ob_get_level() > 0 && $this->clean)
{
\ob_end_clean();
}
// @codeCoverageIgnoreEnd

// Simulate having a blank session
$_SESSION = [];
$_SERVER['REQUEST_METHOD'] = $method;
Expand Down Expand Up @@ -178,16 +187,6 @@ public function call(string $method, string $path, array $params = null)
$response->setBody($output);
}

// Clean up any open output buffers
// not relevant to unit testing
// @codeCoverageIgnoreStart

if (ob_get_level() > 0 && $this->clean)
{
ob_end_clean();
}
// @codeCoverageIgnoreEnd

// Reset directory if it has been set
Services::router()->setDirectory(null);

Expand Down
9 changes: 0 additions & 9 deletions tests/system/Test/FeatureTestCaseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -198,10 +198,6 @@ public function testEchoes()
public function testCallZeroAsPathGot404()
{
$this->expectException(PageNotFoundException::class);
while (\ob_get_level() > 0)
{
\ob_end_flush();
}
$this->get('0');
}

Expand Down Expand Up @@ -247,11 +243,6 @@ public function testOpenCliRoutesFromHttpGot404($from, $to, $httpGet)
$to,
],
]);

while (\ob_get_level() > 0)
{
\ob_end_flush();
}
$this->get($httpGet);
}
}