mirror of
https://github.com/archtechx/tenancy.git
synced 2026-02-05 05:14:03 +00:00
wip
This commit is contained in:
commit
c38dd1bb9a
8 changed files with 196 additions and 53 deletions
|
|
@ -26,7 +26,7 @@ abstract class TestCase extends \Orchestra\Testbench\TestCase
|
|||
Artisan::call('migrate:fresh', [
|
||||
'--path' => __DIR__ . '/../src/assets/migrations'
|
||||
]);
|
||||
dd(Artisan::output());
|
||||
// dd(Artisan::output());
|
||||
// $this->loadLaravelMigrations();
|
||||
// $this->loadMigrationsFrom(__DIR__ . '/../src/assets/migrations');
|
||||
|
||||
|
|
@ -62,7 +62,6 @@ 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.options.prefix' => 'foo',
|
||||
|
|
@ -88,33 +87,22 @@ abstract class TestCase extends \Orchestra\Testbench\TestCase
|
|||
'public',
|
||||
's3',
|
||||
],
|
||||
'tenancy.redis.tenancy' => true,
|
||||
'tenancy.redis.tenancy' => env('TENANCY_TEST_REDIS_TENANCY', true),
|
||||
'database.redis.client' => env('TENANCY_TEST_REDIS_CLIENT', 'phpredis'),
|
||||
'tenancy.redis.prefixed_connections' => ['default'],
|
||||
'tenancy.migrations_directory' => database_path('../migrations'),
|
||||
]);
|
||||
|
||||
switch ((string) env('STANCL_TENANCY_TEST_VARIANT', '1')) {
|
||||
case '3':
|
||||
$app['config']->set([
|
||||
'tenancy.redis.tenancy' => true,
|
||||
'database.redis.client' => 'phpredis',
|
||||
'tenancy.storage_driver' => DatabaseStorageDriver::class,
|
||||
]);
|
||||
tenancy()->setStorageDriver(DatabaseStorageDriver::class);
|
||||
|
||||
break;
|
||||
case '2':
|
||||
$app['config']->set([
|
||||
'tenancy.redis.tenancy' => false,
|
||||
'database.redis.client' => 'predis',
|
||||
]);
|
||||
break;
|
||||
default:
|
||||
$app['config']->set([
|
||||
'tenancy.redis.tenancy' => true,
|
||||
'database.redis.client' => 'phpredis',
|
||||
]);
|
||||
if (env('TENANCY_TEST_STORAGE_DRIVER', 'redis') === 'db') {
|
||||
$app['config']->set([
|
||||
'tenancy.redis.tenancy' => true,
|
||||
'database.redis.client' => 'phpredis',
|
||||
'tenancy.storage_driver' => DatabaseStorageDriver::class,
|
||||
]);
|
||||
|
||||
tenancy()->setStorageDriver(DatabaseStorageDriver::class);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected function getPackageProviders($app)
|
||||
|
|
@ -141,6 +129,17 @@ abstract class TestCase extends \Orchestra\Testbench\TestCase
|
|||
$app->singleton('Illuminate\Contracts\Http\Kernel', Etc\HttpKernel::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolve application Console Kernel implementation.
|
||||
*
|
||||
* @param \Illuminate\Foundation\Application $app
|
||||
* @return void
|
||||
*/
|
||||
protected function resolveApplicationConsoleKernel($app)
|
||||
{
|
||||
$app->singleton('Illuminate\Contracts\Console\Kernel', Etc\ConsoleKernel::class);
|
||||
}
|
||||
|
||||
public function randomString(int $length = 10)
|
||||
{
|
||||
return substr(str_shuffle(str_repeat($x = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ', ceil($length / strlen($x)))), 1, $length);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue