From 81e8261692042c53ded136e9e10a7f4560859227 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Haso=C5=88?= Date: Wed, 21 Mar 2012 12:57:50 +0100 Subject: [PATCH] Added tests for traits --- .../Test/Autoload/ClassMapGeneratorTest.php | 16 ++++++++++- .../Autoload/Fixtures/classmap/multipleNs.php | 3 ++ .../Test/Autoload/Fixtures/php5.4/traits.php | 28 +++++++++++++++++++ 3 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 tests/Composer/Test/Autoload/Fixtures/php5.4/traits.php diff --git a/tests/Composer/Test/Autoload/ClassMapGeneratorTest.php b/tests/Composer/Test/Autoload/ClassMapGeneratorTest.php index d40321768..3937e8a99 100644 --- a/tests/Composer/Test/Autoload/ClassMapGeneratorTest.php +++ b/tests/Composer/Test/Autoload/ClassMapGeneratorTest.php @@ -25,7 +25,7 @@ class ClassMapGeneratorTest extends \PHPUnit_Framework_TestCase public function getTestCreateMapTests() { - return array( + $data = array( array(__DIR__.'/Fixtures/Namespaced', array( 'Namespaced\\Bar' => realpath(__DIR__).'/Fixtures/Namespaced/Bar.php', 'Namespaced\\Foo' => realpath(__DIR__).'/Fixtures/Namespaced/Foo.php', @@ -44,6 +44,7 @@ class ClassMapGeneratorTest extends \PHPUnit_Framework_TestCase array(__DIR__.'/Fixtures/classmap', array( 'Foo\\Bar\\A' => 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\\B' => 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', )), ); + + 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() diff --git a/tests/Composer/Test/Autoload/Fixtures/classmap/multipleNs.php b/tests/Composer/Test/Autoload/Fixtures/classmap/multipleNs.php index 27f96f704..d19e07fc1 100644 --- a/tests/Composer/Test/Autoload/Fixtures/classmap/multipleNs.php +++ b/tests/Composer/Test/Autoload/Fixtures/classmap/multipleNs.php @@ -1,4 +1,7 @@