Skip to content

Commit 86ffe50

Browse files
author
Yevhen Miroshnychenko
committed
MAGETWO-64556: Configuration management - Hide sensitive values from config:show command
1 parent f4c11d5 commit 86ffe50

File tree

2 files changed

+38
-7
lines changed

2 files changed

+38
-7
lines changed

app/code/Magento/Config/Console/Command/ConfigShow/ValueProcessor.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@ class ValueProcessor
2121
{
2222
/**
2323
* Placeholder for the output of sensitive data.
24-
*
25-
* @const
2624
*/
2725
const SAFE_PLACEHOLDER = '******';
2826

app/code/Magento/Config/Test/Unit/Console/Command/ConfigShow/ValueProcessorTest.php

Lines changed: 38 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ protected function setUp()
7373
* @param \PHPUnit_Framework_MockObject_Matcher_InvokedCount $expectsAfterLoad
7474
* @param string $expectsValue
7575
* @param string $className
76+
* @param string $value
7677
* @dataProvider processDataProvider
7778
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
7879
*/
@@ -87,11 +88,12 @@ public function testProcess(
8788
$expectsSetValue,
8889
$expectsAfterLoad,
8990
$expectsValue,
90-
$className
91-
) {
91+
$className,
92+
$value
93+
)
94+
{
9295
$scope = 'someScope';
9396
$scopeCode = 'someScopeCode';
94-
$value = 'someValue';
9597
$path = 'some/config/path';
9698
$oldConfigScope = 'oldConfigScope';
9799

@@ -165,6 +167,7 @@ public function testProcess(
165167

166168
/**
167169
* @return array
170+
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
168171
*/
169172
public function processDataProvider()
170173
{
@@ -181,7 +184,7 @@ public function processDataProvider()
181184
'expectsAfterLoad' => $this->once(),
182185
'expectsValue' => 'someValue',
183186
'className' => Value::class,
184-
187+
'value' => 'someValue'
185188
],
186189
[
187190
'hasBackendModel' => false,
@@ -194,7 +197,8 @@ public function processDataProvider()
194197
'expectsSetValue' => $this->once(),
195198
'expectsAfterLoad' => $this->once(),
196199
'expectsValue' => 'someValue',
197-
'className' => Value::class
200+
'className' => Value::class,
201+
'value' => 'someValue'
198202
],
199203
[
200204
'hasBackendModel' => true,
@@ -208,6 +212,35 @@ public function processDataProvider()
208212
'expectsAfterLoad' => $this->never(),
209213
'expectsValue' => ValueProcessor::SAFE_PLACEHOLDER,
210214
'className' => Encrypted::class,
215+
'value' => 'someValue'
216+
],
217+
[
218+
'hasBackendModel' => true,
219+
'expectsGetBackendModel' => $this->once(),
220+
'expectsCreate' => $this->never(),
221+
'expectsGetValue' => $this->once(),
222+
'expectsSetPath' => $this->once(),
223+
'expectsSetScope' => $this->once(),
224+
'expectsSetScopeId' => $this->once(),
225+
'expectsSetValue' => $this->once(),
226+
'expectsAfterLoad' => $this->once(),
227+
'expectsValue' => null,
228+
'className' => Value::class,
229+
'value' => null
230+
],
231+
[
232+
'hasBackendModel' => true,
233+
'expectsGetBackendModel' => $this->once(),
234+
'expectsCreate' => $this->never(),
235+
'expectsGetValue' => $this->never(),
236+
'expectsSetPath' => $this->never(),
237+
'expectsSetScope' => $this->never(),
238+
'expectsSetScopeId' => $this->never(),
239+
'expectsSetValue' => $this->never(),
240+
'expectsAfterLoad' => $this->never(),
241+
'expectsValue' => null,
242+
'className' => Encrypted::class,
243+
'value' => null
211244
],
212245
];
213246
}

0 commit comments

Comments
 (0)