Exemplo n.º 1
0
 /**
  * @return void
  * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
  */
 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('Magento\\Backend\\Block\\System\\Config\\Form\\Fieldset', [], [], '', false, false);
     $this->_fieldsetFactoryMock->expects($this->once())->method('create')->will($this->returnValue($fieldsetRendererMock));
     $cloneModelMock = $this->getMock('Magento\\Backend\\Model\\Config', ['getPrefixes'], [], '', false, false);
     $cloneModelMock->expects($this->once())->method('getPrefixes')->will($this->returnValue([]));
     $groupMock = $this->getMock('Magento\\Backend\\Model\\Config\\Structure\\Element\\Group', [], [], '', 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('getData')->will($this->returnValue('some group data'));
     $groupMock->expects($this->once())->method('getDependencies')->with('store_code')->will($this->returnValue([]));
     $sectionMock = $this->getMock('Magento\\Backend\\Model\\Config\\Structure\\Element\\Section', [], [], '', false, false);
     $sectionMock->expects($this->once())->method('isVisible')->will($this->returnValue(true));
     $sectionMock->expects($this->once())->method('getChildren')->will($this->returnValue([$groupMock]));
     $this->_systemConfigMock->expects($this->once())->method('getElement')->with('section_code')->will($this->returnValue($sectionMock));
     $formFieldsetMock = $this->getMock('Magento\\Framework\\Data\\Form\\Element\\Fieldset', [], [], '', false, false);
     $params = ['legend' => 'label', 'comment' => 'comment', 'expanded' => false, 'group' => 'some group data'];
     $this->_formMock->expects($this->once())->method('addFieldset')->with('section_id_group_id', $params)->will($this->returnValue($formFieldsetMock));
     $this->_object->initForm();
 }