1
0
Fork 0

More interesting generator tests for PSR-4.

pull/2459/head
Andreas Hennings 2013-12-22 19:58:27 +01:00
parent bda2bcac13
commit 0a4b18ce86
1 changed files with 16 additions and 10 deletions

View File

@ -725,6 +725,7 @@ EOF;
$package = new Package('a', '1.0', '1.0'); $package = new Package('a', '1.0', '1.0');
$package->setAutoload(array( $package->setAutoload(array(
'psr-0' => array('Foo' => 'src'), 'psr-0' => array('Foo' => 'src'),
'psr-4' => array('Acme\Foo\\' => 'src-psr4'),
'classmap' => array('classmap'), 'classmap' => array('classmap'),
'files' => array('test.php'), 'files' => array('test.php'),
)); ));
@ -732,6 +733,7 @@ EOF;
$vendorPackage = new Package('b/b', '1.0', '1.0'); $vendorPackage = new Package('b/b', '1.0', '1.0');
$vendorPackage->setAutoload(array( $vendorPackage->setAutoload(array(
'psr-0' => array('Bar' => 'lib'), 'psr-0' => array('Bar' => 'lib'),
'psr-4' => array('Acme\Bar\\' => 'lib-psr4'),
'classmap' => array('classmaps'), 'classmap' => array('classmaps'),
'files' => array('bootstrap.php'), 'files' => array('bootstrap.php'),
)); ));
@ -783,7 +785,6 @@ return array(
EOF; EOF;
// autoload_psr4.php is expected to be empty in this example.
$expectedPsr4 = <<<'EOF' $expectedPsr4 = <<<'EOF'
<?php <?php
@ -793,6 +794,8 @@ $vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir).'/working-dir'; $baseDir = dirname($vendorDir).'/working-dir';
return array( return array(
'Acme\\Foo\\' => array($baseDir . '/src-psr4'),
'Acme\\Bar\\' => array($vendorDir . '/b/b/lib-psr4'),
); );
EOF; EOF;
@ -830,6 +833,7 @@ EOF;
$package = new Package('a', '1.0', '1.0'); $package = new Package('a', '1.0', '1.0');
$package->setAutoload(array( $package->setAutoload(array(
'psr-0' => array('Foo' => '../path/../src'), 'psr-0' => array('Foo' => '../path/../src'),
'psr-4' => array('Acme\Foo\\' => '../path/../src-psr4'),
'classmap' => array('../classmap'), 'classmap' => array('../classmap'),
'files' => array('../test.php'), 'files' => array('../test.php'),
)); ));
@ -860,7 +864,6 @@ return array(
EOF; EOF;
// autoload_psr4.php is expected to be empty in this example.
$expectedPsr4 = <<<'EOF' $expectedPsr4 = <<<'EOF'
<?php <?php
@ -870,6 +873,7 @@ $vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir).'/working-dir'; $baseDir = dirname($vendorDir).'/working-dir';
return array( return array(
'Acme\\Foo\\' => array($baseDir . '/../src-psr4'),
); );
EOF; EOF;
@ -900,6 +904,7 @@ EOF;
$package = new Package('a', '1.0', '1.0'); $package = new Package('a', '1.0', '1.0');
$package->setAutoload(array( $package->setAutoload(array(
'psr-0' => array('Foo' => ''), 'psr-0' => array('Foo' => ''),
'psr-4' => array('Acme\Foo\\' => ''),
'classmap' => array(''), 'classmap' => array(''),
)); ));
@ -927,16 +932,16 @@ return array(
EOF; EOF;
// autoload_psr4.php is expected to be empty in this example. $expectedPsr4 = <<<'EOF'
$expectedPsr4 = <<<EOF
<?php <?php
// autoload_psr4.php @generated by Composer // autoload_psr4.php @generated by Composer
\$vendorDir = dirname(dirname(__FILE__)); $vendorDir = dirname(dirname(__FILE__));
\$baseDir = dirname(\$vendorDir); $baseDir = dirname($vendorDir);
return array( return array(
'Acme\\Foo\\' => array($baseDir . '/'),
); );
EOF; EOF;
@ -966,6 +971,7 @@ EOF;
$package = new Package('a', '1.0', '1.0'); $package = new Package('a', '1.0', '1.0');
$package->setAutoload(array( $package->setAutoload(array(
'psr-0' => array('Foo' => 'composer-test-autoload-src/src'), 'psr-0' => array('Foo' => 'composer-test-autoload-src/src'),
'psr-4' => array('Acme\Foo\\' => 'composer-test-autoload-src/src-psr4'),
)); ));
$this->repository->expects($this->once()) $this->repository->expects($this->once())
@ -988,16 +994,16 @@ return array(
EOF; EOF;
// autoload_psr4.php is expected to be empty in this example. $expectedPsr4 = <<<'EOF'
$expectedPsr4 = <<<EOF
<?php <?php
// autoload_psr4.php @generated by Composer // autoload_psr4.php @generated by Composer
\$vendorDir = dirname(dirname(__FILE__)); $vendorDir = dirname(dirname(__FILE__));
\$baseDir = dirname(\$vendorDir); $baseDir = dirname($vendorDir);
return array( return array(
'Acme\\Foo\\' => array($baseDir . '/composer-test-autoload-src/src-psr4'),
); );
EOF; EOF;