/** * Tests if appendMethodCall works. It uses the same codebase as appendFunctionCall * so we only test that it works at all. */ public function testAppendMethodCall() { $generator = new ezcPhpGenerator(dirname(__FILE__) . '/data/generator_test.php', false); $generator->appendCustomCode("class TestClass{\n public function hello() { return 'hello'; }}"); $generator->appendCustomCode("\$object = new TestClass();"); $generator->appendMethodCall('object', 'hello', array(), new ezcPhpGeneratorReturnData('result')); $generator->appendCustomCode('return $result;' . $generator->lineBreak); $generator->finish(); $data = file_get_contents(dirname(__FILE__) . '/data/generator_test.php'); $this->assertEquals("hello", eval($data)); }