public function testIsVisibleProceedsWithVisibilityCheckIfSectionIsAllowed() { $this->_authorizationMock->expects($this->any())->method('isAllowed')->will($this->returnValue(true)); $this->_storeManagerMock->expects($this->once())->method('isSingleStoreMode')->will($this->returnValue(true)); $this->_model->setData(['resource' => 'Magento_Backend::all'], 'scope'); $this->_model->isVisible(); }
/** * @covers \Magento\Config\Block\System\Config\Form::initFields * @param string $fieldId uses the test_field_use_config field if true * @param bool $isConfigDataEmpty if the config data array should be empty or not * @param string $configDataValue Value that the field path should be set to in the config data * @param int $valueSelCtr Number of time that value is selected * @dataProvider initFieldsUseConfigPathDataProvider * @magentoConfigFixture default/test_config_section/test_group_config_node/test_field_value config value */ public function testInitFieldsUseConfigPath($fieldId, $isConfigDataEmpty, $configDataValue, $valueSelCtr = 1) { $this->_setupFieldsInheritCheckbox($fieldId, $isConfigDataEmpty, $configDataValue); \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\\Framework\\Config\\ScopeInterface')->setCurrentScope(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE); $form = $this->_formFactory->create(); $fieldset = $form->addFieldset($this->_section->getId() . '_' . $this->_group->getId(), []); /* @TODO Eliminate stub by proper mock / config fixture usage */ /** @var $block \Magento\Config\Block\System\Config\FormStub */ $block = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\\Framework\\View\\LayoutInterface')->createBlock('Magento\\Config\\Block\\System\\Config\\FormStub'); $block->setScope(\Magento\Config\Block\System\Config\Form::SCOPE_DEFAULT); $block->setStubConfigData($this->_configData); $block->initFields($fieldset, $this->_group, $this->_section); $fieldsetSel = 'fieldset'; $valueSel = sprintf('input#%s_%s_%s', $this->_section->getId(), $this->_group->getId(), $this->_field->getId()); $fieldsetHtml = $fieldset->getElementHtml(); $this->assertSelectCount($fieldsetSel, true, $fieldsetHtml, 'Fieldset HTML is invalid'); $this->assertSelectCount($valueSel, $valueSelCtr, $fieldsetHtml, 'Field input should appear ' . $valueSelCtr . ' times in fieldset HTML'); }
/** * Check whether section should be displayed as active * * @param \Magento\Config\Model\Config\Structure\Element\Section $section * @return bool */ public function isSectionActive(\Magento\Config\Model\Config\Structure\Element\Section $section) { return $section->getId() == $this->_currentSectionId; }
/** * 2016-08-02 * @param Section $section * @return Phrase */ function df_config_tab_label(Section $section) { return DfStructure::tab($section->getData()['tab'], 'label'); }
/** * Section constructor. * * @param StoreManagerInterface $storeManager The store manager * @param Manager $moduleManager The module manager * @param Iterator $childrenIterator The children iterator * @param AuthorizationInterface $authorization The authorization manager * @param SectionVisibility $visibility The visibility manager */ public function __construct(StoreManagerInterface $storeManager, Manager $moduleManager, Iterator $childrenIterator, AuthorizationInterface $authorization, SectionVisibility $visibility) { parent::__construct($storeManager, $moduleManager, $childrenIterator, $authorization); $this->visibility = $visibility; }