Skip to content

Commit 0cc1b2a

Browse files
committed
fix: Paths for tests
1 parent 014a204 commit 0cc1b2a

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

src/Config/Services.php

+6-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,12 @@ public static function renderer(?string $viewPath = null, ?ViewConfig $config =
3232
return static::getSharedInstance('renderer', $viewPath, $config);
3333
}
3434

35-
$viewPath = $viewPath ?: (new Paths())->viewDirectory;
35+
if ($viewPath === null && ENVIRONMENT === 'testing') {
36+
$viewPath = SUPPORTPATH . 'Views';
37+
} else {
38+
$viewPath = $viewPath ?: (new Paths())->viewDirectory;
39+
}
40+
3641
$config ??= config('View');
3742

3843
return new View($config, $viewPath, AppServices::locator(), CI_DEBUG, AppServices::logger());

tests/CommonTest.php

-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
namespace Tests;
44

55
use CodeIgniter\Test\CIUnitTestCase;
6-
use Config\Paths;
76

87
/**
98
* @internal
@@ -13,8 +12,6 @@ final class CommonTest extends CIUnitTestCase
1312
protected function setUp(): void
1413
{
1514
parent::setUp();
16-
17-
(new Paths())->viewDirectory = SUPPORTPATH . 'Views';
1815
}
1916

2017
public function testViewFragmentNone(): void

0 commit comments

Comments
 (0)