Skip to content

Commit

Permalink
Replace use of deprecated TestCase::at() method (ref sebastianbergman…
Browse files Browse the repository at this point in the history
  • Loading branch information
mbabker committed Aug 3, 2020
1 parent 3b7d5d2 commit d4e50dd
Showing 1 changed file with 11 additions and 16 deletions.
27 changes: 11 additions & 16 deletions tests/BreadcrumbsGeneratorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
use BabDev\Breadcrumbs\Events\BeforeBreadcrumbGenerated;
use BabDev\Breadcrumbs\Exceptions\InvalidBreadcrumbException;
use Illuminate\Contracts\Events\Dispatcher;
use PHPUnit\Framework\TestCase;
use Orchestra\Testbench\TestCase;

class BreadcrumbsGeneratorTest extends TestCase
{
Expand Down Expand Up @@ -36,21 +36,16 @@ public function testGeneratesABreadcrumb(): void

public function testGeneratesABreadcrumbWithBeforeAndAfterEvents(): void
{
$dispatcher = $this->createMock(Dispatcher::class);

$dispatcher->expects($this->at(0))
->method('dispatch')
->with($this->isInstanceOf(BeforeBreadcrumbGenerated::class))
->willReturnCallback(static function (BeforeBreadcrumbGenerated $event): void {
$event->breadcrumbs->push('Home', '/');
});

$dispatcher->expects($this->at(1))
->method('dispatch')
->with($this->isInstanceOf(AfterBreadcrumbGenerated::class))
->willReturnCallback(static function (AfterBreadcrumbGenerated $event): void {
$event->breadcrumbs->push('Page 2', '/page-2');
});
/** @var Dispatcher $dispatcher */
$dispatcher = $this->app->make('events');

$dispatcher->listen(BeforeBreadcrumbGenerated::class, static function (BeforeBreadcrumbGenerated $event): void {
$event->breadcrumbs->push('Home', '/');
});

$dispatcher->listen(AfterBreadcrumbGenerated::class, static function (AfterBreadcrumbGenerated $event): void {
$event->breadcrumbs->push('Page 2', '/page-2');
});

$callbacks = [
'blog' => static function (BreadcrumbsGeneratorContract $trail): void {
Expand Down

0 comments on commit d4e50dd

Please sign in to comment.