1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2025-12-12 12:54:05 +00:00
tenancy/tests/TestCase.php
2019-02-07 15:39:39 +01:00

64 lines
1.7 KiB
PHP

<?php
namespace Stancl\Tenancy\Tests;
use Illuminate\Support\Facades\Redis;
class TestCase extends \Orchestra\Testbench\TestCase
{
/**
* Setup the test environment
*
* @return void
*/
protected function setUp()
{
parent::setUp();
Redis::connection('tenancy')->flushdb();
tenant()->create('localhost');
tenancy()->init('localhost');
}
/**
* Define environment setup.
*
* @param \Illuminate\Foundation\Application $app
* @return void
*/
protected function getEnvironmentSetUp($app)
{
$app['config']->set('database.redis.client', 'phpredis');
$app['config']->set('database.redis.tenancy', [
'host' => env('TENANCY_TEST_REDIS_HOST', '127.0.0.1'),
'password' => env('TENANCY_TEST_REDIS_PASSWORD', null),
'port' => env('TENANCY_TEST_REDIS_PORT', 6379),
// Use the #14 Redis database unless specified otherwise.
// Make sure you don't store anything in this db!
'database' => env('TENANCY_TEST_REDIS_DB', 14),
]);
$app['config']->set('tenancy.database', [
'based_on' => 'sqlite',
'prefix' => 'tenant',
'suffix' => '.sqlite',
]);
}
protected function getPackageProviders($app)
{
return [\Stancl\Tenancy\TenancyServiceProvider::class];
}
/**
* Resolve application HTTP Kernel implementation.
*
* @param \Illuminate\Foundation\Application $app
* @return void
*/
protected function resolveApplicationHttpKernel($app)
{
$app->singleton('Illuminate\Contracts\Http\Kernel', HttpKernel::class);
}
}