Skip to content

Commit 936d298

Browse files
committed
test: add test for get same config with different alias
If the request class is the same, it is better to return the shared instance.
1 parent 98239ad commit 936d298

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

tests/system/Config/FactoriesTest.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
namespace CodeIgniter\Config;
1313

1414
use CodeIgniter\Test\CIUnitTestCase;
15+
use Config\App;
1516
use Config\Database;
1617
use InvalidArgumentException;
1718
use ReflectionClass;
@@ -322,6 +323,14 @@ public function testCanLoadTwoCellsWithSameShortName()
322323
$this->assertNotSame($cell1, $cell2);
323324
}
324325

326+
public function testCanLoadSharedConfigWithDifferentAlias()
327+
{
328+
$config1 = Factories::config(App::class);
329+
$config2 = Factories::config('App');
330+
331+
$this->assertSame($config1, $config2);
332+
}
333+
325334
public function testDefineSameAliasTwiceWithDifferentClasses()
326335
{
327336
$this->expectException(InvalidArgumentException::class);

0 commit comments

Comments
 (0)