diff --git a/tests/v3/EventListenerTest.php b/tests/v3/EventListenerTest.php index e69de29b..62951226 100644 --- a/tests/v3/EventListenerTest.php +++ b/tests/v3/EventListenerTest.php @@ -0,0 +1,54 @@ +assertSame('bar', app('foo')); + } + + /** @test */ + public function listeners_can_be_queued_by_setting_a_static_property() + { + Queue::fake(); + + FooListener::$shouldQueue = true; + Event::listen(TenantCreated::class, FooListener::class); + + Tenant::create(); + + Queue::assertPushed(FooListener::class); + + $this->assertFalse(app()->bound('foo')); + } + + // todo test that the way the published SP registers events works +} + +class FooListener extends QueueableListener +{ + public static $shouldQueue = false; + + public function handle() + { + app()->instance('foo', 'bar'); + } +}