Skip to content

Commit

Permalink
MAGETWO-36930: [GITHUB] Store config re-encrypt encrypted values on s…
Browse files Browse the repository at this point in the history
…ave #1223

- Fixed Unit test
  • Loading branch information
anupdugar committed May 6, 2015
1 parent 305bf94 commit 968fbef
Showing 1 changed file with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -88,24 +88,30 @@ public function testProcessValue()
* @dataProvider beforeSaveDataProvider
*
* @param $value
* @param $valueToSave
* @param $expectedValue
* @param $encryptMethodCall
*/
public function testBeforeSave($value, $encryptMethodCall)
public function testBeforeSave($value, $expectedValue, $encryptMethodCall)
{
$this->_resourceMock->expects($this->any())->method('addCommitCallback')->will($this->returnSelf());
$this->_resourceMock->expects($this->any())->method('commit')->will($this->returnSelf());
$this->_encryptorMock->expects($this->exactly($encryptMethodCall))
->method('encrypt')
->with($value)
->will($this->returnValue('encrypted'));

$this->_model->setValue($value);
$this->_model->setPath('some/path');
$this->_model->beforeSave();
$this->_encryptorMock->expects($this->exactly($encryptMethodCall))->method('encrypt')->with($this->any());

$this->assertEquals($expectedValue, $this->_model->getValue());
}

/**
* @return array
*/
public function beforeSaveDataProvider()
{
return [['someValue', 1], ['****', 0]];
return [['someValue', 'encrypted', 1], ['****', '****', 0]];
}
}

0 comments on commit 968fbef

Please sign in to comment.