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

[3.x] L10 compatibility (#1065)

* Bump dependencies for Laravel 10

* Update GitHub Actions for Laravel 10

* ci: do not test L10 using PHP 7.3

* drop < L9 support

* use `dispatch_sync` instead of `dispatch_now`

* migrate phpunit configuration

* Update ci.yml

* drop laravel < 9 support

* misc L10 fixes, new docker image

* specify odbc version

* wip

* properly list php versions as strings

* minor changes

* Add `getValue($queryGrammar)` to raw query

* Clean up `isVersion8` code

* rewrite hasFailed assertion

* phpunit schema update

* Upgrade `doctrine/dbal`

---------

Co-authored-by: Samuel Štancl <samuel@archte.ch>
Co-authored-by: Samuel Štancl <samuel.stancl@gmail.com>
Co-authored-by: lukinovec <lukinovec@gmail.com>
This commit is contained in:
Guilherme Saade 2023-02-16 13:21:06 -03:00 committed by GitHub
parent 7d59ff180f
commit d4a99011e6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 108 additions and 128 deletions

View file

@ -207,10 +207,6 @@ class BootstrapperTest extends TestCase
$disk = Storage::disk($disk);
$adapter = $disk->getAdapter();
if (! Str::startsWith(app()->version(), '9.')) {
return $adapter->getPathPrefix();
}
$prefixer = (new ReflectionObject($adapter))->getProperty('prefixer');
$prefixer->setAccessible(true);

View file

@ -94,7 +94,7 @@ class EventListenerTest extends TestCase
});
$tenant = Tenant::create();
dispatch_now(new CreateDatabase($tenant));
dispatch_sync(new CreateDatabase($tenant));
$this->assertFalse($tenant->database()->manager()->databaseExists(
$tenant->database()->getName()
@ -192,12 +192,13 @@ class EventListenerTest extends TestCase
})->toListener()
);
Tenant::create([
$tenant = Tenant::create([
'tenancy_create_database' => false,
'tenancy_db_name' => 'already_created',
]);
$this->assertFalse($this->hasFailed());
// assert test didn't fail
$this->assertTrue($tenant->exists());
}
}

View file

@ -12,10 +12,6 @@ class ViteBundlerTest extends TestCase
/** @test */
public function the_vite_helper_uses_our_custom_class()
{
if (version_compare(app()->version(), '9.0', '<')) {
$this->markTestSkipped('Vite is only used in Laravel 9+');
}
$vite = app(\Illuminate\Foundation\Vite::class);
$this->assertInstanceOf(\Illuminate\Foundation\Vite::class, $vite);

View file

@ -197,10 +197,6 @@ class QueueTest extends TestCase
*/
public function tenancy_is_initialized_when_retrying_jobs(bool $shouldEndTenancy)
{
if (! Str::startsWith(app()->version(), '8')) {
$this->markTestSkipped('queue:retry tenancy is only supported in Laravel 8');
}
$this->withFailedJobs();
$this->withTenantDatabases();

View file

@ -95,7 +95,7 @@ class TenantDatabaseManagerTest extends TestCase
$this->assertTrue($postgresManager->databaseExists($database));
}
public function database_manager_provider()
public static function database_manager_provider()
{
return [
['mysql', MySQLDatabaseManager::class],
@ -194,9 +194,7 @@ class TenantDatabaseManagerTest extends TestCase
]);
tenancy()->initialize($tenant);
$schemaConfig = version_compare(app()->version(), '9.0', '>=') ?
config('database.connections.' . config('database.default') . '.search_path') :
config('database.connections.' . config('database.default') . '.schema');
$schemaConfig = config('database.connections.' . config('database.default') . '.search_path');
$this->assertSame($tenant->database()->getName(), $schemaConfig);
$this->assertSame($originalDatabaseName, config(['database.connections.pgsql.database']));