public function testSetGetConfig() { /* config operations require store to be loaded */ $this->_model->load('default'); $value = $this->_model->getConfig(Mage_Core_Model_Store::XML_PATH_STORE_IN_URL); $this->_model->setConfig(Mage_Core_Model_Store::XML_PATH_STORE_IN_URL, 'test'); $this->assertEquals('test', $this->_model->getConfig(Mage_Core_Model_Store::XML_PATH_STORE_IN_URL)); $this->_model->setConfig(Mage_Core_Model_Store::XML_PATH_STORE_IN_URL, $value); /* Call set before get */ $this->_model->setConfig(Mage_Core_Model_Store::XML_PATH_USE_REWRITES, 1); $this->assertEquals(1, $this->_model->getConfig(Mage_Core_Model_Store::XML_PATH_USE_REWRITES)); $this->_model->setConfig(Mage_Core_Model_Store::XML_PATH_USE_REWRITES, 0); }
public function testGetConfigCanShowConfig() { $result = ['key1' => 'value1', 'key2' => 'value2']; $store = $this->getMockBuilder('Magento\\Store\\Model\\Store')->disableOriginalConstructor()->getMock(); $store->expects($this->any())->method('getWebsiteId')->will($this->returnValue('1')); $this->scopeConfig->expects($this->once())->method('getValue')->with('customer/address', \Magento\Framework\Store\ScopeInterface::SCOPE_STORE, $store)->will($this->returnValue($result)); $this->storeManager->expects($this->any())->method('getStore')->will($this->returnValue($store)); $this->assertNull($this->helper->getConfig('unavailable_key')); $this->assertFalse($this->helper->canShowConfig('unavailable_key')); $this->assertEquals($result['key1'], $this->helper->getConfig('key1')); $this->assertEquals($result['key2'], $this->helper->getConfig('key2')); $this->assertTrue($this->helper->canShowConfig('key1')); $this->assertTrue($this->helper->canShowConfig('key2')); }
public function testGetConfigWithInvalidKeyReturnsNull() { $this->mage->expects($this->never())->method("getStoreConfig"); $this->assertNull($this->HelperData->getConfig("api", "foo")); }
public function testGetConfig() { $this->assertEquals('1', $this->_model->getConfig('qwe')); }