Skip to content

Commit 40ea549

Browse files
committed
test: add FileLocatorCachedTest
1 parent 5802596 commit 40ea549

File tree

2 files changed

+56
-1
lines changed

2 files changed

+56
-1
lines changed
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
<?php
2+
3+
/**
4+
* This file is part of CodeIgniter 4 framework.
5+
*
6+
* (c) CodeIgniter Foundation <[email protected]>
7+
*
8+
* For the full copyright and license information, please view
9+
* the LICENSE file that was distributed with this source code.
10+
*/
11+
12+
namespace CodeIgniter\Autoloader;
13+
14+
use CodeIgniter\Cache\FactoriesCache\FileVarExportHandler;
15+
use Config\Autoload;
16+
use Config\Modules;
17+
18+
/**
19+
* @internal
20+
*
21+
* @group Others
22+
*/
23+
final class FileLocatorCachedTest extends FileLocatorTest
24+
{
25+
private FileLocator $locator;
26+
27+
protected function setUp(): void
28+
{
29+
parent::setUp();
30+
31+
$autoloader = new Autoloader();
32+
$autoloader->initialize(new Autoload(), new Modules());
33+
$autoloader->addNamespace([
34+
'Unknown' => '/i/do/not/exist',
35+
'Tests/Support' => TESTPATH . '_support/',
36+
'App' => APPPATH,
37+
'CodeIgniter' => [
38+
TESTPATH,
39+
SYSTEMPATH,
40+
],
41+
'Errors' => APPPATH . 'Views/errors',
42+
'System' => SUPPORTPATH . 'Autoloader/system',
43+
'CodeIgniter\\Devkit' => [
44+
TESTPATH . '_support/',
45+
],
46+
'Acme\SampleProject' => TESTPATH . '_support',
47+
'Acme\Sample' => TESTPATH . '_support/does/not/exists',
48+
]);
49+
50+
$this->handler = new FileVarExportHandler();
51+
$fileLocator = new FileLocator($autoloader);
52+
$this->locator = new FileLocatorCached($fileLocator, $this->handler);
53+
}
54+
}

tests/system/Autoloader/FileLocatorTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,9 @@
2020
* @internal
2121
*
2222
* @group Others
23+
* @no-final
2324
*/
24-
final class FileLocatorTest extends CIUnitTestCase
25+
class FileLocatorTest extends CIUnitTestCase
2526
{
2627
private FileLocator $locator;
2728

0 commit comments

Comments
 (0)