mirror of
https://github.com/archtechx/tenancy.git
synced 2025-12-14 05:24:03 +00:00
Make test priovide sufficient context for understanding the default behavior, improve test by making assertions more specific
This commit is contained in:
parent
108e0d1363
commit
e133c87c66
1 changed files with 17 additions and 4 deletions
|
|
@ -66,7 +66,7 @@ test('storage path channels get tenant-specific paths by default', function () {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
test('all channels included in the log stack get processed', function () {
|
test('all channels included in the log stack get processed correctly', function () {
|
||||||
config([
|
config([
|
||||||
'tenancy.bootstrappers' => [
|
'tenancy.bootstrappers' => [
|
||||||
FilesystemTenancyBootstrapper::class,
|
FilesystemTenancyBootstrapper::class,
|
||||||
|
|
@ -79,16 +79,29 @@ test('all channels included in the log stack get processed', function () {
|
||||||
],
|
],
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
$centralStoragePath = storage_path();
|
||||||
|
$centralLogPath = $centralStoragePath . '/logs/laravel.log';
|
||||||
$originalSinglePath = config('logging.channels.single.path');
|
$originalSinglePath = config('logging.channels.single.path');
|
||||||
$originalDailyPath = config('logging.channels.daily.path');
|
$originalDailyPath = config('logging.channels.daily.path');
|
||||||
|
|
||||||
|
// By default, both paths are the same in the config.
|
||||||
|
// Note that in actual usage, the daily log file name is parsed differently from the path in the config,
|
||||||
|
// but the paths *in the config* are the same.
|
||||||
|
expect($centralLogPath)
|
||||||
|
->toBe($centralStoragePath . '/logs/laravel.log')
|
||||||
|
->toBe($originalSinglePath)
|
||||||
|
->toBe($originalDailyPath);
|
||||||
|
|
||||||
$tenant = Tenant::create();
|
$tenant = Tenant::create();
|
||||||
|
|
||||||
tenancy()->initialize($tenant);
|
tenancy()->initialize($tenant);
|
||||||
|
|
||||||
// Both channels in the stack should be updated
|
// Both channels in the stack are updated correctly
|
||||||
expect(config('logging.channels.single.path'))->not()->toBe($originalSinglePath);
|
expect("{$centralStoragePath}/tenant{$tenant->id}/logs/laravel.log")
|
||||||
expect(config('logging.channels.daily.path'))->not()->toBe($originalDailyPath);
|
->not()->toBe($originalSinglePath)
|
||||||
|
->not()->toBe($originalDailyPath)
|
||||||
|
->toBe(config('logging.channels.single.path'))
|
||||||
|
->toBe(config('logging.channels.daily.path'));
|
||||||
|
|
||||||
tenancy()->end();
|
tenancy()->end();
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue