|
@@ -758,14 +758,14 @@ EOF;
|
|
|
|
|
|
$package = new Package('a', '1.0', '1.0');
|
|
|
$package->setAutoload(array(
|
|
|
- 'psr-0' => array('Foo' => '../path/../src'),
|
|
|
- 'classmap' => array('../classmap'),
|
|
|
- 'files' => array('../test.php'),
|
|
|
+ 'psr-0' => array('Foo' => '../path/../src'),
|
|
|
+ 'classmap' => array('../classmap'),
|
|
|
+ 'files' => array('../test.php'),
|
|
|
));
|
|
|
|
|
|
$this->repository->expects($this->once())
|
|
|
- ->method('getPackages')
|
|
|
- ->will($this->returnValue(array()));
|
|
|
+ ->method('getPackages')
|
|
|
+ ->will($this->returnValue(array()));
|
|
|
|
|
|
$this->fs->ensureDirectoryExists($this->workingDir.'/src/Foo');
|
|
|
$this->fs->ensureDirectoryExists($this->workingDir.'/classmap');
|
|
@@ -809,6 +809,57 @@ EOF;
|
|
|
$this->assertContains("require \$baseDir . '/../test.php';", file_get_contents($this->vendorDir.'/composer/autoload_real.php'));
|
|
|
}
|
|
|
|
|
|
+ public function testEmptyPaths()
|
|
|
+ {
|
|
|
+ $package = new Package('a', '1.0', '1.0');
|
|
|
+ $package->setAutoload(array(
|
|
|
+ 'psr-0' => array('Foo' => ''),
|
|
|
+ 'classmap' => array(''),
|
|
|
+ ));
|
|
|
+
|
|
|
+ $this->repository->expects($this->once())
|
|
|
+ ->method('getPackages')
|
|
|
+ ->will($this->returnValue(array()));
|
|
|
+
|
|
|
+ $this->fs->ensureDirectoryExists($this->workingDir.'/Foo');
|
|
|
+ file_put_contents($this->workingDir.'/Foo/Bar.php', '<?php namespace Foo; class Bar {}');
|
|
|
+ file_put_contents($this->workingDir.'/class.php', '<?php namespace Classmap; class Foo {}');
|
|
|
+
|
|
|
+ $this->generator->dump($this->config, $this->repository, $package, $this->im, 'composer', true, '_15');
|
|
|
+
|
|
|
+ $expectedNamespace = <<<'EOF'
|
|
|
+<?php
|
|
|
+
|
|
|
+// autoload_namespaces.php generated by Composer
|
|
|
+
|
|
|
+$vendorDir = dirname(dirname(__FILE__));
|
|
|
+$baseDir = dirname($vendorDir);
|
|
|
+
|
|
|
+return array(
|
|
|
+ 'Foo' => $baseDir . '/',
|
|
|
+);
|
|
|
+
|
|
|
+EOF;
|
|
|
+
|
|
|
+ $expectedClassmap = <<<'EOF'
|
|
|
+<?php
|
|
|
+
|
|
|
+// autoload_classmap.php generated by Composer
|
|
|
+
|
|
|
+$vendorDir = dirname(dirname(__FILE__));
|
|
|
+$baseDir = dirname($vendorDir);
|
|
|
+
|
|
|
+return array(
|
|
|
+ 'Classmap\\Foo' => $baseDir . '/class.php',
|
|
|
+ 'Foo\\Bar' => $baseDir . '/Foo/Bar.php',
|
|
|
+);
|
|
|
+
|
|
|
+EOF;
|
|
|
+
|
|
|
+ $this->assertEquals($expectedNamespace, file_get_contents($this->vendorDir.'/composer/autoload_namespaces.php'));
|
|
|
+ $this->assertEquals($expectedClassmap, file_get_contents($this->vendorDir.'/composer/autoload_classmap.php'));
|
|
|
+ }
|
|
|
+
|
|
|
private function assertAutoloadFiles($name, $dir, $type = 'namespaces')
|
|
|
{
|
|
|
$a = __DIR__.'/Fixtures/autoload_'.$name.'.php';
|