mirror of
https://github.com/archtechx/jobpipeline.git
synced 2025-12-12 16:54:03 +00:00
test: add test
This commit is contained in:
parent
f1f82aa5d9
commit
962562c97e
1 changed files with 17 additions and 0 deletions
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace Stancl\JobPipeline\Tests;
|
||||
|
||||
use Exception;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Facades\Event;
|
||||
use Illuminate\Support\Facades\Queue;
|
||||
|
|
@ -193,6 +194,22 @@ class JobPipelineTest extends TestCase
|
|||
|
||||
$this->assertTrue($passes);
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function failures_in_closures_will_throw_correctly()
|
||||
{
|
||||
$this->expectExceptionMessage('foobar');
|
||||
|
||||
Event::listen(TestEvent::class, JobPipeline::make([
|
||||
function () {
|
||||
throw new Exception('foobar');
|
||||
}
|
||||
])->send(function (TestEvent $event) {
|
||||
return $this->valuestore;
|
||||
})->shouldBeQueued(false)->toListener());
|
||||
|
||||
event(new TestEvent(new TestModel()));
|
||||
}
|
||||
}
|
||||
|
||||
class FooJob
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue