diff --git a/src/Building/UnixBuild.php b/src/Building/UnixBuild.php index 6e7c994..77f680d 100644 --- a/src/Building/UnixBuild.php +++ b/src/Building/UnixBuild.php @@ -23,6 +23,7 @@ final class UnixBuild implements Build private const PHPIZE_TIMEOUT_SECS = 60; // 1 minute private const CONFIGURE_TIMEOUT_SECS = 120; // 2 minutes private const MAKE_TIMEOUT_SECS = null; // unlimited + private const EMPTY_STRING_SHA256 = 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855'; /** {@inheritDoc} */ public function __invoke( @@ -60,6 +61,7 @@ public function __invoke( $downloadedPackage, $output, $outputCallback, + $targetPlatform->dryRun, ); $output->writeln('phpize complete.'); @@ -69,17 +71,31 @@ public function __invoke( $configureOptions[] = '--with-php-config=' . $phpConfigPath; } - $this->configure($downloadedPackage, $configureOptions, $output, $outputCallback); + $this->configure( + $downloadedPackage, + $configureOptions, + $output, + $outputCallback, + $targetPlatform->dryRun, + ); $optionsOutput = count($configureOptions) ? ' with options: ' . implode(' ', $configureOptions) : '.'; $output->writeln('Configure complete' . $optionsOutput); - $this->make($targetPlatform, $downloadedPackage, $output, $outputCallback); + $this->make( + $targetPlatform, + $downloadedPackage, + $output, + $outputCallback, + $targetPlatform->dryRun, + ); $expectedSoFile = $downloadedPackage->extractedSourcePath . '/modules/' . $downloadedPackage->package->extensionName->name() . '.so'; - if (! file_exists($expectedSoFile)) { - throw ExtensionBinaryNotFound::fromExpectedBinary($expectedSoFile); + if (! $targetPlatform->dryRun) { + if (! file_exists($expectedSoFile)) { + throw ExtensionBinaryNotFound::fromExpectedBinary($expectedSoFile); + } } $output->writeln(sprintf( @@ -87,6 +103,10 @@ public function __invoke( $expectedSoFile, )); + if ($targetPlatform->dryRun) { + return new BinaryFile($expectedSoFile, self::EMPTY_STRING_SHA256); // sha256 of empty string + } + return BinaryFile::fromFileWithSha256Checksum($expectedSoFile); } @@ -96,6 +116,7 @@ private function phpize( DownloadedPackage $downloadedPackage, OutputInterface $output, callable|null $outputCallback, + bool $dryRun, ): void { $phpizeCommand = [$phpize->phpizeBinaryPath]; @@ -103,6 +124,10 @@ private function phpize( $output->writeln('Running phpize step using: ' . implode(' ', $phpizeCommand) . ''); } + if ($dryRun) { + return; + } + Process::run( $phpizeCommand, $downloadedPackage->extractedSourcePath, @@ -120,6 +145,7 @@ private function configure( array $configureOptions, OutputInterface $output, callable|null $outputCallback, + bool $dryRun, ): void { $configureCommand = ['./configure', ...$configureOptions]; @@ -127,6 +153,10 @@ private function configure( $output->writeln('Running configure step with: ' . implode(' ', $configureCommand) . ''); } + if ($dryRun) { + return; + } + Process::run( $configureCommand, $downloadedPackage->extractedSourcePath, @@ -141,6 +171,7 @@ private function make( DownloadedPackage $downloadedPackage, OutputInterface $output, callable|null $outputCallback, + bool $dryRun, ): void { $makeCommand = ['make']; @@ -154,6 +185,10 @@ private function make( $output->writeln('Running make step with: ' . implode(' ', $makeCommand) . ''); } + if ($dryRun) { + return; + } + Process::run( $makeCommand, $downloadedPackage->extractedSourcePath, diff --git a/src/Command/BuildCommand.php b/src/Command/BuildCommand.php index 46bd27e..d4e2827 100644 --- a/src/Command/BuildCommand.php +++ b/src/Command/BuildCommand.php @@ -37,6 +37,7 @@ public function configure(): void parent::configure(); CommandHelper::configureDownloadBuildInstallOptions($this); + CommandHelper::configureDryRunOption($this); } public function execute(InputInterface $input, OutputInterface $output): int diff --git a/src/Command/CommandHelper.php b/src/Command/CommandHelper.php index 68b55d2..6303d3d 100644 --- a/src/Command/CommandHelper.php +++ b/src/Command/CommandHelper.php @@ -38,6 +38,7 @@ final class CommandHelper private const OPTION_WITH_PHP_PATH = 'with-php-path'; private const OPTION_WITH_PHPIZE_PATH = 'with-phpize-path'; private const OPTION_MAKE_PARALLEL_JOBS = 'make-parallel-jobs'; + private const OPTION_DRY_RUN = 'dry-run'; /** @psalm-suppress UnusedConstructor */ private function __construct() @@ -89,6 +90,16 @@ public static function configureDownloadBuildInstallOptions(Command $command): v $command->ignoreValidationErrors(); } + public static function configureDryRunOption(Command $command): void + { + $command->addOption( + self::OPTION_DRY_RUN, + null, + InputOption::VALUE_NONE, + 'Do not actually build or install the extension, just show the steps that would be run.', + ); + } + public static function validateInput(InputInterface $input, Command $command): void { $input->bind($command->getDefinition()); @@ -138,7 +149,12 @@ public static function determineTargetPlatformFromInputs(InputInterface $input, } } - $targetPlatform = TargetPlatform::fromPhpBinaryPath($phpBinaryPath, $makeParallelJobs); + $dryRun = false; + if ($input->hasOption(self::OPTION_DRY_RUN)) { + $dryRun = (bool) $input->getOption(self::OPTION_DRY_RUN); + } + + $targetPlatform = TargetPlatform::fromPhpBinaryPath($phpBinaryPath, $makeParallelJobs, $dryRun); $output->writeln(sprintf('You are running PHP %s', PHP_VERSION)); $output->writeln(sprintf( diff --git a/src/Command/InstallCommand.php b/src/Command/InstallCommand.php index ca29316..c8fb771 100644 --- a/src/Command/InstallCommand.php +++ b/src/Command/InstallCommand.php @@ -38,6 +38,7 @@ public function configure(): void parent::configure(); CommandHelper::configureDownloadBuildInstallOptions($this); + CommandHelper::configureDryRunOption($this); } public function execute(InputInterface $input, OutputInterface $output): int diff --git a/src/Installing/UnixInstall.php b/src/Installing/UnixInstall.php index 6411e6b..6b47cb6 100644 --- a/src/Installing/UnixInstall.php +++ b/src/Installing/UnixInstall.php @@ -21,6 +21,7 @@ final class UnixInstall implements Install { private const MAKE_INSTALL_TIMEOUT_SECS = 60; // 1 minute + private const EMPTY_STRING_SHA256 = 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855'; public function __invoke(DownloadedPackage $downloadedPackage, TargetPlatform $targetPlatform, OutputInterface $output): BinaryFile { @@ -47,18 +48,20 @@ public function __invoke(DownloadedPackage $downloadedPackage, TargetPlatform $t array_unshift($makeInstallCommand, 'sudo'); } - $makeInstallOutput = Process::run( - $makeInstallCommand, - $downloadedPackage->extractedSourcePath, - self::MAKE_INSTALL_TIMEOUT_SECS, - ); + if (! $targetPlatform->dryRun) { + $makeInstallOutput = Process::run( + $makeInstallCommand, + $downloadedPackage->extractedSourcePath, + self::MAKE_INSTALL_TIMEOUT_SECS, + ); - if ($output->isVeryVerbose()) { - $output->writeln($makeInstallOutput); - } + if ($output->isVeryVerbose()) { + $output->writeln($makeInstallOutput); + } - if (! file_exists($expectedSharedObjectLocation)) { - throw new RuntimeException('Install failed, ' . $expectedSharedObjectLocation . ' was not installed.'); + if (! file_exists($expectedSharedObjectLocation)) { + throw new RuntimeException('Install failed, ' . $expectedSharedObjectLocation . ' was not installed.'); + } } $output->writeln('Install complete: ' . $expectedSharedObjectLocation); @@ -74,6 +77,10 @@ public function __invoke(DownloadedPackage $downloadedPackage, TargetPlatform $t $downloadedPackage->package->extensionName->name(), )); + if ($targetPlatform->dryRun) { + return new BinaryFile($expectedSharedObjectLocation, self::EMPTY_STRING_SHA256); + } + return BinaryFile::fromFileWithSha256Checksum($expectedSharedObjectLocation); } } diff --git a/src/Installing/WindowsInstall.php b/src/Installing/WindowsInstall.php index a9f6c3c..de3b267 100644 --- a/src/Installing/WindowsInstall.php +++ b/src/Installing/WindowsInstall.php @@ -31,6 +31,8 @@ /** @internal This is not public API for PIE, so should not be depended upon unless you accept the risk of BC breaks */ final class WindowsInstall implements Install { + private const EMPTY_STRING_SHA256 = 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855'; + public function __invoke(DownloadedPackage $downloadedPackage, TargetPlatform $targetPlatform, OutputInterface $output): BinaryFile { $extractedSourcePath = $downloadedPackage->extractedSourcePath; @@ -82,6 +84,10 @@ public function __invoke(DownloadedPackage $downloadedPackage, TargetPlatform $t $downloadedPackage->package->extensionName->name(), )); + if ($targetPlatform->dryRun) { + return new BinaryFile($destinationDllName, self::EMPTY_STRING_SHA256); + } + return BinaryFile::fromFileWithSha256Checksum($destinationDllName); } @@ -106,6 +112,10 @@ private function copyExtensionDll(TargetPlatform $targetPlatform, DownloadedPack $destinationDllName = $targetPlatform->phpBinaryPath->extensionPath() . DIRECTORY_SEPARATOR . 'php_' . $downloadedPackage->package->extensionName->name() . '.dll'; + if ($targetPlatform->dryRun) { + return $destinationDllName; + } + if (! copy($sourceDllName, $destinationDllName) || ! file_exists($destinationDllName) && ! is_file($destinationDllName)) { throw new RuntimeException('Failed to install DLL to ' . $destinationDllName); } @@ -133,6 +143,10 @@ private function copyExtensionPdb(TargetPlatform $targetPlatform, DownloadedPack $destinationPdbName = str_replace('.dll', '.pdb', $destinationDllName); assert($destinationPdbName !== ''); + if ($targetPlatform->dryRun) { + return $destinationPdbName; + } + if (! copy($sourcePdbName, $destinationPdbName) || ! file_exists($destinationPdbName) && ! is_file($destinationPdbName)) { throw new RuntimeException('Failed to install PDB to ' . $destinationPdbName); } @@ -156,6 +170,10 @@ private function copyDependencyDll(TargetPlatform $targetPlatform, SplFileInfo $ $destinationExtraDll = dirname($targetPlatform->phpBinaryPath->phpBinaryPath) . DIRECTORY_SEPARATOR . $file->getFilename(); + if ($targetPlatform->dryRun) { + return $destinationExtraDll; + } + if (! copy($file->getPathname(), $destinationExtraDll) || ! file_exists($destinationExtraDll) && ! is_file($destinationExtraDll)) { throw new RuntimeException('Failed to copy to ' . $destinationExtraDll); } @@ -177,6 +195,10 @@ private function copyExtraFile(TargetPlatform $targetPlatform, DownloadedPackage $destinationPath = dirname($destinationFullFilename); + if ($targetPlatform->dryRun) { + return $destinationFullFilename; + } + if (! file_exists($destinationPath)) { mkdir($destinationPath, 0777, true); } diff --git a/src/Platform/TargetPlatform.php b/src/Platform/TargetPlatform.php index 5da75bb..3724e06 100644 --- a/src/Platform/TargetPlatform.php +++ b/src/Platform/TargetPlatform.php @@ -28,6 +28,7 @@ public function __construct( public readonly ThreadSafetyMode $threadSafety, public readonly int $makeParallelJobs, public readonly WindowsCompiler|null $windowsCompiler, + public readonly bool $dryRun, ) { } @@ -36,7 +37,7 @@ public static function isRunningAsRoot(): bool return function_exists('posix_getuid') && posix_getuid() === 0; } - public static function fromPhpBinaryPath(PhpBinaryPath $phpBinaryPath, int|null $makeParallelJobs): self + public static function fromPhpBinaryPath(PhpBinaryPath $phpBinaryPath, int|null $makeParallelJobs, bool $dryRun): self { $os = $phpBinaryPath->operatingSystem(); @@ -119,6 +120,7 @@ public static function fromPhpBinaryPath(PhpBinaryPath $phpBinaryPath, int|null $threadSafety, $makeParallelJobs, $windowsCompiler, + $dryRun, ); } } diff --git a/test/integration/Building/UnixBuildTest.php b/test/integration/Building/UnixBuildTest.php index 41bffb7..ba7a757 100644 --- a/test/integration/Building/UnixBuildTest.php +++ b/test/integration/Building/UnixBuildTest.php @@ -55,7 +55,7 @@ public function testUnixBuildCanBuildExtension(): void $unixBuilder = new UnixBuild(); $builtBinary = $unixBuilder->__invoke( $downloadedPackage, - TargetPlatform::fromPhpBinaryPath(PhpBinaryPath::fromCurrentProcess(), null), + TargetPlatform::fromPhpBinaryPath(PhpBinaryPath::fromCurrentProcess(), null, false), ['--enable-pie_test_ext'], $output, null, @@ -111,7 +111,7 @@ public function testUnixBuildWillThrowExceptionWhenExpectedBinaryNameMismatches( try { $unixBuilder->__invoke( $downloadedPackage, - TargetPlatform::fromPhpBinaryPath(PhpBinaryPath::fromCurrentProcess(), null), + TargetPlatform::fromPhpBinaryPath(PhpBinaryPath::fromCurrentProcess(), null, false), ['--enable-pie_test_ext'], $output, null, @@ -149,7 +149,7 @@ public function testUnixBuildCanBuildExtensionWithBuildPath(): void $unixBuilder = new UnixBuild(); $builtBinary = $unixBuilder->__invoke( $downloadedPackage, - TargetPlatform::fromPhpBinaryPath(PhpBinaryPath::fromCurrentProcess(), null), + TargetPlatform::fromPhpBinaryPath(PhpBinaryPath::fromCurrentProcess(), null, false), ['--enable-pie_test_ext'], $output, null, @@ -206,7 +206,7 @@ public function testCleanupDoesNotCleanWhenConfigureIsMissing(): void $unixBuilder = new UnixBuild(); $unixBuilder->__invoke( $downloadedPackage, - TargetPlatform::fromPhpBinaryPath(PhpBinaryPath::fromCurrentProcess(), null), + TargetPlatform::fromPhpBinaryPath(PhpBinaryPath::fromCurrentProcess(), null, false), ['--enable-pie_test_ext'], $output, null, @@ -248,7 +248,7 @@ public function testVerboseOutputShowsCleanupMessages(): void $unixBuilder = new UnixBuild(); $unixBuilder->__invoke( $downloadedPackage, - TargetPlatform::fromPhpBinaryPath(PhpBinaryPath::fromCurrentProcess(), null), + TargetPlatform::fromPhpBinaryPath(PhpBinaryPath::fromCurrentProcess(), null, false), ['--enable-pie_test_ext'], $output, null, diff --git a/test/integration/DependencyResolver/ResolveDependencyWithComposerTest.php b/test/integration/DependencyResolver/ResolveDependencyWithComposerTest.php index c708dff..5f4c9ca 100644 --- a/test/integration/DependencyResolver/ResolveDependencyWithComposerTest.php +++ b/test/integration/DependencyResolver/ResolveDependencyWithComposerTest.php @@ -74,7 +74,7 @@ public function testDependenciesAreResolvedToExpectedVersions( $container = Container::factory(); $resolve = $container->get(DependencyResolver::class); - $targetPlatform = TargetPlatform::fromPhpBinaryPath(PhpBinaryPath::fromCurrentProcess(), null); + $targetPlatform = TargetPlatform::fromPhpBinaryPath(PhpBinaryPath::fromCurrentProcess(), null, false); $requestedPackageAndVersion = new RequestedPackageAndVersion( 'asgrim/example-pie-extension', $requestedVersion, diff --git a/test/integration/Downloading/GithubPackageReleaseAssetsTest.php b/test/integration/Downloading/GithubPackageReleaseAssetsTest.php index 4a1ca2f..eb68c97 100644 --- a/test/integration/Downloading/GithubPackageReleaseAssetsTest.php +++ b/test/integration/Downloading/GithubPackageReleaseAssetsTest.php @@ -39,6 +39,7 @@ public function testDeterminingReleaseAssetUrlForWindows(): void ThreadSafetyMode::ThreadSafe, 1, WindowsCompiler::VS16, + false, ); $package = new Package( diff --git a/test/integration/Installing/UnixInstallTest.php b/test/integration/Installing/UnixInstallTest.php index 5bf7bb9..8c4fa41 100644 --- a/test/integration/Installing/UnixInstallTest.php +++ b/test/integration/Installing/UnixInstallTest.php @@ -76,7 +76,7 @@ public function testUnixInstallCanInstallExtension(string $phpConfig): void } $output = new BufferedOutput(); - $targetPlatform = TargetPlatform::fromPhpBinaryPath(PhpBinaryPath::fromPhpConfigExecutable($phpConfig), null); + $targetPlatform = TargetPlatform::fromPhpBinaryPath(PhpBinaryPath::fromPhpConfigExecutable($phpConfig), null, false); $extensionPath = $targetPlatform->phpBinaryPath->extensionPath(); $downloadedPackage = DownloadedPackage::fromPackageAndExtractedPath( @@ -125,4 +125,54 @@ public function testUnixInstallCanInstallExtension(string $phpConfig): void (new Process(['make', 'clean'], $downloadedPackage->extractedSourcePath))->mustRun(); (new Process(['phpize', '--clean'], $downloadedPackage->extractedSourcePath))->mustRun(); } + + #[DataProvider('phpPathProvider')] + public function testUnixInstallCanInstallExtensionWithDryRun(string $phpConfig): void + { + assert($phpConfig !== ''); + if (Platform::isWindows()) { + self::markTestSkipped('Unix build test cannot be run on Windows'); + } + + $output = new BufferedOutput(); + $targetPlatform = TargetPlatform::fromPhpBinaryPath(PhpBinaryPath::fromPhpConfigExecutable($phpConfig), null, true); + $extensionPath = $targetPlatform->phpBinaryPath->extensionPath(); + + $downloadedPackage = DownloadedPackage::fromPackageAndExtractedPath( + new Package( + $this->createMock(CompletePackage::class), + ExtensionType::PhpModule, + ExtensionName::normaliseFromString('pie_test_ext'), + 'pie_test_ext', + '0.1.0', + null, + [ConfigureOption::fromComposerJsonDefinition(['name' => 'enable-pie_test_ext'])], + true, + true, + null, + ), + self::TEST_EXTENSION_PATH, + ); + + (new UnixBuild())->__invoke( + $downloadedPackage, + $targetPlatform, + ['--enable-pie_test_ext'], + $output, + null, + ); + + $installedSharedObject = (new UnixInstall())->__invoke( + $downloadedPackage, + $targetPlatform, + $output, + ); + $outputString = $output->fetch(); + + self::assertStringContainsString('Install complete: ' . $extensionPath . '/pie_test_ext.so', $outputString); + self::assertStringContainsString('You must now add "extension=pie_test_ext" to your php.ini', $outputString); + + self::assertSame($extensionPath . '/pie_test_ext.so', $installedSharedObject->filePath); + self::assertFileDoesNotExist($installedSharedObject->filePath); + } } diff --git a/test/integration/Installing/WindowsInstallTest.php b/test/integration/Installing/WindowsInstallTest.php index 0905fa9..f333e97 100644 --- a/test/integration/Installing/WindowsInstallTest.php +++ b/test/integration/Installing/WindowsInstallTest.php @@ -65,6 +65,7 @@ public function testWindowsInstallCanInstallExtension(): void ThreadSafetyMode::ThreadSafe, 1, WindowsCompiler::VS16, + false, ); $phpPath = dirname($targetPlatform->phpBinaryPath->phpBinaryPath); $extensionPath = $targetPlatform->phpBinaryPath->extensionPath(); @@ -99,6 +100,62 @@ public function testWindowsInstallCanInstallExtension(): void $this->delete($extrasDirectory); } + #[RequiresOperatingSystemFamily('Windows')] + public function testWindowsInstallCanInstallExtensionWithDryRun(): void + { + $downloadedPackage = DownloadedPackage::fromPackageAndExtractedPath( + new Package( + $this->createMock(CompletePackage::class), + ExtensionType::PhpModule, + ExtensionName::normaliseFromString('pie_test_ext'), + 'php/pie-test-ext', + '1.2.3', + null, + [], + true, + true, + null, + ), + self::TEST_EXTENSION_PATH, + ); + $output = new BufferedOutput(); + $targetPlatform = new TargetPlatform( + OperatingSystem::Windows, + PhpBinaryPath::fromCurrentProcess(), + Architecture::x86_64, + ThreadSafetyMode::ThreadSafe, + 1, + WindowsCompiler::VS16, + true, + ); + $phpPath = dirname($targetPlatform->phpBinaryPath->phpBinaryPath); + $extensionPath = $targetPlatform->phpBinaryPath->extensionPath(); + + $installer = new WindowsInstall(); + + $installedDll = $installer->__invoke($downloadedPackage, $targetPlatform, $output); + self::assertSame($extensionPath . '\php_pie_test_ext.dll', $installedDll->filePath); + + $outputString = $output->fetch(); + + self::assertStringContainsString('Copied DLL to: ' . $extensionPath . '\php_pie_test_ext.dll', $outputString); + self::assertStringContainsString('You must now add "extension=pie_test_ext" to your php.ini', $outputString); + + $extrasDirectory = $phpPath . DIRECTORY_SEPARATOR . 'extras' . DIRECTORY_SEPARATOR . 'pie_test_ext'; + + $expectedPdb = str_replace('.dll', '.pdb', $installedDll->filePath); + $expectedSupportingDll = $phpPath . DIRECTORY_SEPARATOR . 'supporting-library.dll'; + $expectedSupportingOtherFile = $extrasDirectory . DIRECTORY_SEPARATOR . 'README.md'; + $expectedSubdirectoryFile = $extrasDirectory . DIRECTORY_SEPARATOR . 'more' . DIRECTORY_SEPARATOR . 'more-information.txt'; + assert($expectedPdb !== ''); + + self::assertFileDoesNotExist($installedDll->filePath); + self::assertFileDoesNotExist($expectedPdb); + self::assertFileDoesNotExist($expectedSupportingDll); + self::assertFileDoesNotExist($expectedSupportingOtherFile); + self::assertFileDoesNotExist($expectedSubdirectoryFile); + } + /** * Recursively remove a file/path to clean up after testing * diff --git a/test/unit/ComposerIntegration/InstallAndBuildProcessTest.php b/test/unit/ComposerIntegration/InstallAndBuildProcessTest.php index c8ff3cc..a39265a 100644 --- a/test/unit/ComposerIntegration/InstallAndBuildProcessTest.php +++ b/test/unit/ComposerIntegration/InstallAndBuildProcessTest.php @@ -61,6 +61,7 @@ public function testDownloadWithoutBuildAndInstall(): void ThreadSafetyMode::NonThreadSafe, 1, null, + false, ), new RequestedPackageAndVersion('foo/bar', '^1.0'), PieOperation::Download, @@ -101,6 +102,7 @@ public function testDownloadAndBuildWithoutInstall(): void ThreadSafetyMode::NonThreadSafe, 1, null, + false, ), new RequestedPackageAndVersion('foo/bar', '^1.0'), PieOperation::Build, @@ -144,6 +146,7 @@ public function testDownloadBuildAndInstall(): void ThreadSafetyMode::NonThreadSafe, 1, null, + false, ), new RequestedPackageAndVersion('foo/bar', '^1.0'), PieOperation::Install, diff --git a/test/unit/ComposerIntegration/InstalledJsonMetadataTest.php b/test/unit/ComposerIntegration/InstalledJsonMetadataTest.php index 93a0672..4e920dc 100644 --- a/test/unit/ComposerIntegration/InstalledJsonMetadataTest.php +++ b/test/unit/ComposerIntegration/InstalledJsonMetadataTest.php @@ -57,6 +57,7 @@ public function testMetadataForDownloads(): void ThreadSafetyMode::NonThreadSafe, 1, null, + false, ), new RequestedPackageAndVersion('foo/bar', '^1.0'), PieOperation::Build, @@ -94,6 +95,7 @@ public function testMetadataForBuilds(): void ThreadSafetyMode::NonThreadSafe, 1, null, + false, ), new RequestedPackageAndVersion('foo/bar', '^1.0'), PieOperation::Build, diff --git a/test/unit/ComposerIntegration/OverrideWindowsUrlInstallListenerTest.php b/test/unit/ComposerIntegration/OverrideWindowsUrlInstallListenerTest.php index 233566c..fde999b 100644 --- a/test/unit/ComposerIntegration/OverrideWindowsUrlInstallListenerTest.php +++ b/test/unit/ComposerIntegration/OverrideWindowsUrlInstallListenerTest.php @@ -73,6 +73,7 @@ public function testEventListenerRegistration(): void ThreadSafetyMode::NonThreadSafe, 1, WindowsCompiler::VC15, + false, ), new RequestedPackageAndVersion('foo/bar', '^1.1'), PieOperation::Install, @@ -117,6 +118,7 @@ public function testWindowsUrlInstallerDoesNotRunOnNonWindows(): void ThreadSafetyMode::NonThreadSafe, 1, WindowsCompiler::VC15, + false, ), new RequestedPackageAndVersion('foo/bar', '^1.1'), PieOperation::Install, @@ -173,6 +175,7 @@ public function testDistUrlIsUpdatedForWindowsInstallers(): void ThreadSafetyMode::NonThreadSafe, 1, WindowsCompiler::VC15, + false, ), new RequestedPackageAndVersion('foo/bar', '^1.1'), PieOperation::Install, diff --git a/test/unit/ComposerIntegration/VersionSelectorFactoryTest.php b/test/unit/ComposerIntegration/VersionSelectorFactoryTest.php index c513dd0..4254b32 100644 --- a/test/unit/ComposerIntegration/VersionSelectorFactoryTest.php +++ b/test/unit/ComposerIntegration/VersionSelectorFactoryTest.php @@ -51,6 +51,7 @@ public function testVersionSelectorFactory(): void ThreadSafetyMode::NonThreadSafe, 1, null, + false, ), ); diff --git a/test/unit/DependencyResolver/ResolveDependencyWithComposerTest.php b/test/unit/DependencyResolver/ResolveDependencyWithComposerTest.php index b0fe20a..4e4237d 100644 --- a/test/unit/DependencyResolver/ResolveDependencyWithComposerTest.php +++ b/test/unit/DependencyResolver/ResolveDependencyWithComposerTest.php @@ -57,6 +57,7 @@ public function testPackageThatCanBeResolved(): void ThreadSafetyMode::ThreadSafe, 1, null, + false, ); $package = (new ResolveDependencyWithComposer( @@ -101,6 +102,7 @@ public function testPackageThatCannotBeResolvedThrowsException(array $platformOv ThreadSafetyMode::ThreadSafe, 1, null, + false, ); $this->expectException(UnableToResolveRequirement::class); @@ -146,6 +148,7 @@ public function testZtsOnlyPackageCannotBeInstalledOnNtsSystem(): void ThreadSafetyMode::NonThreadSafe, 1, null, + false, ); $this->expectException(IncompatibleThreadSafetyMode::class); @@ -191,6 +194,7 @@ public function testNtsOnlyPackageCannotBeInstalledOnZtsSystem(): void ThreadSafetyMode::ThreadSafe, 1, null, + false, ); $this->expectException(IncompatibleThreadSafetyMode::class); diff --git a/test/unit/Downloading/Exception/CouldNotFindReleaseAssetTest.php b/test/unit/Downloading/Exception/CouldNotFindReleaseAssetTest.php index 64ba9d0..00fd60e 100644 --- a/test/unit/Downloading/Exception/CouldNotFindReleaseAssetTest.php +++ b/test/unit/Downloading/Exception/CouldNotFindReleaseAssetTest.php @@ -70,6 +70,7 @@ public function testForMissingWindowsCompiler(): void ThreadSafetyMode::NonThreadSafe, 1, null, + false, )); self::assertSame('Could not determine Windows Compiler for PHP ' . $phpBinary->version() . ' on NonWindows', $exception->getMessage()); diff --git a/test/unit/Downloading/GithubPackageReleaseAssetsTest.php b/test/unit/Downloading/GithubPackageReleaseAssetsTest.php index 846b507..db0e052 100644 --- a/test/unit/Downloading/GithubPackageReleaseAssetsTest.php +++ b/test/unit/Downloading/GithubPackageReleaseAssetsTest.php @@ -42,6 +42,7 @@ public function testUrlIsReturnedWhenFindingWindowsDownloadUrl(): void ThreadSafetyMode::ThreadSafe, 1, WindowsCompiler::VC14, + false, ); $authHelper = $this->createMock(AuthHelper::class); @@ -101,6 +102,7 @@ public function testUrlIsReturnedWhenFindingWindowsDownloadUrlWithCompilerAndThr ThreadSafetyMode::ThreadSafe, 1, WindowsCompiler::VC14, + false, ); $authHelper = $this->createMock(AuthHelper::class); @@ -155,6 +157,7 @@ public function testFindWindowsDownloadUrlForPackageThrowsExceptionWhenAssetNotF ThreadSafetyMode::ThreadSafe, 1, WindowsCompiler::VC14, + false, ); $authHelper = $this->createMock(AuthHelper::class); diff --git a/test/unit/Platform/TargetPlatformTest.php b/test/unit/Platform/TargetPlatformTest.php index fe588c2..3db777c 100644 --- a/test/unit/Platform/TargetPlatformTest.php +++ b/test/unit/Platform/TargetPlatformTest.php @@ -50,7 +50,7 @@ public function testWindowsPlatformFromPhpInfo(): void PHP Extension Build => API20230831,TS,VS16 TEXT); - $platform = TargetPlatform::fromPhpBinaryPath($phpBinaryPath, null); + $platform = TargetPlatform::fromPhpBinaryPath($phpBinaryPath, null, false); self::assertSame(OperatingSystem::Windows, $platform->operatingSystem); self::assertSame(WindowsCompiler::VS16, $platform->windowsCompiler); @@ -91,7 +91,7 @@ public function testLinuxPlatform(): void Thread Safety => disabled TEXT); - $platform = TargetPlatform::fromPhpBinaryPath($phpBinaryPath, null); + $platform = TargetPlatform::fromPhpBinaryPath($phpBinaryPath, null, false); self::assertSame(OperatingSystem::NonWindows, $platform->operatingSystem); self::assertNull($platform->windowsCompiler); diff --git a/test/unit/Platform/WindowsExtensionAssetNameTest.php b/test/unit/Platform/WindowsExtensionAssetNameTest.php index 8f10040..44e587b 100644 --- a/test/unit/Platform/WindowsExtensionAssetNameTest.php +++ b/test/unit/Platform/WindowsExtensionAssetNameTest.php @@ -36,6 +36,7 @@ public function setUp(): void ThreadSafetyMode::ThreadSafe, 1, WindowsCompiler::VC14, + false, ); $this->phpVersion = $this->platform->phpBinaryPath->majorMinorVersion();