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

add docker [wip]

This commit is contained in:
Samuel Štancl 2019-07-12 22:25:45 +02:00
commit acdf39d15b
17 changed files with 358 additions and 47 deletions

View file

@ -36,7 +36,7 @@ abstract class TestCase extends \Orchestra\Testbench\TestCase
public function initTenancy($domain = 'localhost')
{
tenancy()->init($domain);
return tenancy()->init($domain);
}
/**
@ -53,6 +53,8 @@ abstract class TestCase extends \Orchestra\Testbench\TestCase
$app['config']->set([
'database.redis.client' => 'phpredis',
'database.redis.cache.host' => env('TENANCY_TEST_REDIS_HOST', '127.0.0.1'),
'database.redis.default.host' => env('TENANCY_TEST_REDIS_HOST', '127.0.0.1'),
'database.redis.tenancy' => [
'host' => env('TENANCY_TEST_REDIS_HOST', '127.0.0.1'),
'password' => env('TENANCY_TEST_REDIS_PASSWORD', null),
@ -67,12 +69,16 @@ abstract class TestCase extends \Orchestra\Testbench\TestCase
'suffix' => '.sqlite',
],
'database.connections.sqlite.database' => ':memory:',
'database.connections.pgsql.username' => 'postgres',
'database.connections.mysql.host' => env('TENANCY_TEST_MYSQL_HOST', '127.0.0.1'),
'database.connections.pgsql.host' => env('TENANCY_TEST_PGSQL_HOST', '127.0.0.1'),
// 'database.connections.pgsql.username' => 'pgsqluser',
'tenancy.filesystem.disks' => [
'local',
'public',
's3',
],
'tenancy.redis.tenancy' => true,
'tenancy.migrations_directory' => database_path('../migrations'),
]);
}
@ -113,11 +119,9 @@ abstract class TestCase extends \Orchestra\Testbench\TestCase
return substr(str_shuffle(str_repeat($x = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ', ceil($length / strlen($x)))), 1, $length);
}
public function isTravis()
public function isContainerized()
{
// Multiple, just to make sure. Someone might accidentally
// set one of these environment vars on their computer.
return env('CI') && env('TRAVIS') && env('CONTINUOUS_INTEGRATION');
return env('CONTINUOUS_INTEGRATION') || env('DOCKER');
}
public function assertArrayIsSubset($subset, $array, string $message = ''): void