@@ -500,6 +500,57 @@ public function testDistUrlIsUpdatedForPrePackagedTgzBinaryWhenBinaryIsNotFound(
500500 self ::assertSame ('zip ' , $ composerPackage ->getDistType ());
501501 }
502502
503+ public function testPrePackagedBinaryMethodIsIgnoredWhenConfigureOptionsArePassed (): void
504+ {
505+ $ composerPackage = new CompletePackage ('foo/bar ' , '1.2.3.0 ' , '1.2.3 ' );
506+ $ composerPackage ->setDistType ('zip ' );
507+ $ composerPackage ->setDistUrl ('https://example.com/git-archive-zip-url ' );
508+ $ composerPackage ->setPhpExt ([
509+ 'extension-name ' => 'foobar ' ,
510+ 'download-url-method ' => ['pre-packaged-binary ' ],
511+ ]);
512+
513+ $ installerEvent = new InstallerEvent (
514+ InstallerEvents::PRE_OPERATIONS_EXEC ,
515+ $ this ->composer ,
516+ $ this ->io ,
517+ false ,
518+ true ,
519+ new Transaction ([], [$ composerPackage ]),
520+ );
521+
522+ $ this ->container
523+ ->expects (self ::never ())
524+ ->method ('get ' );
525+
526+ $ listener = new OverrideDownloadUrlInstallListener (
527+ $ this ->composer ,
528+ $ this ->io ,
529+ $ this ->container ,
530+ new PieComposerRequest (
531+ $ this ->createMock (IOInterface::class),
532+ new TargetPlatform (
533+ OperatingSystem::NonWindows,
534+ OperatingSystemFamily::Linux,
535+ PhpBinaryPath::fromCurrentProcess (),
536+ Architecture::x86_64,
537+ ThreadSafetyMode::NonThreadSafe,
538+ 1 ,
539+ WindowsCompiler::VC15 ,
540+ null ,
541+ ),
542+ new RequestedPackageAndVersion ('foo/bar ' , '^1.1 ' ),
543+ PieOperation::Install,
544+ ['--with-foo ' ],
545+ false ,
546+ ),
547+ );
548+
549+ $ this ->expectException (CouldNotDetermineDownloadUrlMethod::class);
550+ $ this ->expectExceptionMessage ('Could not download foo/bar using pre-packaged-binary method: Cannot use pre-packaged-binary download method, as configure options were passed. ' );
551+ $ listener ($ installerEvent );
552+ }
553+
503554 public function testNoSelectedDownloadUrlMethodWillThrowException (): void
504555 {
505556 $ composerPackage = new CompletePackage ('foo/bar ' , '1.2.3.0 ' , '1.2.3 ' );
0 commit comments