mirror of
https://github.com/archtechx/tenancy.git
synced 2026-02-05 22:44:05 +00:00
fixed tests, remove method duplications, restore necessary inner classes
This commit is contained in:
parent
9d08334f48
commit
1166fe2a6e
15 changed files with 482 additions and 130 deletions
|
|
@ -133,14 +133,45 @@ test('database connection is switched to default', function () {
|
|||
Artisan::call('tenants:rollback');
|
||||
expect(DB::connection()->getDatabaseName())->toBe($originalDBName);
|
||||
|
||||
$this->run_commands_works();
|
||||
// $this->run_commands_works();
|
||||
$id = Tenant::create()->getTenantKey();
|
||||
|
||||
Artisan::call('tenants:migrate', ['--tenants' => [$id]]);
|
||||
|
||||
$this->artisan("tenants:run foo --tenants=$id --argument='a=foo' --option='b=bar' --option='c=xyz'")
|
||||
->expectsOutput("User's name is Test command")
|
||||
->expectsOutput('foo')
|
||||
->expectsOutput('xyz');
|
||||
|
||||
expect(DB::connection()->getDatabaseName())->toBe($originalDBName);
|
||||
});
|
||||
|
||||
test('database connection is switched to default when tenancy has been initialized', function () {
|
||||
tenancy()->initialize(Tenant::create());
|
||||
|
||||
$this->database_connection_is_switched_to_default();
|
||||
// $this->database_connection_is_switched_to_default();
|
||||
$originalDBName = DB::connection()->getDatabaseName();
|
||||
|
||||
Artisan::call('tenants:migrate');
|
||||
expect(DB::connection()->getDatabaseName())->toBe($originalDBName);
|
||||
|
||||
Artisan::call('tenants:seed', ['--class' => ExampleSeeder::class]);
|
||||
expect(DB::connection()->getDatabaseName())->toBe($originalDBName);
|
||||
|
||||
Artisan::call('tenants:rollback');
|
||||
expect(DB::connection()->getDatabaseName())->toBe($originalDBName);
|
||||
|
||||
// $this->run_commands_works();
|
||||
$id = Tenant::create()->getTenantKey();
|
||||
|
||||
Artisan::call('tenants:migrate', ['--tenants' => [$id]]);
|
||||
|
||||
$this->artisan("tenants:run foo --tenants=$id --argument='a=foo' --option='b=bar' --option='c=xyz'")
|
||||
->expectsOutput("User's name is Test command")
|
||||
->expectsOutput('foo')
|
||||
->expectsOutput('xyz');
|
||||
|
||||
expect(DB::connection()->getDatabaseName())->toBe($originalDBName);
|
||||
});
|
||||
|
||||
test('run commands works', function () {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue