public function testGetDependenciesWithDependencies() { $fields = array('field_4' => array('id' => 'section_2/group_3/field_4', 'value' => 'someValue', 'dependPath' => array('section_2', 'group_3', 'field_4')), 'field_1' => array('id' => 'section_1/group_3/field_1', 'value' => 'someValue', 'dependPath' => array('section_1', 'group_3', 'field_1'))); $this->_model->setData(array('depends' => array('fields' => $fields)), 0); $this->_depMapperMock->expects($this->once())->method('getDependencies')->with($fields, 'test_scope', 'test_prefix')->will($this->returnArgument(0)); $this->assertEquals($fields, $this->_model->getDependencies('test_prefix', 'test_scope')); }
/** * Set correct scope if isSingleStoreMode = true * * @param Mage_Backend_Model_Config_Structure_Element_Field $fieldConfig * @param Mage_Core_Model_Config_Data $dataObject */ protected function _checkSingleStoreMode(Mage_Backend_Model_Config_Structure_Element_Field $fieldConfig, $dataObject) { $isSingleStoreMode = $this->_application->isSingleStoreMode(); if (!$isSingleStoreMode) { return; } if (!$fieldConfig->showInDefault()) { $websites = $this->_application->getWebsites(); $singleStoreWebsite = array_shift($websites); $dataObject->setScope('websites'); $dataObject->setWebsiteCode($singleStoreWebsite->getCode()); $dataObject->setScopeId($singleStoreWebsite->getId()); } }
/** * Retrieve label for scope * * @param Mage_Backend_Model_Config_Structure_Element_Field $field * @return string */ public function getScopeLabel(Mage_Backend_Model_Config_Structure_Element_Field $field) { $showInStore = $field->showInStore(); $showInWebsite = $field->showInWebsite(); if ($showInStore == 1) { return $this->_scopeLabels[self::SCOPE_STORES]; } elseif ($showInWebsite == 1) { return $this->_scopeLabels[self::SCOPE_WEBSITES]; } return $this->_scopeLabels[self::SCOPE_DEFAULT]; }