Skip to content

Commit

Permalink
test: add FileLocatorCachedTest
Browse files Browse the repository at this point in the history
  • Loading branch information
kenjis committed Oct 8, 2023
1 parent 5802596 commit e5fb838
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 2 deletions.
55 changes: 55 additions & 0 deletions tests/system/Autoloader/FileLocatorCachedTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<?php

/**
* This file is part of CodeIgniter 4 framework.
*
* (c) CodeIgniter Foundation <admin@codeigniter.com>
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/

namespace CodeIgniter\Autoloader;

use CodeIgniter\Cache\FactoriesCache\FileVarExportHandler;
use Config\Autoload;
use Config\Modules;

/**
* @internal
*
* @group Others
*/
final class FileLocatorCachedTest extends FileLocatorTest
{
private FileVarExportHandler $handler;
protected FileLocator $locator;

protected function setUp(): void
{
parent::setUp();

$autoloader = new Autoloader();
$autoloader->initialize(new Autoload(), new Modules());
$autoloader->addNamespace([
'Unknown' => '/i/do/not/exist',
'Tests/Support' => TESTPATH . '_support/',
'App' => APPPATH,
'CodeIgniter' => [
TESTPATH,
SYSTEMPATH,
],
'Errors' => APPPATH . 'Views/errors',
'System' => SUPPORTPATH . 'Autoloader/system',
'CodeIgniter\\Devkit' => [
TESTPATH . '_support/',
],
'Acme\SampleProject' => TESTPATH . '_support',
'Acme\Sample' => TESTPATH . '_support/does/not/exists',
]);

$this->handler = new FileVarExportHandler();
$fileLocator = new FileLocator($autoloader);
$this->locator = new FileLocatorCached($fileLocator, $this->handler);
}
}
5 changes: 3 additions & 2 deletions tests/system/Autoloader/FileLocatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,11 @@
* @internal
*
* @group Others
* @no-final
*/
final class FileLocatorTest extends CIUnitTestCase
class FileLocatorTest extends CIUnitTestCase
{
private FileLocator $locator;
protected FileLocator $locator;

protected function setUp(): void
{
Expand Down

0 comments on commit e5fb838

Please sign in to comment.