Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Platform/TargetPhp/PhpBinaryPath.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ public function extensionPath(): string

public function assertExtensionIsLoadedInRuntime(ExtensionName $extension, OutputInterface|null $output = null): void
{
if (! in_array($extension->name(), array_keys($this->extensions()))) {
if (! in_array(strtolower($extension->name()), array_map('strtolower', array_keys($this->extensions())))) {
throw Exception\ExtensionIsNotLoaded::fromExpectedExtension(
$this,
$extension,
Expand Down
18 changes: 18 additions & 0 deletions test/unit/Platform/TargetPhp/PhpBinaryPathTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,24 @@ public function testAssertExtensionIsLoaded(): void
);
}

public function testAssertDifferentCasedExtensionIsLoaded(): void
{
$php = PhpBinaryPath::fromCurrentProcess();
$loadedExtensions = $php->extensions();

if (! count($loadedExtensions) || ! array_key_exists('Core', $loadedExtensions)) {
self::fail('Core extension is not loaded, this is quite unexpected...');
}

$output = new BufferedOutput(BufferedOutput::VERBOSITY_VERBOSE);
$php->assertExtensionIsLoadedInRuntime(ExtensionName::normaliseFromString('CORE'), $output);

self::assertStringContainsString(
'Successfully asserted that extension CORE is loaded in runtime.',
$output->fetch(),
);
}

public function testAssertExtensionFailsWhenNotLoaded(): void
{
$php = PhpBinaryPath::fromCurrentProcess();
Expand Down