예제 #1
0
 public function testIs()
 {
     $name = new PHPParser_Node_Name('foo');
     $this->assertTrue($name->isUnqualified());
     $this->assertFalse($name->isQualified());
     $this->assertFalse($name->isFullyQualified());
     $this->assertFalse($name->isRelative());
     $name = new PHPParser_Node_Name('foo\\bar');
     $this->assertFalse($name->isUnqualified());
     $this->assertTrue($name->isQualified());
     $this->assertFalse($name->isFullyQualified());
     $this->assertFalse($name->isRelative());
     $name = new PHPParser_Node_Name_FullyQualified('foo');
     $this->assertFalse($name->isUnqualified());
     $this->assertFalse($name->isQualified());
     $this->assertTrue($name->isFullyQualified());
     $this->assertFalse($name->isRelative());
     $name = new PHPParser_Node_Name_Relative('foo');
     $this->assertFalse($name->isUnqualified());
     $this->assertFalse($name->isQualified());
     $this->assertFalse($name->isFullyQualified());
     $this->assertTrue($name->isRelative());
 }
 private function createNamed($name)
 {
     $n = new \PHPParser_Node_Name_FullyQualified(explode("\\", $name));
     $type = $this->registry->getClassOrCreate($name);
     $n->setAttribute('type', $type);
     return $n;
 }