Пример #1
0
 /**
  * Retrieve field dependencies
  *
  * @param string $fieldPrefix
  * @param string $storeCode
  * @return array
  */
 public function getDependencies($fieldPrefix, $storeCode)
 {
     $dependencies = [];
     if (false == isset($this->_data['depends']['fields'])) {
         return $dependencies;
     }
     $dependencies = $this->_dependencyMapper->getDependencies($this->_data['depends']['fields'], $storeCode, $fieldPrefix);
     return $dependencies;
 }
Пример #2
0
 public function testGetDependenciesIsVisible()
 {
     $expected = [];
     $rowData = array_values($this->_testData);
     for ($i = 0; $i < count($this->_testData); ++$i) {
         $data = $rowData[$i];
         $field = $this->_getField(true, 'some path', 'Magento_Backend_Model_Config_Structure_Element_Field_visible_' . $i);
         $this->_configStructureMock->expects($this->at($i))->method('getElement')->with($data['id'])->will($this->returnValue($field));
         $dependencyField = $this->_getDependencyField((bool) $i, true, $data['id'], 'Magento_Backend_Model_Config_Structure_Element_Dependency_Field_visible_' . $i);
         $this->_fieldFactoryMock->expects($this->at($i))->method('create')->with(['fieldData' => $data, 'fieldPrefix' => self::FIELD_PREFIX])->will($this->returnValue($dependencyField));
         $expected[$data['id']] = $dependencyField;
     }
     $actual = $this->_model->getDependencies($this->_testData, self::STORE_CODE, self::FIELD_PREFIX);
     $this->assertEquals($expected, $actual);
 }