1919use Tempest \Process \GenericProcessExecutor ;
2020use Tempest \Router \Exceptions \HttpExceptionHandler ;
2121
22+ use function Tempest \Support \Filesystem \real_path ;
23+
2224final class FrameworkKernel implements Kernel
2325{
2426 public readonly Container $ container ;
@@ -34,14 +36,20 @@ public function __construct(
3436 /** @var \Tempest\Discovery\DiscoveryLocation[] $discoveryLocations */
3537 public array $ discoveryLocations = [],
3638 ?Container $ container = null ,
39+ ?string $ internalStorage = null ,
3740 ) {
3841 $ this ->container = $ container ?? $ this ->createContainer ();
42+
43+ if ($ internalStorage !== null ) {
44+ $ this ->internalStorage = $ internalStorage ;
45+ }
3946 }
4047
4148 public static function boot (
4249 string $ root ,
4350 array $ discoveryLocations = [],
4451 ?Container $ container = null ,
52+ ?string $ internalStorage = null ,
4553 ): self {
4654 if (! defined ('TEMPEST_START ' )) {
4755 define ('TEMPEST_START ' , value: hrtime (true ));
@@ -51,6 +59,7 @@ public static function boot(
5159 root: $ root ,
5260 discoveryLocations: $ discoveryLocations ,
5361 container: $ container ,
62+ internalStorage: $ internalStorage ,
5463 )
5564 ->validateRoot ()
5665 ->loadEnv ()
@@ -68,7 +77,7 @@ public static function boot(
6877
6978 public function validateRoot (): self
7079 {
71- $ root = realpath ($ this ->root );
80+ $ root = real_path ($ this ->root );
7281
7382 if (! is_dir ($ root )) {
7483 throw new RuntimeException ('The specified root directory is not valid. ' );
@@ -175,7 +184,7 @@ public function loadConfig(): self
175184
176185 public function registerInternalStorage (): self
177186 {
178- $ path = $ this ->root . '/.tempest ' ;
187+ $ path = isset ( $ this -> internalStorage ) ? $ this -> internalStorage : $ this ->root . '/.tempest ' ;
179188
180189 if (! is_dir ($ path )) {
181190 if (file_exists ($ path )) {
@@ -189,7 +198,7 @@ public function registerInternalStorage(): self
189198 throw CouldNotRegisterInternalStorage::noPermission ($ path );
190199 }
191200
192- $ this ->internalStorage = realpath ($ path );
201+ $ this ->internalStorage = real_path ($ path );
193202
194203 return $ this ;
195204 }
0 commit comments