public function testPreWriteInvalidReturnThrowsException() { $c = ' '; $cw = new cfhCompile_CodeWriter(); $cr = new cfhCompile_ClassRegistry(); $cl = new cfhCompile_Class_Reflection($this); $plugin = $this->getMock('cfhCompile_CodeWriter_Plugin_Abstract'); $plugin->expects($this->once())->method('preWrite')->will($this->returnValue($this)); $b = new cfhCompile_CodeWriter_PluginBroker(); $b->attach($plugin); try { $b->preWrite($cw, $cl, $c, $cr); } catch (cfhCompile_CodeWriter_Plugin_Exception $e) { return; } $this->fail('Expecting to catch cfhCompile_CodeWriter_Plugin_Exception.'); }
/** * Write a class. * * @param cfhCompile_Class_Interface $class * @param String $sourceCode * @param cfhCompile_ClassRegistry $classRegistry */ public function write(cfhCompile_Class_Interface $class, $sourceCode, cfhCompile_ClassRegistry $classRegistry) { $sourceCode = $this->plugin->preWrite($this, $class, $sourceCode, $classRegistry); $this->write->write($class, $sourceCode, $classRegistry); $this->plugin->postWrite($this, $class, $sourceCode, $classRegistry); }