コード例 #1
0
 /**
  * @return PhpTrait
  */
 private function createDummyTrait()
 {
     $trait = new PhpTrait('DummyTrait');
     $trait->setNamespace('gossi\\codegen\\tests\\fixture');
     $trait->setDescription('Dummy docblock');
     $trait->setMethod(PhpMethod::create('foo')->setVisibility('public'));
     $trait->setProperty(PhpProperty::create('iAmHidden')->setVisibility('private'));
     $trait->addUseStatement('gossi\\codegen\\tests\\fixture\\VeryDummyTrait');
     $trait->addTrait('VeryDummyTrait');
     $trait->generateDocblock();
     return $trait;
 }
コード例 #2
0
 public function testFromReflection()
 {
     $trait = new PhpTrait('DummyTrait');
     $trait->setNamespace('gossi\\codegen\\tests\\fixture');
     $trait->setDescription('Dummy docblock');
     $trait->setMethod(PhpMethod::create('foo')->setVisibility('public'));
     $trait->setProperty(PhpProperty::create('iAmHidden')->setVisibility('private'));
     // @TODO: this alias is only a workaround
     $trait->addUseStatement('gossi\\codegen\\tests\\fixture\\VeryDummyTrait');
     $trait->addTrait('VeryDummyTrait');
     $trait->generateDocblock();
     $this->assertEquals($trait, PhpTrait::fromReflection(new \ReflectionClass('gossi\\codegen\\tests\\fixture\\DummyTrait')));
 }