Skip to content

Commit f08cf98

Browse files
committed
fix: Replace view path definition
1 parent 0cc1b2a commit f08cf98

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

src/Config/Services.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use CodeIgniter\HTTP\ResponseInterface;
88
use CodeIgniter\HTTP\UserAgent;
99
use Config\App;
10+
use Config\Optimize;
1011
use Config\Paths;
1112
use Config\Services as AppServices;
1213
use Config\Toolbar as ToolbarConfig;
@@ -32,11 +33,9 @@ public static function renderer(?string $viewPath = null, ?ViewConfig $config =
3233
return static::getSharedInstance('renderer', $viewPath, $config);
3334
}
3435

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

4140
$config ??= config('View');
4241

tests/CommonTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ final class CommonTest extends CIUnitTestCase
1212
protected function setUp(): void
1313
{
1414
parent::setUp();
15+
16+
config('Paths')->viewDirectory = SUPPORTPATH . 'Views';
1517
}
1618

1719
public function testViewFragmentNone(): void

0 commit comments

Comments
 (0)