1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2025-12-12 12:54:05 +00:00

Completing PR #881 (#902)

* install PHP CS Fixer

* Fix styling

* remove StyleCI config

* use config from archtechx/template

* Fix styling

* added `php-cs-fixer`

* Update .php-cs-fixer.php

* added GitHub token

* Update ci.yml

* Update ci.yml

* Update ci.yml

* php-cs-fixer workflow same as template

Co-authored-by: Erik Gaal <me@erikgaal.nl>
Co-authored-by: erikgaal <erikgaal@users.noreply.github.com>
This commit is contained in:
Abrar Ahmad 2022-07-20 18:28:45 +05:00 committed by GitHub
parent 627233d07a
commit 97ab483173
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
43 changed files with 231 additions and 111 deletions

View file

@ -5,26 +5,26 @@ declare(strict_types=1);
namespace Stancl\Tenancy\Tests;
use Illuminate\Filesystem\FilesystemAdapter;
use ReflectionObject;
use ReflectionProperty;
use Illuminate\Support\Str;
use Illuminate\Support\Facades\DB;
use Stancl\JobPipeline\JobPipeline;
use Stancl\Tenancy\Tests\Etc\Tenant;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Event;
use Illuminate\Support\Facades\Redis;
use Illuminate\Support\Facades\Storage;
use Stancl\Tenancy\Events\TenancyEnded;
use Stancl\Tenancy\Jobs\CreateDatabase;
use Stancl\Tenancy\Events\TenantCreated;
use Stancl\Tenancy\Events\TenancyInitialized;
use Stancl\Tenancy\Listeners\BootstrapTenancy;
use Stancl\Tenancy\Listeners\RevertToCentralContext;
use Illuminate\Support\Str;
use ReflectionObject;
use ReflectionProperty;
use Stancl\JobPipeline\JobPipeline;
use Stancl\Tenancy\Bootstrappers\CacheTenancyBootstrapper;
use Stancl\Tenancy\Bootstrappers\RedisTenancyBootstrapper;
use Stancl\Tenancy\Bootstrappers\DatabaseTenancyBootstrapper;
use Stancl\Tenancy\Bootstrappers\FilesystemTenancyBootstrapper;
use Stancl\Tenancy\Bootstrappers\RedisTenancyBootstrapper;
use Stancl\Tenancy\Events\TenancyEnded;
use Stancl\Tenancy\Events\TenancyInitialized;
use Stancl\Tenancy\Events\TenantCreated;
use Stancl\Tenancy\Jobs\CreateDatabase;
use Stancl\Tenancy\Listeners\BootstrapTenancy;
use Stancl\Tenancy\Listeners\RevertToCentralContext;
use Stancl\Tenancy\Tests\Etc\Tenant;
class BootstrapperTest extends TestCase
{

View file

@ -19,7 +19,7 @@ class ExampleSeeder extends Seeder
{
DB::table('users')->insert([
'name' => Str::random(10),
'email' => Str::random(10).'@gmail.com',
'email' => Str::random(10) . '@gmail.com',
'password' => bcrypt('password'),
]);
}

View file

@ -20,7 +20,6 @@ use Stancl\Tenancy\Jobs\CreateDatabase;
use Stancl\Tenancy\Jobs\MigrateDatabase;
use Stancl\Tenancy\Listeners\BootstrapTenancy;
use Stancl\Tenancy\Listeners\QueueableListener;
use Stancl\Tenancy\Tenancy;
use Stancl\Tenancy\Tests\Etc\Tenant;
class EventListenerTest extends TestCase

View file

@ -4,14 +4,12 @@ declare(strict_types=1);
namespace Stancl\Tenancy\Tests;
use Symfony\Component\HttpKernel\Exception\HttpException;
use Illuminate\Foundation\Http\Exceptions\MaintenanceModeException;
use Illuminate\Support\Facades\Route;
use Stancl\Tenancy\Database\Concerns\MaintenanceMode;
use Stancl\Tenancy\Middleware\CheckTenantForMaintenanceMode;
use Stancl\Tenancy\Middleware\InitializeTenancyByDomain;
use Stancl\Tenancy\Tests\Etc\Tenant;
use Symfony\Component\HttpKernel\Exception\ServiceUnavailableHttpException;
use Symfony\Component\HttpKernel\Exception\HttpException;
class MaintenanceModeTest extends TestCase
{

View file

@ -4,33 +4,31 @@ declare(strict_types=1);
namespace Stancl\Tenancy\Tests;
use Closure;
use Exception;
use Illuminate\Support\Str;
use Illuminate\Bus\Queueable;
use Spatie\Valuestore\Valuestore;
use Illuminate\Support\Facades\DB;
use Stancl\Tenancy\Tests\Etc\User;
use Stancl\JobPipeline\JobPipeline;
use Stancl\Tenancy\Tests\Etc\Tenant;
use Illuminate\Support\Facades\Event;
use Illuminate\Queue\SerializesModels;
use Illuminate\Support\Facades\Schema;
use Stancl\Tenancy\Events\TenancyEnded;
use Stancl\Tenancy\Jobs\CreateDatabase;
use Illuminate\Queue\InteractsWithQueue;
use Stancl\Tenancy\Events\TenantCreated;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\Events\JobProcessed;
use Illuminate\Queue\Events\JobProcessing;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use PDO;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Event;
use Illuminate\Support\Facades\Schema;
use Illuminate\Support\Str;
use Spatie\Valuestore\Valuestore;
use Stancl\JobPipeline\JobPipeline;
use Stancl\Tenancy\Bootstrappers\DatabaseTenancyBootstrapper;
use Stancl\Tenancy\Bootstrappers\QueueTenancyBootstrapper;
use Stancl\Tenancy\Events\TenancyEnded;
use Stancl\Tenancy\Events\TenancyInitialized;
use Stancl\Tenancy\Events\TenantCreated;
use Stancl\Tenancy\Jobs\CreateDatabase;
use Stancl\Tenancy\Listeners\BootstrapTenancy;
use Stancl\Tenancy\Listeners\RevertToCentralContext;
use Stancl\Tenancy\Bootstrappers\QueueTenancyBootstrapper;
use Stancl\Tenancy\Bootstrappers\DatabaseTenancyBootstrapper;
use Stancl\Tenancy\Tests\Etc\Tenant;
use Stancl\Tenancy\Tests\Etc\User;
class QueueTest extends TestCase
{

View file

@ -589,7 +589,9 @@ class CentralUser extends Model implements SyncMaster
use ResourceSyncing, CentralConnection;
protected $guarded = [];
public $timestamps = false;
public $table = 'users';
public function tenants(): BelongsToMany
@ -633,7 +635,9 @@ class ResourceUser extends Model implements Syncable
use ResourceSyncing;
protected $table = 'users';
protected $guarded = [];
public $timestamps = false;
public function getGlobalIdentifierKey()

View file

@ -329,6 +329,7 @@ class Post extends Model
use BelongsToTenant;
protected $guarded = [];
public $timestamps = false;
public function comments()
@ -345,6 +346,7 @@ class Post extends Model
class Comment extends Model
{
protected $guarded = [];
public $timestamps = false;
public function post()
@ -368,5 +370,6 @@ class ScopedComment extends Comment
class GlobalResource extends Model
{
protected $guarded = [];
public $timestamps = false;
}

View file

@ -104,7 +104,7 @@ class TenantDatabaseManagerTest extends TestCase
['sqlite', SQLiteDatabaseManager::class],
['pgsql', PostgreSQLDatabaseManager::class],
['pgsql', PostgreSQLSchemaManager::class],
['sqlsrv', MicrosoftSQLDatabaseManager::class]
['sqlsrv', MicrosoftSQLDatabaseManager::class],
];
}
@ -196,7 +196,7 @@ class TenantDatabaseManagerTest extends TestCase
]);
tenancy()->initialize($tenant);
$schemaConfig = version_compare(app()->version(), '9.0', '>=') ?
$schemaConfig = version_compare(app()->version(), '9.0', '>=') ?
config('database.connections.' . config('database.default') . '.search_path') :
config('database.connections.' . config('database.default') . '.schema');

View file

@ -172,6 +172,7 @@ class MyTenant extends Tenant
class AnotherTenant extends Model implements Contracts\Tenant
{
protected $guarded = [];
protected $table = 'tenants';
public function getTenantKeyName(): string

View file

@ -274,11 +274,13 @@ class TenantUserImpersonationTest extends TestCase
class ImpersonationUser extends Authenticable
{
protected $guarded = [];
protected $table = 'users';
}
class AnotherImpersonationUser extends Authenticable
{
protected $guarded = [];
protected $table = 'users';
}