Last active
March 11, 2019 09:12
-
-
Save aliuwahab/13ea74f0600504e483ff3b24c5cabc20 to your computer and use it in GitHub Desktop.
ExampleTest
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Tests\Feature; | |
use App\Jobs\ExampleJob; | |
use App\User; | |
use Illuminate\Support\Facades\Bus; | |
use Tests\TestCase; | |
use Illuminate\Foundation\Testing\RefreshDatabase; | |
class ExampleTest extends TestCase | |
{ | |
use RefreshDatabase; | |
/** @test */ | |
public function bus_fake_test() | |
{ | |
$this->withoutExceptionHandling(); | |
Bus::fake(); | |
$user = factory(User::class)->create(); | |
$this->get('/example/job'); | |
Bus::assertDispatched(ExampleJob::class, function ($job) use ($user) { | |
return $job->user->id === $user->id; | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment