mirror of
https://github.com/composer/composer
synced 2025-05-10 00:53:06 +00:00
Added tests for traits
This commit is contained in:
parent
d8cdaf8169
commit
81e8261692
3 changed files with 46 additions and 1 deletions
|
@ -25,7 +25,7 @@ class ClassMapGeneratorTest extends \PHPUnit_Framework_TestCase
|
||||||
|
|
||||||
public function getTestCreateMapTests()
|
public function getTestCreateMapTests()
|
||||||
{
|
{
|
||||||
return array(
|
$data = array(
|
||||||
array(__DIR__.'/Fixtures/Namespaced', array(
|
array(__DIR__.'/Fixtures/Namespaced', array(
|
||||||
'Namespaced\\Bar' => realpath(__DIR__).'/Fixtures/Namespaced/Bar.php',
|
'Namespaced\\Bar' => realpath(__DIR__).'/Fixtures/Namespaced/Bar.php',
|
||||||
'Namespaced\\Foo' => realpath(__DIR__).'/Fixtures/Namespaced/Foo.php',
|
'Namespaced\\Foo' => realpath(__DIR__).'/Fixtures/Namespaced/Foo.php',
|
||||||
|
@ -44,6 +44,7 @@ class ClassMapGeneratorTest extends \PHPUnit_Framework_TestCase
|
||||||
array(__DIR__.'/Fixtures/classmap', array(
|
array(__DIR__.'/Fixtures/classmap', array(
|
||||||
'Foo\\Bar\\A' => realpath(__DIR__).'/Fixtures/classmap/sameNsMultipleClasses.php',
|
'Foo\\Bar\\A' => realpath(__DIR__).'/Fixtures/classmap/sameNsMultipleClasses.php',
|
||||||
'Foo\\Bar\\B' => realpath(__DIR__).'/Fixtures/classmap/sameNsMultipleClasses.php',
|
'Foo\\Bar\\B' => realpath(__DIR__).'/Fixtures/classmap/sameNsMultipleClasses.php',
|
||||||
|
'A' => realpath(__DIR__).'/Fixtures/classmap/multipleNs.php',
|
||||||
'Alpha\\A' => realpath(__DIR__).'/Fixtures/classmap/multipleNs.php',
|
'Alpha\\A' => realpath(__DIR__).'/Fixtures/classmap/multipleNs.php',
|
||||||
'Alpha\\B' => realpath(__DIR__).'/Fixtures/classmap/multipleNs.php',
|
'Alpha\\B' => realpath(__DIR__).'/Fixtures/classmap/multipleNs.php',
|
||||||
'Beta\\A' => realpath(__DIR__).'/Fixtures/classmap/multipleNs.php',
|
'Beta\\A' => realpath(__DIR__).'/Fixtures/classmap/multipleNs.php',
|
||||||
|
@ -53,6 +54,19 @@ class ClassMapGeneratorTest extends \PHPUnit_Framework_TestCase
|
||||||
'ClassMap\\SomeClass' => realpath(__DIR__).'/Fixtures/classmap/SomeClass.php',
|
'ClassMap\\SomeClass' => realpath(__DIR__).'/Fixtures/classmap/SomeClass.php',
|
||||||
)),
|
)),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (version_compare(PHP_VERSION, '5.4', '>=')) {
|
||||||
|
$data[] = array(__DIR__.'/Fixtures/php5.4', array(
|
||||||
|
'TFoo' => __DIR__.'/Fixtures/php5.4/traits.php',
|
||||||
|
'CFoo' => __DIR__.'/Fixtures/php5.4/traits.php',
|
||||||
|
'Foo\\TBar' => __DIR__.'/Fixtures/php5.4/traits.php',
|
||||||
|
'Foo\\IBar' => __DIR__.'/Fixtures/php5.4/traits.php',
|
||||||
|
'Foo\\TFooBar' => __DIR__.'/Fixtures/php5.4/traits.php',
|
||||||
|
'Foo\\CBar' => __DIR__.'/Fixtures/php5.4/traits.php',
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testCreateMapFinderSupport()
|
public function testCreateMapFinderSupport()
|
||||||
|
|
|
@ -1,4 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
|
namespace {
|
||||||
|
class A {}
|
||||||
|
}
|
||||||
|
|
||||||
namespace Alpha {
|
namespace Alpha {
|
||||||
class A {}
|
class A {}
|
||||||
|
|
28
tests/Composer/Test/Autoload/Fixtures/php5.4/traits.php
Normal file
28
tests/Composer/Test/Autoload/Fixtures/php5.4/traits.php
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
<?php
|
||||||
|
namespace {
|
||||||
|
trait TFoo {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
class CFoo {
|
||||||
|
use TFoo;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace Foo {
|
||||||
|
trait TBar {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
interface IBar {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
trait TFooBar {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
class CBar implements IBar {
|
||||||
|
use TBar, TFooBar;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue