From cb363b0e84459b8d280d0ff6b5a7d4ccde93420d Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Fri, 6 Oct 2023 09:34:10 +0200 Subject: [PATCH] Fix autoload generator dump() non-BC signature change in 2.6.4 --- src/Composer/Autoload/AutoloadGenerator.php | 4 +- src/Composer/Command/DumpAutoloadCommand.php | 5 +- src/Composer/Command/ReinstallCommand.php | 5 +- src/Composer/Installer.php | 5 +- .../Test/Autoload/AutoloadGeneratorTest.php | 96 +++++++++---------- 5 files changed, 54 insertions(+), 61 deletions(-) diff --git a/src/Composer/Autoload/AutoloadGenerator.php b/src/Composer/Autoload/AutoloadGenerator.php index 8ba82090b..1fd22ddf5 100644 --- a/src/Composer/Autoload/AutoloadGenerator.php +++ b/src/Composer/Autoload/AutoloadGenerator.php @@ -173,7 +173,7 @@ class AutoloadGenerator * @throws \Seld\JsonLint\ParsingException * @throws \RuntimeException */ - public function dump(Config $config, InstalledRepositoryInterface $localRepo, RootPackageInterface $rootPackage, InstallationManager $installationManager, Locker $locker, string $targetDir, bool $scanPsrPackages = false, ?string $suffix = null) + public function dump(Config $config, InstalledRepositoryInterface $localRepo, RootPackageInterface $rootPackage, InstallationManager $installationManager, string $targetDir, bool $scanPsrPackages = false, ?string $suffix = null, ?Locker $locker = null) { if ($this->classMapAuthoritative) { // Force scanPsrPackages when classmap is authoritative @@ -407,7 +407,7 @@ EOF; } if (null === $suffix) { - $suffix = $locker->isLocked() ? $locker->getLockData()['content-hash'] : md5(uniqid('', true)); + $suffix = $locker !== null && $locker->isLocked() ? $locker->getLockData()['content-hash'] : md5(uniqid('', true)); } } diff --git a/src/Composer/Command/DumpAutoloadCommand.php b/src/Composer/Command/DumpAutoloadCommand.php index fcd10f2b2..9336ab3b2 100644 --- a/src/Composer/Command/DumpAutoloadCommand.php +++ b/src/Composer/Command/DumpAutoloadCommand.php @@ -105,9 +105,10 @@ EOT $localRepo, $package, $installationManager, - $composer->getLocker(), 'composer', - $optimize + $optimize, + null, + $composer->getLocker() ); $numberOfClasses = count($classMap); diff --git a/src/Composer/Command/ReinstallCommand.php b/src/Composer/Command/ReinstallCommand.php index d94ffeb53..446d9eec1 100644 --- a/src/Composer/Command/ReinstallCommand.php +++ b/src/Composer/Command/ReinstallCommand.php @@ -168,9 +168,10 @@ EOT $localRepo, $package, $installationManager, - $composer->getLocker(), 'composer', - $optimize + $optimize, + null, + $composer->getLocker() ); } diff --git a/src/Composer/Installer.php b/src/Composer/Installer.php index 7fc4382d1..9c0054778 100644 --- a/src/Composer/Installer.php +++ b/src/Composer/Installer.php @@ -356,9 +356,10 @@ class Installer $localRepo, $this->package, $this->installationManager, - $this->locker, 'composer', - $this->optimizeAutoloader + $this->optimizeAutoloader, + null, + $this->locker ); } diff --git a/tests/Composer/Test/Autoload/AutoloadGeneratorTest.php b/tests/Composer/Test/Autoload/AutoloadGeneratorTest.php index 3a9544bb5..08d51ac74 100644 --- a/tests/Composer/Test/Autoload/AutoloadGeneratorTest.php +++ b/tests/Composer/Test/Autoload/AutoloadGeneratorTest.php @@ -30,7 +30,6 @@ use Composer\Repository\InstalledRepositoryInterface; use Composer\Installer\InstallationManager; use Composer\Config; use Composer\EventDispatcher\EventDispatcher; -use Composer\Package\Locker; use Composer\Util\Platform; use PHPUnit\Framework\MockObject\MockObject; @@ -81,11 +80,6 @@ class AutoloadGeneratorTest extends TestCase */ private $io; - /** - * @var Locker - */ - private $locker; - /** * @var EventDispatcher&MockObject */ @@ -164,10 +158,6 @@ class AutoloadGeneratorTest extends TestCase ->getMock(); $this->generator = new AutoloadGenerator($this->eventDispatcher, $this->io); - - $this->locker = $this->getMockBuilder('Composer\Package\Locker') - ->disableOriginalConstructor() - ->getMock(); } protected function tearDown(): void @@ -217,7 +207,7 @@ class AutoloadGeneratorTest extends TestCase $this->fs->ensureDirectoryExists($this->workingDir.'/composersrc'); file_put_contents($this->workingDir.'/composersrc/foo.php', 'generator->dump($this->config, $this->repository, $package, $this->im, $this->locker, 'composer', true, '_1'); + $this->generator->dump($this->config, $this->repository, $package, $this->im, 'composer', true, '_1'); // Assert that autoload_namespaces.php was correctly generated. $this->assertAutoloadFiles('main', $this->vendorDir.'/composer'); @@ -257,7 +247,7 @@ class AutoloadGeneratorTest extends TestCase // generate autoload files with the dev mode set to true $this->generator->setDevMode(true); - $this->generator->dump($this->config, $this->repository, $package, $this->im, $this->locker, 'composer', true, '_1'); + $this->generator->dump($this->config, $this->repository, $package, $this->im, 'composer', true, '_1'); // check standard autoload $this->assertAutoloadFiles('main5', $this->vendorDir.'/composer'); @@ -290,7 +280,7 @@ class AutoloadGeneratorTest extends TestCase $this->fs->ensureDirectoryExists($this->workingDir.'/devfiles'); file_put_contents($this->workingDir.'/devfiles/foo.php', 'generator->dump($this->config, $this->repository, $package, $this->im, $this->locker, 'composer', true, '_1'); + $this->generator->dump($this->config, $this->repository, $package, $this->im, 'composer', true, '_1'); // check standard autoload $this->assertAutoloadFiles('main4', $this->vendorDir.'/composer'); @@ -325,7 +315,7 @@ class AutoloadGeneratorTest extends TestCase $this->fs->ensureDirectoryExists($this->vendorDir.'/composersrc'); file_put_contents($this->vendorDir.'/composersrc/foo.php', 'generator->dump($this->config, $this->repository, $package, $this->im, $this->locker, 'composer', true, '_2'); + $this->generator->dump($this->config, $this->repository, $package, $this->im, 'composer', true, '_2'); $this->assertAutoloadFiles('main3', $this->vendorDir.'/composer'); $this->assertAutoloadFiles('psr4_3', $this->vendorDir.'/composer', 'psr4'); $this->assertAutoloadFiles('classmap3', $this->vendorDir.'/composer', 'classmap'); @@ -354,7 +344,7 @@ class AutoloadGeneratorTest extends TestCase $this->fs->ensureDirectoryExists($this->workingDir.'/composersrc'); file_put_contents($this->workingDir.'/composersrc/foo.php', 'generator->dump($this->config, $this->repository, $package, $this->im, $this->locker, 'composer', false, '_3'); + $this->generator->dump($this->config, $this->repository, $package, $this->im, 'composer', false, '_3'); $this->assertAutoloadFiles('main2', $this->vendorDir.'/composer'); $this->assertAutoloadFiles('psr4_2', $this->vendorDir.'/composer', 'psr4'); $this->assertAutoloadFiles('classmap2', $this->vendorDir.'/composer', 'classmap'); @@ -383,7 +373,7 @@ class AutoloadGeneratorTest extends TestCase file_put_contents($this->workingDir.'/foo.php', 'workingDir.'/bar.php', 'generator->dump($this->config, $this->repository, $package, $this->im, $this->locker, 'composer', false, 'TargetDir'); + $this->generator->dump($this->config, $this->repository, $package, $this->im, 'composer', false, 'TargetDir'); $this->assertFileContentEquals(__DIR__.'/Fixtures/autoload_target_dir.php', $this->vendorDir.'/autoload.php'); $this->assertFileContentEquals(__DIR__.'/Fixtures/autoload_real_target_dir.php', $this->vendorDir.'/composer/autoload_real.php'); $this->assertFileContentEquals(__DIR__.'/Fixtures/autoload_static_target_dir.php', $this->vendorDir.'/composer/autoload_static.php'); @@ -409,7 +399,7 @@ class AutoloadGeneratorTest extends TestCase file_put_contents($this->workingDir.'/foo.php', 'workingDir.'/bar.php', 'generator->dump($this->config, $this->repository, $package, $this->im, $this->locker, 'composer', false, 'FilesWarning'); + $this->generator->dump($this->config, $this->repository, $package, $this->im, 'composer', false, 'FilesWarning'); self::assertFileContentEquals(__DIR__.'/Fixtures/autoload_files_duplicates.php', $this->vendorDir.'/composer/autoload_files.php'); $expected = 'The following "files" autoload rules are included multiple times, this may cause issues and should be resolved:'.PHP_EOL. ' - $baseDir . \'/foo.php\''.PHP_EOL; @@ -440,7 +430,7 @@ class AutoloadGeneratorTest extends TestCase $this->fs->ensureDirectoryExists($this->vendorDir.'/a/a/lib'); $this->fs->ensureDirectoryExists($this->vendorDir.'/b/b/src'); - $this->generator->dump($this->config, $this->repository, $package, $this->im, $this->locker, 'composer', false, '_5'); + $this->generator->dump($this->config, $this->repository, $package, $this->im, 'composer', false, '_5'); $this->assertAutoloadFiles('vendors', $this->vendorDir.'/composer'); $this->assertFileExists($this->vendorDir.'/composer/autoload_classmap.php', "ClassMap file needs to be generated, even if empty."); } @@ -474,7 +464,7 @@ class AutoloadGeneratorTest extends TestCase $this->fs->ensureDirectoryExists($this->vendorDir.'/a/a/src'); $this->fs->ensureDirectoryExists($this->vendorDir.'/a/a/lib'); - $this->generator->dump($this->config, $this->repository, $package, $this->im, $this->locker, 'composer', false, '_5'); + $this->generator->dump($this->config, $this->repository, $package, $this->im, 'composer', false, '_5'); $this->assertAutoloadFiles('vendors_meta', $this->vendorDir.'/composer'); $this->assertFileExists($this->vendorDir.'/composer/autoload_classmap.php', "ClassMap file needs to be generated, even if empty."); } @@ -507,7 +497,7 @@ class AutoloadGeneratorTest extends TestCase $this->fs->ensureDirectoryExists($this->vendorDir.'/a/a/lib'); $this->fs->ensureDirectoryExists($this->vendorDir.'/b/b/src'); - $this->generator->dump($this->config, $this->repository, $package, $this->im, $this->locker, 'composer', false, '_5'); + $this->generator->dump($this->config, $this->repository, $package, $this->im, 'composer', false, '_5'); $this->assertAutoloadFiles('vendors', $this->vendorDir.'/composer'); $this->assertFileExists($this->vendorDir.'/composer/autoload_classmap.php', "ClassMap file needs to be generated, even if empty."); } @@ -535,7 +525,7 @@ class AutoloadGeneratorTest extends TestCase $this->fs->ensureDirectoryExists($this->vendorDir.'/b/b/src/C'); file_put_contents($this->vendorDir.'/b/b/src/C/C.php', 'generator->dump($this->config, $this->repository, $package, $this->im, $this->locker, 'composer', true, '_5'); + $this->generator->dump($this->config, $this->repository, $package, $this->im, 'composer', true, '_5'); $this->assertEquals( [ @@ -574,7 +564,7 @@ class AutoloadGeneratorTest extends TestCase $this->fs->ensureDirectoryExists($this->vendorDir.'/a/a/lib'); $this->fs->ensureDirectoryExists($this->vendorDir.'/b/b/src'); - $this->generator->dump($this->config, $this->repository, $package, $this->im, $this->locker, 'composer', false, '_5'); + $this->generator->dump($this->config, $this->repository, $package, $this->im, 'composer', false, '_5'); $this->assertAutoloadFiles('vendors', $this->vendorDir.'/composer'); $this->assertFileExists($this->vendorDir.'/composer/autoload_classmap.php', "ClassMap file needs to be generated, even if empty."); } @@ -626,7 +616,7 @@ class AutoloadGeneratorTest extends TestCase file_put_contents($this->vendorDir.'/d/d/src/D.php', 'vendorDir.'/e/e/src/E.php', 'generator->dump($this->config, $this->repository, $package, $this->im, $this->locker, 'composer', false, '_5'); + $this->generator->dump($this->config, $this->repository, $package, $this->im, 'composer', false, '_5'); $this->assertAutoloadFiles('classmap9', $this->vendorDir.'/composer', 'classmap'); } @@ -665,7 +655,7 @@ class AutoloadGeneratorTest extends TestCase ->method('getCanonicalPackages') ->will($this->returnValue([$vendorPackage])); - $this->generator->dump($this->config, $this->repository, $package, $this->im, $this->locker, 'composer', true, 'Phar'); + $this->generator->dump($this->config, $this->repository, $package, $this->im, 'composer', true, 'Phar'); $this->assertAutoloadFiles('phar', $this->vendorDir . '/composer'); $this->assertAutoloadFiles('phar_psr4', $this->vendorDir . '/composer', 'psr4'); @@ -685,7 +675,7 @@ class AutoloadGeneratorTest extends TestCase ->method('getCanonicalPackages') ->will($this->returnValue([])); - $this->generator->dump($this->config, $this->repository, $package, $this->im, $this->locker, 'composer', true, '_8'); + $this->generator->dump($this->config, $this->repository, $package, $this->im, 'composer', true, '_8'); $this->assertFileExists($this->vendorDir.'/composer/autoload_classmap.php', "ClassMap file needs to be generated."); $this->assertEquals( [ @@ -715,7 +705,7 @@ class AutoloadGeneratorTest extends TestCase file_put_contents($this->workingDir.'/psr4/match.php', 'workingDir.'/psr4/badfile.php', 'generator->dump($this->config, $this->repository, $package, $this->im, $this->locker, 'composer', true, '_1'); + $this->generator->dump($this->config, $this->repository, $package, $this->im, 'composer', true, '_1'); $this->assertFileExists($this->vendorDir.'/composer/autoload_classmap.php', "ClassMap file needs to be generated."); $expectedClassmap = <<vendorDir.'/b/b/src/b.php', 'vendorDir.'/b/b/lib/c.php', 'generator->dump($this->config, $this->repository, $package, $this->im, $this->locker, 'composer', false, '_6'); + $this->generator->dump($this->config, $this->repository, $package, $this->im, 'composer', false, '_6'); $this->assertFileExists($this->vendorDir.'/composer/autoload_classmap.php', "ClassMap file needs to be generated."); $this->assertEquals( [ @@ -803,7 +793,7 @@ EOF; file_put_contents($this->vendorDir.'/a/a/target/lib/b.php', 'vendorDir.'/b/b/src/c.php', 'generator->dump($this->config, $this->repository, $package, $this->im, $this->locker, 'composer', false, '_6'); + $this->generator->dump($this->config, $this->repository, $package, $this->im, 'composer', false, '_6'); $this->assertFileExists($this->vendorDir.'/composer/autoload_classmap.php', "ClassMap file needs to be generated."); $this->assertEquals( [ @@ -845,7 +835,7 @@ EOF; file_put_contents($this->vendorDir.'/b/b/test.php', 'vendorDir.'/c/c/foo/test.php', 'generator->dump($this->config, $this->repository, $package, $this->im, $this->locker, 'composer', false, '_7'); + $this->generator->dump($this->config, $this->repository, $package, $this->im, 'composer', false, '_7'); $this->assertFileExists($this->vendorDir.'/composer/autoload_classmap.php', "ClassMap file needs to be generated."); $this->assertEquals( [ @@ -892,7 +882,7 @@ EOF; $this->generator->setClassMapAuthoritative(true); $this->generator->setApcu(true); - $this->generator->dump($this->config, $this->repository, $package, $this->im, $this->locker, 'composer', false, '_7'); + $this->generator->dump($this->config, $this->repository, $package, $this->im, 'composer', false, '_7'); $this->assertFileExists($this->vendorDir.'/composer/autoload_classmap.php', "ClassMap file needs to be generated."); $this->assertEquals( @@ -941,7 +931,7 @@ EOF; $this->generator->setClassMapAuthoritative(true); $this->generator->setApcu(true, 'custom\'Prefix'); - $this->generator->dump($this->config, $this->repository, $package, $this->im, $this->locker, 'composer', false, '_7'); + $this->generator->dump($this->config, $this->repository, $package, $this->im, 'composer', false, '_7'); $this->assertFileExists($this->vendorDir.'/composer/autoload_classmap.php', "ClassMap file needs to be generated."); $this->assertEquals( @@ -991,7 +981,7 @@ EOF; file_put_contents($this->vendorDir.'/c/c/foo/bar/test4.php', 'workingDir.'/root.php', 'generator->dump($this->config, $this->repository, $package, $this->im, $this->locker, 'composer', false, 'FilesAutoload'); + $this->generator->dump($this->config, $this->repository, $package, $this->im, 'composer', false, 'FilesAutoload'); $this->assertFileContentEquals(__DIR__.'/Fixtures/autoload_functions.php', $this->vendorDir.'/autoload.php'); $this->assertFileContentEquals(__DIR__.'/Fixtures/autoload_real_functions.php', $this->vendorDir.'/composer/autoload_real.php'); $this->assertFileContentEquals(__DIR__.'/Fixtures/autoload_static_functions.php', $this->vendorDir.'/composer/autoload_static.php'); @@ -1056,20 +1046,20 @@ EOF; file_put_contents($this->vendorDir.'/c/c/foo/bar/test4.php', 'workingDir.'/root.php', 'generator->dump($this->config, $this->repository, $autoloadPackage, $this->im, $this->locker, 'composer', false, 'FilesAutoload'); + $this->generator->dump($this->config, $this->repository, $autoloadPackage, $this->im, 'composer', false, 'FilesAutoload'); $this->assertFileContentEquals(__DIR__.'/Fixtures/autoload_functions.php', $this->vendorDir.'/autoload.php'); $this->assertFileContentEquals(__DIR__.'/Fixtures/autoload_real_functions_with_include_paths.php', $this->vendorDir.'/composer/autoload_real.php'); $this->assertFileContentEquals(__DIR__.'/Fixtures/autoload_static_functions_with_include_paths.php', $this->vendorDir.'/composer/autoload_static.php'); $this->assertFileContentEquals(__DIR__.'/Fixtures/autoload_files_functions.php', $this->vendorDir.'/composer/autoload_files.php'); $this->assertFileContentEquals(__DIR__.'/Fixtures/include_paths_functions.php', $this->vendorDir.'/composer/include_paths.php'); - $this->generator->dump($this->config, $this->repository, $autoloadPackage, $this->im, $this->locker, 'composer', false, 'FilesAutoload'); + $this->generator->dump($this->config, $this->repository, $autoloadPackage, $this->im, 'composer', false, 'FilesAutoload'); $this->assertFileContentEquals(__DIR__.'/Fixtures/autoload_functions.php', $this->vendorDir.'/autoload.php'); $this->assertFileContentEquals(__DIR__.'/Fixtures/autoload_real_functions_with_include_paths.php', $this->vendorDir.'/composer/autoload_real.php'); $this->assertFileContentEquals(__DIR__.'/Fixtures/autoload_files_functions_with_removed_extra.php', $this->vendorDir.'/composer/autoload_files.php'); $this->assertFileContentEquals(__DIR__.'/Fixtures/include_paths_functions_with_removed_extra.php', $this->vendorDir.'/composer/include_paths.php'); - $this->generator->dump($this->config, $this->repository, $notAutoloadPackage, $this->im, $this->locker, 'composer', false, 'FilesAutoload'); + $this->generator->dump($this->config, $this->repository, $notAutoloadPackage, $this->im, 'composer', false, 'FilesAutoload'); $this->assertFileContentEquals(__DIR__.'/Fixtures/autoload_functions.php', $this->vendorDir.'/autoload.php'); $this->assertFileContentEquals(__DIR__.'/Fixtures/autoload_real_functions_with_removed_include_paths_and_autolad_files.php', $this->vendorDir.'/composer/autoload_real.php'); $this->assertFileContentEquals(__DIR__.'/Fixtures/autoload_static_functions_with_removed_include_paths_and_autolad_files.php', $this->vendorDir.'/composer/autoload_static.php'); @@ -1133,7 +1123,7 @@ EOF; file_put_contents($this->vendorDir . '/e/e/testE.php', 'workingDir . '/root2.php', 'generator->dump($this->config, $this->repository, $package, $this->im, $this->locker, 'composer', false, 'FilesAutoloadOrder'); + $this->generator->dump($this->config, $this->repository, $package, $this->im, 'composer', false, 'FilesAutoloadOrder'); $this->assertFileContentEquals(__DIR__ . '/Fixtures/autoload_functions_by_dependency.php', $this->vendorDir . '/autoload.php'); $this->assertFileContentEquals(__DIR__ . '/Fixtures/autoload_real_files_by_dependency.php', $this->vendorDir . '/composer/autoload_real.php'); $this->assertFileContentEquals(__DIR__ . '/Fixtures/autoload_static_files_by_dependency.php', $this->vendorDir . '/composer/autoload_static.php'); @@ -1244,7 +1234,7 @@ return array( EOF; - $this->generator->dump($this->config, $this->repository, $rootPackage, $this->im, $this->locker, 'composer', true, '_9'); + $this->generator->dump($this->config, $this->repository, $rootPackage, $this->im, 'composer', true, '_9'); $this->assertStringEqualsFile($this->vendorDir.'/composer/autoload_namespaces.php', $expectedNamespace); $this->assertStringEqualsFile($this->vendorDir.'/composer/autoload_psr4.php', $expectedPsr4); $this->assertStringEqualsFile($this->vendorDir.'/composer/autoload_classmap.php', $expectedClassmap); @@ -1274,7 +1264,7 @@ EOF; $this->fs->ensureDirectoryExists($this->vendorDir.'/composer'); - $this->generator->dump($this->config, $this->repository, $package, $this->im, $this->locker, 'composer', false, '_10'); + $this->generator->dump($this->config, $this->repository, $package, $this->im, 'composer', false, '_10'); $this->assertFileContentEquals(__DIR__.'/Fixtures/include_paths.php', $this->vendorDir.'/composer/include_paths.php'); $this->assertEquals( @@ -1303,7 +1293,7 @@ EOF; mkdir($this->vendorDir."/composer", 0777, true); - $this->generator->dump($this->config, $this->repository, $package, $this->im, $this->locker, 'composer', false, '_11'); + $this->generator->dump($this->config, $this->repository, $package, $this->im, 'composer', false, '_11'); $oldIncludePath = get_include_path(); @@ -1332,7 +1322,7 @@ EOF; mkdir($this->vendorDir."/composer", 0777, true); - $this->generator->dump($this->config, $this->repository, $package, $this->im, $this->locker, 'composer', false, '_12'); + $this->generator->dump($this->config, $this->repository, $package, $this->im, 'composer', false, '_12'); $oldIncludePath = get_include_path(); @@ -1361,7 +1351,7 @@ EOF; mkdir($this->vendorDir."/composer", 0777, true); - $this->generator->dump($this->config, $this->repository, $package, $this->im, $this->locker, 'composer', false, '_12'); + $this->generator->dump($this->config, $this->repository, $package, $this->im, 'composer', false, '_12'); $this->assertFileDoesNotExist($this->vendorDir."/composer/include_paths.php"); } @@ -1390,7 +1380,7 @@ EOF; ->will($this->returnValue([])); $this->generator->setRunScripts(true); - $this->generator->dump($this->config, $this->repository, $package, $this->im, $this->locker, 'composer', true, '_8'); + $this->generator->dump($this->config, $this->repository, $package, $this->im, 'composer', true, '_8'); } public function testUseGlobalIncludePath(): void @@ -1409,7 +1399,7 @@ EOF; $this->fs->ensureDirectoryExists($this->vendorDir.'/a'); - $this->generator->dump($this->config, $this->repository, $package, $this->im, $this->locker, 'composer', false, 'IncludePath'); + $this->generator->dump($this->config, $this->repository, $package, $this->im, 'composer', false, 'IncludePath'); $this->assertFileContentEquals(__DIR__.'/Fixtures/autoload_real_include_path.php', $this->vendorDir.'/composer/autoload_real.php'); $this->assertFileContentEquals(__DIR__.'/Fixtures/autoload_static_include_path.php', $this->vendorDir.'/composer/autoload_static.php'); } @@ -1470,7 +1460,7 @@ EOF; $oldVendorDir = $this->vendorDir; $this->vendorDir = $vendorDir; - $this->generator->dump($this->config, $this->repository, $package, $im, $this->locker, 'composer', true, '_13'); + $this->generator->dump($this->config, $this->repository, $package, $im, 'composer', true, '_13'); $this->vendorDir = $oldVendorDir; $expectedNamespace = <<<'EOF' @@ -1560,7 +1550,7 @@ EOF; file_put_contents($this->workingDir.'/working-dir/classmap4/foo/classes.php', 'workingDir.'/test.php', 'generator->dump($this->config, $this->repository, $package, $this->im, $this->locker, 'composer', true, '_14'); + $this->generator->dump($this->config, $this->repository, $package, $this->im, 'composer', true, '_14'); $expectedNamespace = <<<'EOF' setAutoload([ 'psr-0' => ['Foo' => './src'], ]); - $this->generator->dump($this->config, $this->repository, $package, $this->im, $this->locker, 'composer', true, '_19'); + $this->generator->dump($this->config, $this->repository, $package, $this->im, 'composer', true, '_19'); $expectedNamespace = <<<'EOF' setAutoload([ 'psr-4' => ['Acme\Foo\\' => './src-psr4'], ]); - $this->generator->dump($this->config, $this->repository, $package, $this->im, $this->locker, 'composer', true, '_19'); + $this->generator->dump($this->config, $this->repository, $package, $this->im, 'composer', true, '_19'); $expectedPsr4 = <<<'EOF' ['classmap'], ]); try { - $this->generator->dump($this->config, $this->repository, $package, $this->im, $this->locker, 'composer', true, '_19'); + $this->generator->dump($this->config, $this->repository, $package, $this->im, 'composer', true, '_19'); } catch (\RuntimeException $e) { $this->assertSame('Could not scan for classes inside "'.$this->vendorDir.'/dep/a/classmap" which does not appear to be a file nor a folder', $e->getMessage()); } @@ -1676,7 +1666,7 @@ EOF; $dep->setAutoload([ 'files' => ['./test.php'], ]); - $this->generator->dump($this->config, $this->repository, $package, $this->im, $this->locker, 'composer', true, '_19'); + $this->generator->dump($this->config, $this->repository, $package, $this->im, 'composer', true, '_19'); $this->assertStringContainsString("\$vendorDir . '/dep/a/test.php',\n", (string) file_get_contents($this->vendorDir.'/composer/autoload_files.php')); $package->setAutoload([ @@ -1710,7 +1700,7 @@ EOF; file_put_contents($this->workingDir.'/Foo/Bar.php', 'workingDir.'/class.php', 'generator->dump($this->config, $this->repository, $package, $this->im, $this->locker, 'composer', true, '_15'); + $this->generator->dump($this->config, $this->repository, $package, $this->im, 'composer', true, '_15'); $expectedNamespace = <<<'EOF' generator->dump($this->config, $this->repository, $package, $this->im, $this->locker, 'composer', false, 'VendorSubstring'); + $this->generator->dump($this->config, $this->repository, $package, $this->im, 'composer', false, 'VendorSubstring'); $this->assertStringEqualsFile($this->vendorDir.'/composer/autoload_namespaces.php', $expectedNamespace); $this->assertStringEqualsFile($this->vendorDir.'/composer/autoload_psr4.php', $expectedPsr4); } @@ -1871,7 +1861,7 @@ EOF; : 'ln -s "' . $target . '" "' . $link . '"'; exec($command); - $this->generator->dump($this->config, $this->repository, $package, $this->im, $this->locker, 'composer', true, '_1'); + $this->generator->dump($this->config, $this->repository, $package, $this->im, 'composer', true, '_1'); // Assert that autoload_classmap.php was correctly generated. $this->assertAutoloadFiles('classmap', $this->vendorDir.'/composer', 'classmap'); @@ -1903,7 +1893,7 @@ EOF; ->will($this->returnValue([])); $this->generator->setPlatformRequirementFilter(PlatformRequirementFilterFactory::fromBoolOrList($ignorePlatformReqs)); - $this->generator->dump($this->config, $this->repository, $package, $this->im, $this->locker, 'composer', true, '_1'); + $this->generator->dump($this->config, $this->repository, $package, $this->im, 'composer', true, '_1'); if (null === $expectedFixture) { $this->assertFileDoesNotExist($this->vendorDir . '/composer/platform_check.php');