From 70bda382c9342dc906685f70aec5fe9df9db79c9 Mon Sep 17 00:00:00 2001 From: Nicholas Calugar Date: Mon, 2 Apr 2012 17:24:38 -0700 Subject: [PATCH] Adding unit tests to ensure the compiler definition processes supertypes --- test/Definition/CompilerDefinitionTest.php | 13 +++++++++++++ test/TestAsset/CompilerClasses/E.php | 8 ++++++++ 2 files changed, 21 insertions(+) create mode 100644 test/TestAsset/CompilerClasses/E.php diff --git a/test/Definition/CompilerDefinitionTest.php b/test/Definition/CompilerDefinitionTest.php index be30bcb8..527d7915 100644 --- a/test/Definition/CompilerDefinitionTest.php +++ b/test/Definition/CompilerDefinitionTest.php @@ -42,4 +42,17 @@ public function testCompilerCompilesAgainstConstructorInjectionAssets() $definition->getMethodParameters('ZendTest\Di\TestAsset\CompilerClasses\C', 'setB') ); } + + public function testCompilerSupertypes() + { + $definition = new CompilerDefinition; + $definition->addDirectory(__DIR__ . '/../TestAsset/CompilerClasses'); + $definition->compile(); + $this->assertCount(0, $definition->getClassSupertypes('ZendTest\Di\TestAsset\CompilerClasses\C')); + $this->assertCount(1, $definition->getClassSupertypes('ZendTest\Di\TestAsset\CompilerClasses\D')); + $this->assertCount(2, $definition->getClassSupertypes('ZendTest\Di\TestAsset\CompilerClasses\E')); + $this->assertContains('ZendTest\Di\TestAsset\CompilerClasses\C', $definition->getClassSupertypes('ZendTest\Di\TestAsset\CompilerClasses\D')); + $this->assertContains('ZendTest\Di\TestAsset\CompilerClasses\C', $definition->getClassSupertypes('ZendTest\Di\TestAsset\CompilerClasses\E')); + $this->assertContains('ZendTest\Di\TestAsset\CompilerClasses\D', $definition->getClassSupertypes('ZendTest\Di\TestAsset\CompilerClasses\E')); + } } diff --git a/test/TestAsset/CompilerClasses/E.php b/test/TestAsset/CompilerClasses/E.php new file mode 100644 index 00000000..019f6693 --- /dev/null +++ b/test/TestAsset/CompilerClasses/E.php @@ -0,0 +1,8 @@ +