Skip to content

Commit 87b2f7b

Browse files
fix(view): support relative view paths on windows (#1703)
1 parent 1376c02 commit 87b2f7b

File tree

2 files changed

+2
-5
lines changed

2 files changed

+2
-5
lines changed

packages/view/src/IsView.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
namespace Tempest\View;
66

77
use function Tempest\Support\path;
8+
use function Tempest\Support\Path\normalize;
89

910
/** @phpstan-require-implements \Tempest\View\View */
1011
trait IsView
@@ -24,7 +25,7 @@ public function __construct(
2425

2526
$trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
2627

27-
if (str_ends_with($trace[0]['file'], 'view/src/functions.php')) {
28+
if (str_ends_with(normalize($trace[0]['file']), 'view/src/functions.php')) {
2829
$this->relativeRootPath = path($trace[1]['file'])->dirname()->toString();
2930
} else {
3031
$this->relativeRootPath = path($trace[0]['file'])->dirname()->toString();

tests/Integration/View/TempestViewRendererTest.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,6 @@ public function test_view_renderer(): void
5353

5454
public function test_relative_view_path_rendering(): void
5555
{
56-
if (PHP_OS_FAMILY === 'Windows') {
57-
$this->markTestSkipped('Relative paths not supported on Windows');
58-
}
59-
6056
$this->http
6157
->get(uri([RelativeViewController::class, 'asFunction']))
6258
->assertOk()

0 commit comments

Comments
 (0)