public function testRenderFileComment_argumentNotEmpty_rendersCommentWithSubPackageArgumentInfo() { // Module instance mock $oModule = $this->getMock('oxpsModuleGeneratorOxModule', array('__construct', '__call')); // Smarty mock $oSmarty = $this->getMock('Smarty', array('assign', 'fetch')); $oSmarty->expects($this->at(0))->method('assign')->with('oModule', $oModule); $oSmarty->expects($this->at(1))->method('assign')->with('sSubPackage', 'mySubModule'); $oSmarty->expects($this->at(2))->method('fetch')->with($this->stringEndsWith('modulegenerator/core/module.tpl/oxpscomment.inc.php.tpl'))->will($this->returnValue('_processed_comment_content_')); // View utils mock $oViewUtils = $this->getMock('oxUtilsView', array('__call', 'getSmarty')); $oViewUtils->expects($this->once())->method('getSmarty')->will($this->returnValue($oSmarty)); oxRegistry::set('oxUtilsView', $oViewUtils); $this->SUT->init($oModule); $this->assertSame('_processed_comment_content_', $this->SUT->renderFileComment('mySubModule')); }
/** * Clone and copy tests folder into generated module, * create pre-configured unit test class for each generated module class. * * @param oxpsModuleGeneratorRender $oRenderHelper * @param string $sModuleGeneratorPath * @param string $sModulePath * @param array $aClassesToExtend * @param array $aNewClasses */ public function fillTestsFolder(oxpsModuleGeneratorRender $oRenderHelper, $sModuleGeneratorPath, $sModulePath, array $aClassesToExtend, array $aNewClasses) { if ($this->_cloneUnitTests($sModulePath)) { $aAllFiles = array_merge($aClassesToExtend, $aNewClasses); $sTemplate = sprintf('%score/module.tpl/oxpstestclass.php.tpl', $sModuleGeneratorPath); $aNewFiles = (array) $this->_copyNewClasses($aAllFiles, $sTemplate, 'tests/unit/modules/', true); if (!empty($aNewFiles)) { $oRenderHelper->renderWithSmartyAndRename(array_keys($aNewFiles), $aNewFiles); } } }