コード例 #1
0
 public function testSignature()
 {
     $expected = 'trait MyTrait {' . "\n" . '}';
     $trait = PhpTrait::create('MyTrait');
     $codegen = new CodeGenerator(['generateDocblock' => false, 'generateEmptyDocblock' => false]);
     $code = $codegen->generate($trait);
     $this->assertEquals($expected, $code);
 }
コード例 #2
0
 public function testSignature()
 {
     $expected = 'trait MyTrait {' . "\n" . '}';
     $trait = PhpTrait::create('MyTrait');
     $generator = new ModelGenerator();
     $code = $generator->generate($trait);
     $this->assertEquals($expected, $code);
 }
コード例 #3
0
 public function testCreate()
 {
     $class = PhpClass::create();
     $this->assertTrue($class instanceof PhpClass);
     $interface = PhpInterface::create();
     $this->assertTrue($interface instanceof PhpInterface);
     $trait = PhpTrait::create();
     $this->assertTrue($trait instanceof PhpTrait);
 }
コード例 #4
0
ファイル: Fixtures.php プロジェクト: gossi/php-code-generator
 /**
  * Creates DummyTrait
  * 
  * @return PhpTrait
  */
 public static function createDummyTrait()
 {
     $trait = PhpTrait::create('DummyTrait')->setNamespace('gossi\\codegen\\tests\\fixtures')->setDescription('Dummy docblock')->setMethod(PhpMethod::create('foo')->setVisibility('public'))->setProperty(PhpProperty::create('iAmHidden')->setVisibility('private'))->addTrait('VeryDummyTrait');
     $trait->generateDocblock();
     return $trait;
 }