mirror of
https://github.com/archtechx/tenancy.git
synced 2026-02-05 16:34:04 +00:00
update tests
This commit is contained in:
parent
27eb4f738e
commit
24f04c1328
2 changed files with 17 additions and 6 deletions
|
|
@ -167,7 +167,9 @@ test('install command works', function () {
|
|||
mkdir($dir, 0777, true);
|
||||
}
|
||||
|
||||
pest()->artisan('tenancy:install');
|
||||
pest()->artisan('tenancy:install')
|
||||
->expectsConfirmation('Would you like to show your support by starring the project on github ?', 'no')
|
||||
->assertExitCode(0);
|
||||
expect(base_path('routes/tenant.php'))->toBeFile();
|
||||
expect(base_path('config/tenancy.php'))->toBeFile();
|
||||
expect(app_path('Providers/TenancyServiceProvider.php'))->toBeFile();
|
||||
|
|
@ -210,7 +212,8 @@ test('run command with array of tenants works', function () {
|
|||
test('link command works', function() {
|
||||
$tenantId1 = Tenant::create()->getTenantKey();
|
||||
$tenantId2 = Tenant::create()->getTenantKey();
|
||||
pest()->artisan('tenants:link');
|
||||
pest()->artisan('tenants:link')
|
||||
->assertExitCode(0);
|
||||
|
||||
$this->assertDirectoryExists(storage_path("tenant-$tenantId1/app/public"));
|
||||
$this->assertEquals(storage_path("tenant-$tenantId1/app/public/"), readlink(public_path("public-$tenantId1")));
|
||||
|
|
@ -220,7 +223,8 @@ test('link command works', function() {
|
|||
|
||||
pest()->artisan('tenants:link', [
|
||||
'--remove' => true,
|
||||
]);
|
||||
])
|
||||
->assertExitCode(0);
|
||||
|
||||
$this->assertDirectoryDoesNotExist(public_path("public-$tenantId1"));
|
||||
$this->assertDirectoryDoesNotExist(public_path("public-$tenantId2"));
|
||||
|
|
@ -252,8 +256,9 @@ test('run command works when sub command asks questions and accepts arguments',
|
|||
|
||||
pest()->artisan("tenants:run --tenants=$id 'user:addwithname Abrar' ")
|
||||
->expectsQuestion('What is your email?', 'email@localhost')
|
||||
->expectsOutput("Tenant: $id")
|
||||
->expectsOutput("User created: Abrar(email@localhost)");
|
||||
->expectsOutputToContain("Tenant: $id.")
|
||||
->expectsOutput("User created: Abrar(email@localhost)")
|
||||
->assertExitCode(0);
|
||||
|
||||
// Assert we are in central context
|
||||
expect(tenancy()->initialized)->toBeFalse();
|
||||
|
|
|
|||
|
|
@ -44,12 +44,18 @@ test('tenants can be put into maintenance mode using artisan commands', function
|
|||
|
||||
pest()->get('http://acme.localhost/foo')->assertStatus(200);
|
||||
|
||||
pest()->artisan('tenants:down')
|
||||
->expectsOutputToContain('Tenants are now in maintenance mode.')
|
||||
->assertExitCode(0);
|
||||
|
||||
Artisan::call('tenants:down');
|
||||
|
||||
tenancy()->end(); // End tenancy before making a request
|
||||
pest()->get('http://acme.localhost/foo')->assertStatus(503);
|
||||
|
||||
Artisan::call('tenants:up');
|
||||
pest()->artisan('tenants:up')
|
||||
->expectsOutputToContain('Tenants are now out of maintenance mode.')
|
||||
->assertExitCode(0);
|
||||
|
||||
tenancy()->end(); // End tenancy before making a request
|
||||
pest()->get('http://acme.localhost/foo')->assertStatus(200);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue