public function testInitGroup() { $this->_formFactoryMock->expects($this->any())->method('create')->will($this->returnValue($this->_formMock)); $this->_formMock->expects($this->once())->method('setParent')->with($this->_object); $this->_formMock->expects($this->once())->method('setBaseUrl')->with('base_url'); $this->_urlModelMock->expects($this->any())->method('getBaseUrl')->will($this->returnValue('base_url')); $fieldsetRendererMock = $this->getMock('Mage_Backend_Block_System_Config_Form_Fieldset', array(), array(), '', false, false); $this->_fieldsetFactoryMock->expects($this->once())->method('create')->will($this->returnValue($fieldsetRendererMock)); $cloneModelMock = $this->getMock('Mage_Backend_Model_Config', array('getPrefixes'), array(), '', false, false); $cloneModelMock->expects($this->once())->method('getPrefixes')->will($this->returnValue(array())); $groupMock = $this->getMock('Mage_Backend_Model_Config_Structure_Element_Group', array(), array(), '', false, false); $groupMock->expects($this->once())->method('getFrontendModel')->will($this->returnValue(false)); $groupMock->expects($this->any())->method('getPath')->will($this->returnValue('section_id_group_id')); $groupMock->expects($this->once())->method('getLabel')->will($this->returnValue('label')); $groupMock->expects($this->once())->method('getComment')->will($this->returnValue('comment')); $groupMock->expects($this->once())->method('isExpanded')->will($this->returnValue(false)); $groupMock->expects($this->once())->method('populateFieldset'); $groupMock->expects($this->once())->method('shouldCloneFields')->will($this->returnValue(true)); $groupMock->expects($this->once())->method('getCloneModel')->will($this->returnValue($cloneModelMock)); $groupMock->expects($this->once())->method('getDependencies')->with('store_code')->will($this->returnValue(array())); $sectionMock = $this->getMock('Mage_Backend_Model_Config_Structure_Element_Section', array(), array(), '', false, false); $sectionMock->expects($this->once())->method('isVisible')->will($this->returnValue(true)); $sectionMock->expects($this->once())->method('getChildren')->will($this->returnValue(array($groupMock))); $this->_systemConfigMock->expects($this->once())->method('getElement')->with('section_code')->will($this->returnValue($sectionMock)); $formFieldsetMock = $this->getMock('Varien_Data_Form_Element_Fieldset', array(), array(), '', false, false); $params = array('legend' => 'label', 'comment' => 'comment', 'expanded' => false); $this->_formMock->expects($this->once())->method('addFieldset')->with('section_id_group_id', $params)->will($this->returnValue($formFieldsetMock)); $this->_object->initForm(); }