From 8dae2dcc6ffffc6f888bae8c59fa28dc50d04f5f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20=C5=A0tancl?= Date: Sat, 21 Sep 2019 19:37:19 +0200 Subject: [PATCH] Fix db_name_is_prefixed test --- assets/config.php | 2 +- tests/DatabaseManagerTest.php | 3 +-- tests/TenantRedirectMacroTest.php | 7 +++++++ 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/assets/config.php b/assets/config.php index 1cbd0d26..99f9b596 100644 --- a/assets/config.php +++ b/assets/config.php @@ -71,7 +71,7 @@ return [ // Their responsibility is making Laravel features tenant-aware. 'database' => 'Stancl\Tenancy\TenancyBootstrappers\DatabaseTenancyBootstrapper', 'cache' => 'Stancl\Tenancy\TenancyBootstrappers\CacheTenancyBootstrapper', - // 'filesystem' => 'Stancl\Tenancy\TenancyBootstrappers\FilesystemTenancyBootstrapper', + 'filesystem' => 'Stancl\Tenancy\TenancyBootstrappers\FilesystemTenancyBootstrapper', 'redis' => 'Stancl\Tenancy\TenancyBootstrappers\RedisTenancyBootstrapper', 'queue' => 'Stancl\Tenancy\TenancyBootstrappers\QueueTenancyBootstrapper', ], diff --git a/tests/DatabaseManagerTest.php b/tests/DatabaseManagerTest.php index bcc8de12..cbd976e8 100644 --- a/tests/DatabaseManagerTest.php +++ b/tests/DatabaseManagerTest.php @@ -25,8 +25,7 @@ class DatabaseManagerTest extends TestCase /** @test */ public function db_name_is_prefixed_with_db_path_when_sqlite_is_used() { - // make `tenant` not sqlite so that it has to detect sqlite from fooconn - config(['database.connections.tenant.driver' => 'mysql']); + config(['database.connections.fooconn.driver' => 'sqlite']); app(DatabaseManager::class)->createTenantConnection('foodb', 'fooconn'); $this->assertSame(config('database.connections.fooconn.database'), database_path('foodb')); diff --git a/tests/TenantRedirectMacroTest.php b/tests/TenantRedirectMacroTest.php index 34183093..7f35abee 100644 --- a/tests/TenantRedirectMacroTest.php +++ b/tests/TenantRedirectMacroTest.php @@ -5,9 +5,13 @@ declare(strict_types=1); namespace Stancl\Tenancy\Tests; use Route; +use Stancl\Tenancy\Tenant; class TenantRedirectMacroTest extends TestCase { + public $autoCreateTenant = false; + public $autoInitTenancy = false; + /** @test */ public function tenant_redirect_macro_replaces_only_the_hostname() { @@ -19,6 +23,9 @@ class TenantRedirectMacroTest extends TestCase return redirect()->route('home')->tenant('abcd'); }); + Tenant::create('foo.localhost'); + tenancy()->init('foo.localhost'); + $this->get('/redirect') ->assertRedirect('http://abcd/foobar'); }