/** * @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 }
/** * @test */ public function shouldVerifyMethodIsCalledNTimesForAnyArgs() { //given $mock = Mock::mock('MockTestClass'); //when $mock->method("something else 1"); $mock->method("something else 2"); $mock->method("something else 3"); //then Mock::verify($mock)->receivedTimes(3)->method(Mock::any()); }