コード例 #1
0
 public function testAClassWhichHasNotBeenUsedAndHasADifferentNamespace()
 {
     $useClass = Phake::mock('Zend\\Code\\Reflection\\ClassReflection');
     $useClassFqn = 'Zend\\ServiceManager\\ServiceManager';
     Phake::when($this->mockClassReflection)->getNamespaceName()->thenReturn('Zend\\Server');
     Phake::when($useClass)->getName()->thenReturn($useClassFqn);
     Phake::when($useClass)->getShortName()->thenReturn('ServiceManager');
     $this->assertEquals('\\Zend\\ServiceManager\\ServiceManager', $this->sut->getClassUseName($this->mockClassReflection, $useClass));
 }
コード例 #2
0
 private function getParentName(ClassReflection $classReflection)
 {
     $parentName = false;
     if (($parent = $classReflection->getParentClass()) && $classReflection->getNamespaceName()) {
         $parentName = $this->classUseNameService->getClassUseName($classReflection, $parent);
     } else {
         if ($parent && !$classReflection->getNamespaceName()) {
             $parentName = '\\' . $parent->getName();
         }
     }
     return $parentName;
 }