mirror of
https://git.friendi.ca/friendica/friendica.git
synced 2025-06-08 03:34:27 +02:00
Make InstanceManager strategy naming convention case insensitive.
This commit is contained in:
parent
06df62a2b5
commit
6bcf5cb823
2 changed files with 23 additions and 4 deletions
|
@ -235,4 +235,23 @@ class InstanceManagerTest extends MockedTest
|
|||
self::assertEquals($cBool, $getInstanceA->getCBool());
|
||||
self::assertEquals($cBool, $getInstanceB->getCBool());
|
||||
}
|
||||
|
||||
/**
|
||||
* @see https://github.com/friendica/friendica/issues/13318
|
||||
*/
|
||||
public function testCaseInsensitiveNames()
|
||||
{
|
||||
$instance = new DiceInstanceManager(new Dice(), $this->hookFileManager);
|
||||
|
||||
$instance->registerStrategy(IAmADecoratedInterface::class, FakeInstance::class, 'fake');
|
||||
|
||||
// CamelCase
|
||||
self::assertInstanceOf(FakeInstance::class, $instance->create(IAmADecoratedInterface::class, 'Fake'));
|
||||
// UPPER CASE
|
||||
self::assertInstanceOf(FakeInstance::class, $instance->create(IAmADecoratedInterface::class, 'FAKE'));
|
||||
// lower case
|
||||
self::assertInstanceOf(FakeInstance::class, $instance->create(IAmADecoratedInterface::class, 'fake'));
|
||||
// UnKnOwN
|
||||
self::assertInstanceOf(FakeInstance::class, $instance->create(IAmADecoratedInterface::class, 'fAkE'));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue