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); }
public function testSignature() { $expected = 'trait MyTrait {' . "\n" . '}'; $trait = PhpTrait::create('MyTrait'); $generator = new ModelGenerator(); $code = $generator->generate($trait); $this->assertEquals($expected, $code); }
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); }
/** * 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; }