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

[4.x] Update commands CLI outputs (#968)

* Using laravel components

* Ensure commands returns success

* update tests

* clean

* bump EndBug version

* Update ci.yml

* Update ci.yml

* Update ci.yml

* revert CI changes

* Update ci.yml

* Update ci.yml

* Update ci.yml

* revert CI changes to it's original state

* fix typos, improve code

* improve Install & TenantList commands

* php-cs-fixer

* type GitHub properly

Co-authored-by: Abrar Ahmad <abrar.dev99@gmail.com>
Co-authored-by: Samuel Štancl <samuel@archte.ch>
Co-authored-by: Samuel Štancl <samuel.stancl@gmail.com>
This commit is contained in:
Jori Stein 2022-10-18 13:11:57 -04:00 committed by GitHub
parent 05f1b2d6f5
commit e4f5b92485
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 217 additions and 96 deletions

View file

@ -171,7 +171,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();
@ -214,7 +216,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")));
@ -224,7 +227,7 @@ 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"));
@ -256,8 +259,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();