Skip to content

Commit 0cde917

Browse files
committed
test: add FileLocatorCachedTest
1 parent 4e17d84 commit 0cde917

File tree

2 files changed

+58
-2
lines changed

2 files changed

+58
-2
lines changed
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
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 FileVarExportHandler $handler;
26+
protected FileLocator $locator;
27+
28+
protected function setUp(): void
29+
{
30+
parent::setUp();
31+
32+
$autoloader = new Autoloader();
33+
$autoloader->initialize(new Autoload(), new Modules());
34+
$autoloader->addNamespace([
35+
'Unknown' => '/i/do/not/exist',
36+
'Tests/Support' => TESTPATH . '_support/',
37+
'App' => APPPATH,
38+
'CodeIgniter' => [
39+
TESTPATH,
40+
SYSTEMPATH,
41+
],
42+
'Errors' => APPPATH . 'Views/errors',
43+
'System' => SUPPORTPATH . 'Autoloader/system',
44+
'CodeIgniter\\Devkit' => [
45+
TESTPATH . '_support/',
46+
],
47+
'Acme\SampleProject' => TESTPATH . '_support',
48+
'Acme\Sample' => TESTPATH . '_support/does/not/exists',
49+
]);
50+
51+
$this->handler = new FileVarExportHandler();
52+
$fileLocator = new FileLocator($autoloader);
53+
$this->locator = new FileLocatorCached($fileLocator, $this->handler);
54+
}
55+
}

tests/system/Autoloader/FileLocatorTest.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,11 @@
2020
* @internal
2121
*
2222
* @group Others
23+
* @no-final
2324
*/
24-
final class FileLocatorTest extends CIUnitTestCase
25+
class FileLocatorTest extends CIUnitTestCase
2526
{
26-
private FileLocator $locator;
27+
protected FileLocator $locator;
2728

2829
protected function setUp(): void
2930
{

0 commit comments

Comments
 (0)