mirror of
https://github.com/archtechx/tenancy.git
synced 2025-12-12 16:24:04 +00:00
Dockerize phpunit (#66)
This commit is contained in:
parent
13cdc03103
commit
dc30354699
9 changed files with 93 additions and 20 deletions
|
|
@ -40,7 +40,7 @@ class TenantDatabaseManagerTest extends TestCase
|
|||
/** @test */
|
||||
public function mysql_database_can_be_created_and_deleted()
|
||||
{
|
||||
if (! $this->isTravis()) {
|
||||
if (! $this->isContainerized()) {
|
||||
$this->markTestSkipped('As to not bloat your MySQL instance with test databases, this test is not run by default.');
|
||||
}
|
||||
|
||||
|
|
@ -57,7 +57,7 @@ class TenantDatabaseManagerTest extends TestCase
|
|||
/** @test */
|
||||
public function mysql_database_can_be_created_and_deleted_using_queued_commands()
|
||||
{
|
||||
if (! $this->isTravis()) {
|
||||
if (! $this->isContainerized()) {
|
||||
$this->markTestSkipped('As to not bloat your MySQL instance with test databases, this test is not run by default.');
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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,6 +69,8 @@ abstract class TestCase extends \Orchestra\Testbench\TestCase
|
|||
'suffix' => '.sqlite',
|
||||
],
|
||||
'database.connections.sqlite.database' => ':memory:',
|
||||
'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'),
|
||||
'tenancy.filesystem.disks' => [
|
||||
'local',
|
||||
'public',
|
||||
|
|
@ -114,11 +118,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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue