mirror of
https://github.com/archtechx/tenancy.git
synced 2025-12-12 14:34:04 +00:00
Apply fixes from StyleCI
This commit is contained in:
parent
417330decd
commit
84890cdd1e
20 changed files with 73 additions and 73 deletions
|
|
@ -86,7 +86,7 @@ class BootstrapsTenancyTest extends TestCase
|
|||
$current_path_prefix = \Storage::disk($disk)->getAdapter()->getPathPrefix();
|
||||
|
||||
if ($override = config("tenancy.filesystem.root_override.{$disk}")) {
|
||||
$correct_path_prefix = str_replace('%storage_path%', storage_path(), $override);
|
||||
$correct_path_prefix = \str_replace('%storage_path%', storage_path(), $override);
|
||||
} else {
|
||||
if ($base = $old_storage_facade_roots[$disk]) {
|
||||
$correct_path_prefix = $base . "/$suffix/";
|
||||
|
|
|
|||
|
|
@ -117,14 +117,14 @@ class CommandsTest extends TestCase
|
|||
/** @test */
|
||||
public function install_command_works()
|
||||
{
|
||||
if (! is_dir($dir = app_path('Http'))) {
|
||||
mkdir($dir, 0777, true);
|
||||
if (! \is_dir($dir = app_path('Http'))) {
|
||||
\mkdir($dir, 0777, true);
|
||||
}
|
||||
if (! is_dir($dir = base_path('routes'))) {
|
||||
mkdir($dir, 0777, true);
|
||||
if (! \is_dir($dir = base_path('routes'))) {
|
||||
\mkdir($dir, 0777, true);
|
||||
}
|
||||
|
||||
file_put_contents(app_path('Http/Kernel.php'), "<?php
|
||||
\file_put_contents(app_path('Http/Kernel.php'), "<?php
|
||||
|
||||
namespace App\Http;
|
||||
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ class ReidentificationTest extends TestCase
|
|||
$current_path_prefix = \Storage::disk($disk)->getAdapter()->getPathPrefix();
|
||||
|
||||
if ($override = config("tenancy.filesystem.root_override.{$disk}")) {
|
||||
$correct_path_prefix = str_replace('%storage_path%', storage_path(), $override);
|
||||
$correct_path_prefix = \str_replace('%storage_path%', storage_path(), $override);
|
||||
} else {
|
||||
if ($base = $originals[$disk]) {
|
||||
$correct_path_prefix = $base . "/$suffix/";
|
||||
|
|
|
|||
|
|
@ -16,9 +16,9 @@ class TenantAssetTest extends TestCase
|
|||
$this->get(tenant_asset($filename))->assertSuccessful();
|
||||
$this->assertFileExists($path);
|
||||
|
||||
$f = fopen($path, 'r');
|
||||
$content = fread($f, filesize($path));
|
||||
fclose($f);
|
||||
$f = \fopen($path, 'r');
|
||||
$content = \fread($f, \filesize($path));
|
||||
\fclose($f);
|
||||
|
||||
$this->assertSame('bar', $content);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@ class TenantDatabaseManagerTest extends TestCase
|
|||
|
||||
config()->set('database.default', 'pgsql');
|
||||
|
||||
$db_name = strtolower('testdatabase' . $this->randomString(10));
|
||||
$db_name = \strtolower('testdatabase' . $this->randomString(10));
|
||||
$this->assertTrue(app(DatabaseManager::class)->create($db_name, 'pgsql'));
|
||||
$this->assertNotEmpty(DB::select("SELECT datname FROM pg_database WHERE datname = '$db_name'"));
|
||||
|
||||
|
|
@ -104,7 +104,7 @@ class TenantDatabaseManagerTest extends TestCase
|
|||
|
||||
config()->set('database.default', 'pgsql');
|
||||
|
||||
$db_name = strtolower('testdatabase' . $this->randomString(10));
|
||||
$db_name = \strtolower('testdatabase' . $this->randomString(10));
|
||||
|
||||
$databaseManagers = config('tenancy.database_managers');
|
||||
$job = new QueuedTenantDatabaseCreator(app($databaseManagers['pgsql']), $db_name);
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ class TenantStorageTest extends TestCase
|
|||
{
|
||||
$keys = ['foo', 'abc'];
|
||||
$vals = ['bar', 'xyz'];
|
||||
$data = array_combine($keys, $vals);
|
||||
$data = \array_combine($keys, $vals);
|
||||
|
||||
tenancy()->put($data);
|
||||
dd(tenant()->get($keys));
|
||||
|
|
@ -76,13 +76,13 @@ class TenantStorageTest extends TestCase
|
|||
|
||||
$keys = ['foo', 'abc'];
|
||||
$vals = ['bar', 'xyz'];
|
||||
$data = array_combine($keys, $vals);
|
||||
$data = \array_combine($keys, $vals);
|
||||
|
||||
tenancy()->put($data, null, $uuid);
|
||||
|
||||
$this->assertSame($vals, tenancy()->get($keys, $uuid));
|
||||
$this->assertNotSame($vals, tenancy()->get($keys));
|
||||
$this->assertFalse(array_intersect($data, tenant()->tenant) == $data); // assert array not subset
|
||||
$this->assertFalse(\array_intersect($data, tenant()->tenant) == $data); // assert array not subset
|
||||
}
|
||||
|
||||
/** @test */
|
||||
|
|
@ -130,15 +130,15 @@ class TenantStorageTest extends TestCase
|
|||
public function data_is_stored_with_correct_data_types()
|
||||
{
|
||||
tenancy()->put('someBool', false);
|
||||
$this->assertSame('boolean', gettype(tenancy()->get('someBool')));
|
||||
$this->assertSame('boolean', \gettype(tenancy()->get('someBool')));
|
||||
|
||||
tenancy()->put('someInt', 5);
|
||||
$this->assertSame('integer', gettype(tenancy()->get('someInt')));
|
||||
$this->assertSame('integer', \gettype(tenancy()->get('someInt')));
|
||||
|
||||
tenancy()->put('someDouble', 11.40);
|
||||
$this->assertSame('double', gettype(tenancy()->get('someDouble')));
|
||||
$this->assertSame('double', \gettype(tenancy()->get('someDouble')));
|
||||
|
||||
tenancy()->put('string', 'foo');
|
||||
$this->assertSame('string', gettype(tenancy()->get('string')));
|
||||
$this->assertSame('string', \gettype(tenancy()->get('string')));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ abstract class TestCase extends \Orchestra\Testbench\TestCase
|
|||
Redis::connection('cache')->flushdb();
|
||||
|
||||
$this->loadMigrationsFrom([
|
||||
'--path' => realpath(__DIR__ . '/../assets/migrations'),
|
||||
'--path' => \realpath(__DIR__ . '/../assets/migrations'),
|
||||
'--database' => 'central',
|
||||
]);
|
||||
config(['database.default' => 'sqlite']); // fix issue caused by loadMigrationsFrom
|
||||
|
|
@ -63,11 +63,11 @@ abstract class TestCase extends \Orchestra\Testbench\TestCase
|
|||
*/
|
||||
protected function getEnvironmentSetUp($app)
|
||||
{
|
||||
if (file_exists(__DIR__ . '/../.env')) {
|
||||
if (\file_exists(__DIR__ . '/../.env')) {
|
||||
\Dotenv\Dotenv::create(__DIR__ . '/..')->load();
|
||||
}
|
||||
|
||||
fclose(fopen(database_path('central.sqlite'), 'w'));
|
||||
\fclose(\fopen(database_path('central.sqlite'), 'w'));
|
||||
|
||||
$app['config']->set([
|
||||
'database.redis.cache.host' => env('TENANCY_TEST_REDIS_HOST', '127.0.0.1'),
|
||||
|
|
@ -160,7 +160,7 @@ abstract class TestCase extends \Orchestra\Testbench\TestCase
|
|||
|
||||
public function randomString(int $length = 10)
|
||||
{
|
||||
return substr(str_shuffle(str_repeat($x = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ', ceil($length / strlen($x)))), 1, $length);
|
||||
return \substr(\str_shuffle(\str_repeat($x = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ', \ceil($length / \strlen($x)))), 1, $length);
|
||||
}
|
||||
|
||||
public function isContainerized()
|
||||
|
|
@ -170,6 +170,6 @@ abstract class TestCase extends \Orchestra\Testbench\TestCase
|
|||
|
||||
public function assertArrayIsSubset($subset, $array, string $message = ''): void
|
||||
{
|
||||
parent::assertTrue(array_intersect($subset, $array) == $subset, $message);
|
||||
parent::assertTrue(\array_intersect($subset, $array) == $subset, $message);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue