Rajout de doctrine/orm
[zf2.biz/galerie.git] / vendor / doctrine / common / tests / Doctrine / Tests / Common / Reflection / StaticReflectionParserTest.php
1 <?php
2
3 namespace Doctrine\Tests\Common\Reflection;
4
5 use Doctrine\Tests\DoctrineTestCase;
6 use Doctrine\Common\Reflection\StaticReflectionParser;
7 use Doctrine\Common\Reflection\Psr0FindFile;
8
9 class StaticReflectionParserTest extends DoctrineTestCase
10 {
11     public function testParentClass()
12     {
13         $testsRoot = substr(__DIR__, 0, -strlen(__NAMESPACE__) - 1);
14         $paths = array(
15             'Doctrine\\Tests' => array($testsRoot),
16         );
17         $noParentClassName = 'Doctrine\\Tests\\Common\\Reflection\\NoParent';
18         $staticReflectionParser = new StaticReflectionParser($noParentClassName, new Psr0FindFile($paths));
19         $declaringClassName = $staticReflectionParser->getStaticReflectionParserForDeclaringClass('property', 'test')->getClassName();
20         $this->assertEquals($noParentClassName, $declaringClassName);
21
22         $className = 'Doctrine\\Tests\\Common\\Reflection\\FullyClassifiedParent';
23         $staticReflectionParser = new StaticReflectionParser($className, new Psr0FindFile($paths));
24         $declaringClassName = $staticReflectionParser->getStaticReflectionParserForDeclaringClass('property', 'test')->getClassName();
25         $this->assertEquals($noParentClassName, $declaringClassName);
26
27         $className = 'Doctrine\\Tests\\Common\\Reflection\\SameNamespaceParent';
28         $staticReflectionParser = new StaticReflectionParser($className, new Psr0FindFile($paths));
29         $declaringClassName = $staticReflectionParser->getStaticReflectionParserForDeclaringClass('property', 'test')->getClassName();
30         $this->assertEquals($noParentClassName, $declaringClassName);
31
32         $dummyParentClassName = 'Doctrine\\Tests\\Common\\Reflection\\Dummies\\NoParent';
33
34         $className = 'Doctrine\\Tests\\Common\\Reflection\\DeeperNamespaceParent';
35         $staticReflectionParser = new StaticReflectionParser($className, new Psr0FindFile($paths));
36         $declaringClassName = $staticReflectionParser->getStaticReflectionParserForDeclaringClass('property', 'test')->getClassName();
37         $this->assertEquals($dummyParentClassName, $declaringClassName);
38
39         $className = 'Doctrine\\Tests\\Common\\Reflection\\UseParent';
40         $staticReflectionParser = new StaticReflectionParser($className, new Psr0FindFile($paths));
41         $declaringClassName = $staticReflectionParser->getStaticReflectionParserForDeclaringClass('property', 'test')->getClassName();
42         $this->assertEquals($dummyParentClassName, $declaringClassName);
43
44     }
45 }