Skip to content
Browse files

Add regression test for files autoload in root package, fixes #880

  • Loading branch information...
1 parent 0667525 commit 2af2c27168b230d50c11bb011b9eddc3b3bceaef @Seldaek Seldaek committed Aug 18, 2012
View
3 tests/Composer/Test/Autoload/AutoloadGeneratorTest.php
@@ -264,6 +264,7 @@ public function testClassMapAutoloadingEmptyDirAndExactFile()
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 @@ public function testFilesAutoloadGeneration()
$this->fs->ensureDirectoryExists($this->vendorDir.'/b/b');
file_put_contents($this->vendorDir.'/a/a/test.php', '<?php function testFilesAutoloadGeneration1() {}');
file_put_contents($this->vendorDir.'/b/b/test2.php', '<?php function testFilesAutoloadGeneration2() {}');
+ file_put_contents($this->workingDir.'/root.php', '<?php function testFilesAutoloadGenerationRoot() {}');
$this->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 @@ public function testFilesAutoloadGeneration()
include $this->vendorDir . '/autoload.php';
$this->assertTrue(function_exists('testFilesAutoloadGeneration1'));
$this->assertTrue(function_exists('testFilesAutoloadGeneration2'));
+ $this->assertTrue(function_exists('testFilesAutoloadGenerationRoot'));
}
public function testOverrideVendorsAutoloading()
View
1 tests/Composer/Test/Autoload/Fixtures/autoload_real_functions.php
@@ -24,6 +24,7 @@ public static function getLoader()
$loader->register();
+ require $baseDir . '/root.php';
require $vendorDir . '/a/a/test.php';
require $vendorDir . '/b/b/test2.php';

0 comments on commit 2af2c27

Please sign in to comment.
Something went wrong with that request. Please try again.