/**
* @test
*/
public function shouldNotDisplayOutputBeforeHeadersAreSent()
{
//given
$self = $this;
$obLevel = ob_get_level();
Mock::when($this->frontController->getHeaderSender())->send(Mock::any())->thenAnswer(function () use($self, $obLevel) {
//if there's a nested buffer, nothing was sent to output
$self->assertTrue(ob_get_level() > $obLevel);
$self->expectOutputString('OUTPUT');
});
Route::allowAll('/sample', 'sample');
//when
$this->get('/sample/action');
//then no exceptions
}