File tree Expand file tree Collapse file tree 2 files changed +27
-0
lines changed
Expand file tree Collapse file tree 2 files changed +27
-0
lines changed Original file line number Diff line number Diff line change 66
77 use Closure ;
88 use Tempest \Core \DeferredTasks ;
9+ use Tempest \Core \Kernel ;
910
1011 function path (string ...$ parts ): string
1112 {
@@ -18,6 +19,11 @@ function path(string ...$parts): string
1819 );
1920 }
2021
22+ function root_path (string ...$ parts ): string
23+ {
24+ return path (realpath (get (Kernel::class)->root ), ...$ parts );
25+ }
26+
2127 function env (string $ key , mixed $ default = null ): mixed
2228 {
2329 $ value = getenv ($ key );
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ declare (strict_types=1 );
4+
5+ namespace Tests \Tempest \Integration \Core ;
6+
7+ use function Tempest \path ;
8+ use function Tempest \root_path ;
9+ use Tests \Tempest \Integration \FrameworkIntegrationTestCase ;
10+
11+ /**
12+ * @internal
13+ */
14+ final class RootPathHelperTest extends FrameworkIntegrationTestCase
15+ {
16+ public function test_can_get_base_path (): void
17+ {
18+ $ this ->assertSame (path (realpath ($ this ->root )), root_path ());
19+ $ this ->assertSame (path (realpath ($ this ->root . '/tests/Fixtures ' )), root_path ('/tests/Fixtures ' ));
20+ }
21+ }
You can’t perform that action at this time.
0 commit comments