laravel / browser-kit-testing

Provides backwards compatibility for BrowserKit testing in the latest Laravel release.
MIT License
509 stars 75 forks source link

Outdated MocksApplicationServices.php implementation #141

Closed bytestream closed 4 years ago

bytestream commented 4 years ago

Comparison of:

withoutEvents() diff:

$mock = Mockery::mock('Illuminate\Contracts\Events\Dispatcher');

$mock->shouldReceive('fire', 'dispatch', 'getCommandHandler')->andReturnUsing(function ($called) {
    $this->firedEvents[] = $called;
});

$this->app->instance('events', $mock);

return $this;
$mock = Mockery::mock(EventsDispatcherContract::class)->shouldIgnoreMissing();

$mock->shouldReceive('dispatch', 'until')->andReturnUsing(function ($called) {
    $this->firedEvents[] = $called;
});

Event::clearResolvedInstances();

$this->app->instance('events', $mock);

return $this;

I noticed this having tried to use expectsEvents() and ran into a mockery error stating until was called but had not been mocked.

There are other differences https://www.diffchecker.com/HRM1BixO

driesvints commented 4 years ago

Please resubmit this with a filled out issue template.