示例#1
0
 public function testGenerateSimpleMethod()
 {
     $methodGenerator = new MethodGenerator();
     $methodGenerator->setReturnsReference(true);
     $methodGenerator->setName('methodName');
     $methodGenerator->setVisibility('protected');
     $methodGenerator->setBody('/* body */');
     $methodGenerator->setDocBlock('docBlock');
     $methodGenerator->setParameter(new ParameterGenerator('foo'));
     $this->assertSame(true, $methodGenerator->returnsReference());
     $this->assertStringMatchesFormat('%a/**%adocBlock%a*/%aprotected function & methodName($foo)%a{%a/* body */%a}', $methodGenerator->generate());
 }