1
0
Fork 0

Verify generation of autoload_psr4.php even if empty.

pull/2459/head
Andreas Hennings 2013-12-22 19:38:11 +01:00
parent 8e11a7684f
commit 8966376f40
1 changed files with 75 additions and 0 deletions

View File

@ -518,6 +518,20 @@ return array(
'A' => array(\$vendorDir . '/a/a/src'),
);
EOF;
// autoload_psr4.php is expected to be empty in this example.
$expectedPsr4 = <<<EOF
<?php
// autoload_psr4.php @generated by Composer
\$vendorDir = dirname(dirname(__FILE__));
\$baseDir = dirname(\$vendorDir);
return array(
);
EOF;
$expectedClassmap = <<<EOF
@ -537,6 +551,7 @@ EOF;
$this->generator->dump($this->config, $this->repository, $package, $this->im, 'composer', true, '_9');
$this->assertEquals($expectedNamespace, file_get_contents($this->vendorDir.'/composer/autoload_namespaces.php'));
$this->assertEquals($expectedPsr4, file_get_contents($this->vendorDir.'/composer/autoload_psr4.php'));
$this->assertEquals($expectedClassmap, file_get_contents($this->vendorDir.'/composer/autoload_classmap.php'));
}
@ -766,6 +781,20 @@ return array(
'Bar' => array($vendorDir . '/b/b/lib'),
);
EOF;
// autoload_psr4.php is expected to be empty in this example.
$expectedPsr4 = <<<'EOF'
<?php
// autoload_psr4.php @generated by Composer
$vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir).'/working-dir';
return array(
);
EOF;
$expectedClassmap = <<<'EOF'
@ -786,6 +815,7 @@ return array(
EOF;
$this->assertEquals($expectedNamespace, file_get_contents($vendorDir.'/composer/autoload_namespaces.php'));
$this->assertEquals($expectedPsr4, file_get_contents($vendorDir.'/composer/autoload_psr4.php'));
$this->assertEquals($expectedClassmap, file_get_contents($vendorDir.'/composer/autoload_classmap.php'));
$this->assertContains("\n \$vendorDir . '/b/b/bootstrap.php',\n", file_get_contents($vendorDir.'/composer/autoload_files.php'));
$this->assertContains("\n \$baseDir . '/test.php',\n", file_get_contents($vendorDir.'/composer/autoload_files.php'));
@ -828,6 +858,20 @@ return array(
'Foo' => array($baseDir . '/../src'),
);
EOF;
// autoload_psr4.php is expected to be empty in this example.
$expectedPsr4 = <<<'EOF'
<?php
// autoload_psr4.php @generated by Composer
$vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir).'/working-dir';
return array(
);
EOF;
$expectedClassmap = <<<'EOF'
@ -846,6 +890,7 @@ return array(
EOF;
$this->assertEquals($expectedNamespace, file_get_contents($this->vendorDir.'/composer/autoload_namespaces.php'));
$this->assertEquals($expectedPsr4, file_get_contents($this->vendorDir.'/composer/autoload_psr4.php'));
$this->assertEquals($expectedClassmap, file_get_contents($this->vendorDir.'/composer/autoload_classmap.php'));
$this->assertContains("\n \$baseDir . '/../test.php',\n", file_get_contents($this->vendorDir.'/composer/autoload_files.php'));
}
@ -880,6 +925,20 @@ return array(
'Foo' => array($baseDir . '/'),
);
EOF;
// autoload_psr4.php is expected to be empty in this example.
$expectedPsr4 = <<<EOF
<?php
// autoload_psr4.php @generated by Composer
\$vendorDir = dirname(dirname(__FILE__));
\$baseDir = dirname(\$vendorDir);
return array(
);
EOF;
$expectedClassmap = <<<'EOF'
@ -898,6 +957,7 @@ return array(
EOF;
$this->assertEquals($expectedNamespace, file_get_contents($this->vendorDir.'/composer/autoload_namespaces.php'));
$this->assertEquals($expectedPsr4, file_get_contents($this->vendorDir.'/composer/autoload_psr4.php'));
$this->assertEquals($expectedClassmap, file_get_contents($this->vendorDir.'/composer/autoload_classmap.php'));
}
@ -926,10 +986,25 @@ return array(
'Foo' => array($baseDir . '/composer-test-autoload-src/src'),
);
EOF;
// autoload_psr4.php is expected to be empty in this example.
$expectedPsr4 = <<<EOF
<?php
// autoload_psr4.php @generated by Composer
\$vendorDir = dirname(dirname(__FILE__));
\$baseDir = dirname(\$vendorDir);
return array(
);
EOF;
$this->generator->dump($this->config, $this->repository, $package, $this->im, 'composer', false, 'VendorSubstring');
$this->assertEquals($expectedNamespace, file_get_contents($this->vendorDir.'/composer/autoload_namespaces.php'));
$this->assertEquals($expectedPsr4, file_get_contents($this->vendorDir.'/composer/autoload_psr4.php'));
}
private function assertAutoloadFiles($name, $dir, $type = 'namespaces')