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'); } }