/** * @group ZF-7369 * @group ZF-6982 */ public function testFromReflectionFilePreservesIndentsWhenAdditionalMethodAdded() { $file = dirname(__FILE__) . '/_files/TestClassWithCodeInMethod.php'; require_once $file; $codeGenFileFromDisk = Zend_CodeGenerator_Php_File::fromReflection(new Zend_Reflection_File($file)); $codeGenFileFromDisk->getClass()->setMethod(array('name' => 'foobar')); $expectedOutput = <<<EOS <?php /** * File header here * * @author Ralph Schindler <*****@*****.**> */ /** * class docblock * * @package Zend_Reflection_TestClassWithCodeInMethod */ class Zend_Reflection_TestClassWithCodeInMethod { /** * Enter description here... * * @return bool */ public function someMethod() { /* test test */ \$foo = 'bar'; } public function foobar() { } } EOS; $this->assertEquals($expectedOutput, $codeGenFileFromDisk->generate()); }
public function testFromReflectionFile() { ///$this->markTestSkipped('skipme'); $file = dirname(__FILE__) . '/_files/TestSampleSingleClass.php'; require_once $file; $codeGenFileFromDisk = Zend_CodeGenerator_Php_File::fromReflection(new Zend_Reflection_File($file)); $codeGenFileFromDisk->getClass()->setMethod(array('name' => 'foobar')); $expectedOutput = <<<EOS <?php /** * File header here * * @author Ralph Schindler <*****@*****.**> * */ /** * class docblock * * @package Zend_Reflection_TestSampleSingleClass * */ class Zend_Reflection_TestSampleSingleClass { /** * Enter description here... * * @return bool * */ public function someMethod() { /* test test */ } public function foobar() { } } EOS; $this->assertEquals($expectedOutput, $codeGenFileFromDisk->generate()); }