1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2025-12-12 12:24:04 +00:00

Fix event listener tests, improve domain logic

This commit is contained in:
Samuel Štancl 2020-05-09 02:49:08 +02:00
parent 0bbc66f451
commit a602cec940
13 changed files with 148 additions and 14 deletions

View file

@ -2,6 +2,7 @@
namespace Stancl\Tenancy\Tests\v3;
use Illuminate\Events\CallQueuedListener;
use Illuminate\Support\Facades\Event;
use Illuminate\Support\Facades\Queue;
use Stancl\Tenancy\Database\Models\Tenant;
@ -9,7 +10,6 @@ use Stancl\Tenancy\Events\Listeners\QueueableListener;
use Stancl\Tenancy\Events\TenantCreated;
use Stancl\Tenancy\Tests\TestCase;
// todo these tests do not pass: https://github.com/laravel/framework/issues/32722
class EventListenerTest extends TestCase
{
/** @test */
@ -30,12 +30,14 @@ class EventListenerTest extends TestCase
{
Queue::fake();
FooListener::$shouldQueue = true;
Event::listen(TenantCreated::class, FooListener::class);
FooListener::$shouldQueue = true;
Tenant::create();
Queue::assertPushed(FooListener::class);
Queue::assertPushed(CallQueuedListener::class, function (CallQueuedListener $job) {
return $job->class === FooListener::class;
});
$this->assertFalse(app()->bound('foo'));
}