Exemple #1
0
 /**
  * @param string $path
  * @param mixed $value
  * @dataProvider setValueDataProvider
  */
 public function testSetValue($path, $value)
 {
     $this->_model->setValue($path, $value);
     $this->assertEquals($value, $this->_model->getValue($path));
 }
Exemple #2
0
/**
 * @uses \Magento\Framework\App\Config\Data::getValue()
 * https://github.com/magento/magento2/blob/2335247d4ae2dc1e0728ee73022b0a244ccd7f4c/lib/internal/Magento/Framework/App/Config/Data.php#L47-L62
 *
 * 2015-12-26
 * https://mage2.pro/t/357
 * «The @uses \Magento\Framework\App\Config::getValue() method
 * has a wrong PHPDoc type for the $scopeCode parameter».
 *
 * Метод возвращает null или $default, если данные отсутствуют:
 * @see \Magento\Framework\App\Config\Data::getValue()
 * https://github.com/magento/magento2/blob/6ce74b2/lib/internal/Magento/Framework/App/Config/Data.php#L47-L62
 *
 * 2015-10-09
 * https://mage2.pro/t/128
 * https://github.com/magento/magento2/issues/2064
 *
 * @param string $key
 * @param null|string|int|ScopeA|Store|IConfigData|ConfigData $scope [optional]
 * @param mixed|callable $default [optional]
 * @return array|string|null|mixed
 */
function df_cfg($key, $scope = null, $default = null)
{
    /** @var array|string|null|mixed $result */
    $result = $scope instanceof IConfigData ? $scope->getValue($key) : df_cfg_m()->getValue($key, ScopeS::SCOPE_STORE, $scope);
    return df_if(df_cfg_empty($result), $default, $result);
}