From 0bbc66f451187cacbbe57fe2844a7d3ceff06c76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20=C5=A0tancl?= Date: Fri, 8 May 2020 18:59:40 +0200 Subject: [PATCH] (failing) event listener tests --- tests/v3/EventListenerTest.php | 54 ++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) 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'); + } +}