Skip to content

Commit

Permalink
Set path.storage for Laravel/Lumen tests
Browse files Browse the repository at this point in the history
  • Loading branch information
asgrim committed Jul 6, 2022
1 parent 7eb0879 commit 1215d8d
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,12 @@
use Scoutapm\Logger\FilteredLogLevelDecorator;

use function class_exists;
use function mkdir;
use function sprintf;
use function sys_get_temp_dir;
use function uniqid;

use const DIRECTORY_SEPARATOR;

/** @covers \Scoutapm\Laravel\Providers\ScoutApmServiceProvider */
final class ScoutApmServiceProviderUsingLaravelTest extends ScoutApmServiceProviderTestBase
Expand Down Expand Up @@ -64,6 +68,10 @@ static function () use ($application): FilteredLogLevelDecorator {
}
);

$storagePath = sys_get_temp_dir() . DIRECTORY_SEPARATOR . uniqid('scoutapm-test-laravel-storage', true) . DIRECTORY_SEPARATOR;
mkdir($storagePath);
$application->useStoragePath($storagePath);

$application->singleton(
HttpKernelInterface::class,
function () use ($application): HttpKernelInterface {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,13 @@
use Scoutapm\Logger\FilteredLogLevelDecorator;

use function class_exists;
use function method_exists;
use function mkdir;
use function sprintf;
use function sys_get_temp_dir;
use function uniqid;

use const DIRECTORY_SEPARATOR;

/** @covers \Scoutapm\Laravel\Providers\ScoutApmServiceProvider */
final class ScoutApmServiceProviderUsingLumenTest extends ScoutApmServiceProviderTestBase
Expand Down Expand Up @@ -80,6 +85,12 @@ static function () use ($application): FilteredLogLevelDecorator {
}
);

if (method_exists($application, 'useStoragePath')) {
$storagePath = sys_get_temp_dir() . DIRECTORY_SEPARATOR . uniqid('scoutapm-test-lumen-storage', true) . DIRECTORY_SEPARATOR;
mkdir($storagePath);
$application->useStoragePath($storagePath);
}

$application->make('view');
$application->singleton(
'view',
Expand Down

0 comments on commit 1215d8d

Please sign in to comment.