1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2026-02-05 22:04:04 +00:00

complete test sqlite manager customize path

This commit is contained in:
Abrar Ahmad 2022-09-14 14:19:55 +05:00
parent abd17f83a1
commit 13fed332cd
2 changed files with 25 additions and 4 deletions

View file

@ -225,7 +225,21 @@ test('tenant database can be created on a foreign server', function () {
});
test('path used by sqlite manager can be customized', function () {
pest()->markTestIncomplete();
Event::listen(TenantCreated::class, JobPipeline::make([CreateDatabase::class])->send(function (TenantCreated $event) {
return $event->tenant;
})->toListener());
// Set custom path for SQLite file
SQLiteDatabaseManager::$path = $customPath = storage_path();
$name = Str::random(8). '.sqlite';
Tenant::create([
'tenancy_db_name' => $name,
'tenancy_db_connection' => 'sqlite',
]);
expect(file_exists( $customPath . '/' . $name))->toBeTrue();
unlink($customPath . '/' . $name); // clean up
});
// Datasets