Skip to content

Commit 4b0d908

Browse files
committed
587: Windows use .dll
1 parent 45177b8 commit 4b0d908

2 files changed

Lines changed: 8 additions & 3 deletions

File tree

src/DependencyResolver/Package.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -279,10 +279,10 @@ public function installedJsonMetadata(): InstalledJsonMetadata
279279
public function verifyPackageStatus(TargetPlatform $targetPlatform): PackageVerificationStatus
280280
{
281281
$extensionPath = $targetPlatform->phpBinaryPath->extensionPath();
282-
$extensionEnding = $targetPlatform->operatingSystem === OperatingSystem::Windows ? '.dll' : '.so';
282+
$isWindows = $targetPlatform->operatingSystem === OperatingSystem::Windows;
283283
$phpExtensionName = $this->extensionName->name();
284284

285-
$actualBinaryPathByConvention = $extensionPath . DIRECTORY_SEPARATOR . $phpExtensionName . $extensionEnding;
285+
$actualBinaryPathByConvention = $extensionPath . DIRECTORY_SEPARATOR . ($isWindows ? 'php_' : '') . $phpExtensionName . ($isWindows ? '.dll' : '.so');
286286

287287
// The extension may not be in the usual path (since you can specify a full path to an extension in the INI file)
288288
if (! file_exists($actualBinaryPathByConvention)) {

test/integration/ComposerIntegration/ComposerIntegrationHandlerTest.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,12 @@
2020
use Php\Pie\DependencyResolver\RequestedPackageAndVersion;
2121
use Php\Pie\DependencyResolver\ResolvedPackageRequest;
2222
use Php\Pie\Platform;
23+
use Php\Pie\Platform\OperatingSystem;
2324
use Php\Pie\Platform\TargetPhp\PhpBinaryPath;
2425
use Php\Pie\Platform\TargetPlatform;
2526
use Php\PieIntegrationTest\Command\IsolatedWorkingDirectoryTestCase;
2627
use PHPUnit\Framework\Attributes\CoversClass;
28+
use PHPUnit\Framework\Attributes\RequiresOperatingSystemFamily;
2729
use Symfony\Component\Console\Output\BufferedOutput;
2830

2931
use function file_exists;
@@ -117,6 +119,7 @@ public function testRunInstallSkipsAlreadyVerifiedPackageAtSameVersion(): void
117119
self::assertStringContainsString('Nothing to install, update or remove', $output);
118120
}
119121

122+
#[RequiresOperatingSystemFamily('Linux')]
120123
public function testRunInstallReinstallsVerifiedPackageWhenVersionDiffers(): void
121124
{
122125
PieJsonEditor::fromTargetPlatform($this->targetPlatform)
@@ -169,7 +172,9 @@ public function testRunUninstallRemovesPackageFromPieJson(): void
169172

170173
private function extensionBinaryPath(): string
171174
{
172-
return $this->targetPlatform->phpBinaryPath->extensionPath() . DIRECTORY_SEPARATOR . self::EXTENSION_NAME . '.so';
175+
$isWindows = $this->targetPlatform->operatingSystem === OperatingSystem::Windows;
176+
177+
return $this->targetPlatform->phpBinaryPath->extensionPath() . DIRECTORY_SEPARATOR . ($isWindows ? 'php_' : '') . self::EXTENSION_NAME . ($isWindows ? '.dll' : '.so');
173178
}
174179

175180
/** @param non-empty-string $version */

0 commit comments

Comments
 (0)