-
-
Notifications
You must be signed in to change notification settings - Fork 761
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Default config - Merge default backup config with user config (#1863)
* merge default backup config with user config * merge default backup config with user config * merge default backup config with user config
- Loading branch information
Showing
2 changed files
with
35 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?php | ||
|
||
use Spatie\Backup\Config\Config; | ||
use Spatie\Backup\Config\BackupConfig; | ||
use Spatie\Backup\Config\NotificationsConfig; | ||
use Spatie\Backup\Config\MonitoredBackupsConfig; | ||
use Spatie\Backup\Config\CleanupConfig; | ||
|
||
beforeEach(function () { | ||
config()->set('backup', []); | ||
}); | ||
|
||
it('returns default backup config if no backup config file exist', function () { | ||
$config = Config::fromArray(config('backup')); | ||
|
||
expect($config->backup)->toBeInstanceOf(BackupConfig::class); | ||
expect($config->notifications)->toBeInstanceOf(NotificationsConfig::class); | ||
expect($config->monitoredBackups)->toBeInstanceOf(MonitoredBackupsConfig::class); | ||
expect($config->cleanup)->toBeInstanceOf(CleanupConfig::class); | ||
}); | ||
|
||
it('returns a merged backup config made with minimal config and default config file', function () { | ||
config()->set('backup.backup.name', 'foo'); | ||
|
||
$config = Config::fromArray(config('backup')); | ||
|
||
expect($config->backup)->toBeInstanceOf(BackupConfig::class); | ||
expect($config->backup->name)->toBe('foo'); | ||
}); |