1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2026-02-05 14:34:04 +00:00

Use only one config for queueing

This commit is contained in:
Samuel Štancl 2019-10-17 13:38:09 +02:00
parent 74fbd816c2
commit cc5611b24d
4 changed files with 28 additions and 27 deletions

View file

@ -10,6 +10,7 @@ use Illuminate\Support\Facades\Storage;
use Stancl\Tenancy\Exceptions\DomainsOccupiedByOtherTenantException;
use Stancl\Tenancy\Exceptions\TenantDoesNotExistException;
use Stancl\Tenancy\Exceptions\TenantWithThisIdAlreadyExistsException;
use Stancl\Tenancy\Jobs\QueuedTenantDatabaseCreator;
use Stancl\Tenancy\Jobs\QueuedTenantDatabaseMigrator;
use Stancl\Tenancy\Tenant;
use Stancl\Tenancy\TenantManager;
@ -249,23 +250,26 @@ class TenantManagerTest extends TestCase
}
/** @test */
public function automigration_can_be_queued()
public function automigration_is_be_queued()
{
Queue::fake();
config([
'tenancy.queue_database_creation' => true,
'tenancy.migrate_after_creation' => true,
'tenancy.queue_automatic_migration' => true,
]);
$tenant = Tenant::new()->save();
tenancy()->initialize($tenant);
Queue::assertPushed(QueuedTenantDatabaseMigrator::class);
Queue::assertPushedWithChain(QueuedTenantDatabaseCreator::class, [
QueuedTenantDatabaseMigrator::class
]);
$this->assertFalse(\Schema::hasTable('users'));
(new QueuedTenantDatabaseMigrator($tenant))->handle();
$this->assertTrue(\Schema::hasTable('users'));
// foreach (Queue::pushedJobs() as $job) {
// $job[0]['job']->handle(); // this doesn't execute the chained job
// }
// tenancy()->initialize($tenant);
// $this->assertTrue(\Schema::hasTable('users'));
}
/** @test */