Beispiel #1
0
 public function testOwnMethodsGetter()
 {
     $gClass = new GClass($refl = new ReflectionClass('Psc\\Code\\Compile\\Compiler'));
     $this->assertEquals('\\Psc\\Code\\Compile', $gClass->getNamespace());
     $gm = $gClass->getMethod('getClassName');
     // getClassName ist aus Psc\SimpleObject und somit eine Methode einer Vaterklasse
     $m = $refl->getMethod('getClassName');
     $this->assertEquals((string) $m->getDeclaringClass()->getName(), (string) $gm->getDeclaringClass()->getFQN());
     $this->assertArrayHasKey('getClassName', $gClass->getAllMethods());
     $this->assertArrayNotHasKey('getClassName', $gClass->getMethods());
     $this->assertLessThan(count($gClass->getAllMethods()), count($gClass->getMethods()));
     $m = $gClass->createMethod('Test');
     $this->assertNotEmpty($m->getDeclaringClass());
     /* BUG: Namespace verändern verändert die Rückggabe der Methoden */
     $gClass = GClass::factory('Psc\\Code\\Generate\\MyTestClass');
     $this->assertEquals(2, count($gClass->getMethods()));
     $this->assertEquals(2, count($gClass->getAllMethods()));
     $gClass->setNamespace('Psc\\Other\\Than\\Before');
     $this->assertEquals(2, count($gClass->getMethods()));
     $this->assertEquals(2, count($gClass->getAllMethods()));
 }