From 2af2c27168b230d50c11bb011b9eddc3b3bceaef Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Sat, 18 Aug 2012 14:58:55 +0200 Subject: [PATCH] Add regression test for files autoload in root package, fixes #880 --- tests/Composer/Test/Autoload/AutoloadGeneratorTest.php | 3 +++ .../Test/Autoload/Fixtures/autoload_real_functions.php | 1 + 2 files changed, 4 insertions(+) diff --git a/tests/Composer/Test/Autoload/AutoloadGeneratorTest.php b/tests/Composer/Test/Autoload/AutoloadGeneratorTest.php index bf2ce37d8..9a5d48ba9 100644 --- a/tests/Composer/Test/Autoload/AutoloadGeneratorTest.php +++ b/tests/Composer/Test/Autoload/AutoloadGeneratorTest.php @@ -264,6 +264,7 @@ class AutoloadGeneratorTest extends TestCase public function testFilesAutoloadGeneration() { $package = new MemoryPackage('a', '1.0', '1.0'); + $package->setAutoload(array('files' => array('root.php'))); $packages = array(); $packages[] = $a = new MemoryPackage('a/a', '1.0', '1.0'); @@ -279,6 +280,7 @@ class AutoloadGeneratorTest extends TestCase $this->fs->ensureDirectoryExists($this->vendorDir.'/b/b'); file_put_contents($this->vendorDir.'/a/a/test.php', 'vendorDir.'/b/b/test2.php', 'workingDir.'/root.php', 'generator->dump($this->config, $this->repository, $package, $this->im, 'composer', false, 'FilesAutoload'); $this->assertFileEquals(__DIR__.'/Fixtures/autoload_functions.php', $this->vendorDir.'/autoload.php'); @@ -290,6 +292,7 @@ class AutoloadGeneratorTest extends TestCase include $this->vendorDir . '/autoload.php'; $this->assertTrue(function_exists('testFilesAutoloadGeneration1')); $this->assertTrue(function_exists('testFilesAutoloadGeneration2')); + $this->assertTrue(function_exists('testFilesAutoloadGenerationRoot')); } public function testOverrideVendorsAutoloading() diff --git a/tests/Composer/Test/Autoload/Fixtures/autoload_real_functions.php b/tests/Composer/Test/Autoload/Fixtures/autoload_real_functions.php index b7fcdd65c..bfeb45024 100644 --- a/tests/Composer/Test/Autoload/Fixtures/autoload_real_functions.php +++ b/tests/Composer/Test/Autoload/Fixtures/autoload_real_functions.php @@ -24,6 +24,7 @@ class ComposerAutoloaderInitFilesAutoload $loader->register(); + require $baseDir . '/root.php'; require $vendorDir . '/a/a/test.php'; require $vendorDir . '/b/b/test2.php';