6 declare(strict_types=1);
11 use \Magento\Config\Model\Config\Structure\ElementVisibility\ConcealInProduction;
12 use \Magento\Config\Model\Config\Structure\ElementVisibility\ConcealInProductionFactory;
22 private $concealInProductionMock;
32 private $deploymentConfigMock;
36 $concealInProductionFactoryMock = $this->createMock(ConcealInProductionFactory::class);
38 $this->concealInProductionMock = $this->createMock(ConcealInProduction::class);
40 $this->deploymentConfigMock = $this->createMock(\
Magento\Framework\
App\DeploymentConfig::class);
46 'section1/group2' =>
'no',
50 'section3/group1/field1' =>
'no',
53 'section1/group1/field3' =>
'',
54 'section1/group2/field1' =>
'',
55 'section2/group2/field1' =>
'',
56 'section3/group2' =>
'',
59 $concealInProductionFactoryMock->expects($this->any())
61 ->with([
'configs' => $configs,
'exemptions' => $exemptions])
62 ->willReturn($this->concealInProductionMock);
65 $concealInProductionFactoryMock,
66 $this->deploymentConfigMock,
74 $path =
'section1/group1/field1';
75 $this->deploymentConfigMock->expects($this->once())
76 ->method(
'getConfigData')
77 ->with(Constants::CONFIG_PATH_SCD_ON_DEMAND_IN_PRODUCTION)
79 $this->concealInProductionMock->expects($this->never())
82 $this->assertFalse($this->model->isHidden(
$path));
87 $path =
'section1/group1/field1';
88 $this->deploymentConfigMock->expects($this->once())
89 ->method(
'getConfigData')
90 ->with(Constants::CONFIG_PATH_SCD_ON_DEMAND_IN_PRODUCTION)
92 $this->concealInProductionMock->expects($this->never())
93 ->method(
'isDisabled');
95 $this->assertFalse($this->model->isDisabled(
$path));
105 $path =
'section1/group1/field1';
106 $this->deploymentConfigMock->expects($this->once())
107 ->method(
'getConfigData')
108 ->with(Constants::CONFIG_PATH_SCD_ON_DEMAND_IN_PRODUCTION)
110 $this->concealInProductionMock->expects($this->once())
113 ->willReturn($isHidden);
115 $this->assertSame($isHidden, $this->model->isHidden(
$path));
125 $path =
'section1/group1/field1';
126 $this->deploymentConfigMock->expects($this->once())
127 ->method(
'getConfigData')
128 ->with(Constants::CONFIG_PATH_SCD_ON_DEMAND_IN_PRODUCTION)
130 $this->concealInProductionMock->expects($this->once())
131 ->method(
'isDisabled')
133 ->willReturn($isDisabled);
135 $this->assertSame($isDisabled, $this->model->isDisabled(
$path));
testIsDisabledScdOnDemandDisabled(bool $isDisabled)
testIsHiddenScdOnDemandDisabled(bool $isHidden)
testIsDisabledScdOnDemandEnabled()
testIsHiddenScdOnDemandEnabled()