From 1215d8dd53d4be436b3ad24cf332f65a3b1e562d Mon Sep 17 00:00:00 2001 From: James Titcumb Date: Wed, 6 Jul 2022 08:27:47 +0100 Subject: [PATCH] Set path.storage for Laravel/Lumen tests --- .../ScoutApmServiceProviderUsingLaravelTest.php | 8 ++++++++ .../ScoutApmServiceProviderUsingLumenTest.php | 11 +++++++++++ 2 files changed, 19 insertions(+) diff --git a/tests/Unit/Laravel/Providers/ScoutApmServiceProviderUsingLaravelTest.php b/tests/Unit/Laravel/Providers/ScoutApmServiceProviderUsingLaravelTest.php index d5ace058..5d5b7015 100644 --- a/tests/Unit/Laravel/Providers/ScoutApmServiceProviderUsingLaravelTest.php +++ b/tests/Unit/Laravel/Providers/ScoutApmServiceProviderUsingLaravelTest.php @@ -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 @@ -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 { diff --git a/tests/Unit/Laravel/Providers/ScoutApmServiceProviderUsingLumenTest.php b/tests/Unit/Laravel/Providers/ScoutApmServiceProviderUsingLumenTest.php index 449e80e0..4b8c64fc 100644 --- a/tests/Unit/Laravel/Providers/ScoutApmServiceProviderUsingLumenTest.php +++ b/tests/Unit/Laravel/Providers/ScoutApmServiceProviderUsingLumenTest.php @@ -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 @@ -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',