Skip to content

Commit 968fbef

Browse files
committed
MAGETWO-36930: [GITHUB] Store config re-encrypt encrypted values on save #1223
- Fixed Unit test
1 parent 305bf94 commit 968fbef

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

app/code/Magento/Config/Test/Unit/Model/Config/Backend/EncryptedTest.php

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,24 +88,30 @@ public function testProcessValue()
8888
* @dataProvider beforeSaveDataProvider
8989
*
9090
* @param $value
91-
* @param $valueToSave
91+
* @param $expectedValue
92+
* @param $encryptMethodCall
9293
*/
93-
public function testBeforeSave($value, $encryptMethodCall)
94+
public function testBeforeSave($value, $expectedValue, $encryptMethodCall)
9495
{
9596
$this->_resourceMock->expects($this->any())->method('addCommitCallback')->will($this->returnSelf());
9697
$this->_resourceMock->expects($this->any())->method('commit')->will($this->returnSelf());
98+
$this->_encryptorMock->expects($this->exactly($encryptMethodCall))
99+
->method('encrypt')
100+
->with($value)
101+
->will($this->returnValue('encrypted'));
97102

98103
$this->_model->setValue($value);
99104
$this->_model->setPath('some/path');
100105
$this->_model->beforeSave();
101-
$this->_encryptorMock->expects($this->exactly($encryptMethodCall))->method('encrypt')->with($this->any());
106+
107+
$this->assertEquals($expectedValue, $this->_model->getValue());
102108
}
103109

104110
/**
105111
* @return array
106112
*/
107113
public function beforeSaveDataProvider()
108114
{
109-
return [['someValue', 1], ['****', 0]];
115+
return [['someValue', 'encrypted', 1], ['****', '****', 0]];
110116
}
111117
}

0 commit comments

Comments
 (0)