Skip to content

Commit

Permalink
Fix temp directory config path and add unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
NiroDeveloper committed Jan 22, 2025
1 parent f54e76b commit 39b477c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/BackupServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public function packageRegistered(): void
$this->app->singleton(ConsoleOutput::class);

$this->app->bind(CleanupStrategy::class, config('backup.cleanup.strategy'));
$this->app->bind('backup-temporary-project', fn () => new TemporaryDirectory(config('backup.temporary_directory') ?? storage_path('app/backup-temp')));
$this->app->bind('backup-temporary-project', fn () => new TemporaryDirectory(config('backup.backup.temporary_directory') ?? storage_path('app/backup-temp')));

$this->registerDiscordChannel();

Expand Down
8 changes: 8 additions & 0 deletions tests/Config/ConfigTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,11 @@
expect($config->backup)->toBeInstanceOf(BackupConfig::class);
expect($config->backup->name)->toBe('foo');
});

it('receives temp directory as configured from service container', function () {
config()->set('backup.backup.temporary_directory', '/foo');

$tempDirectory = app()->make('backup-temporary-project');

expect($tempDirectory->path())->toBe('/foo');
});

0 comments on commit 39b477c

Please sign in to comment.