From 968fbefc7f48711f5142044e816822c6c020039f Mon Sep 17 00:00:00 2001 From: Anup Dugar Date: Wed, 6 May 2015 08:12:03 -0500 Subject: [PATCH] MAGETWO-36930: [GITHUB] Store config re-encrypt encrypted values on save #1223 - Fixed Unit test --- .../Unit/Model/Config/Backend/EncryptedTest.php | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/app/code/Magento/Config/Test/Unit/Model/Config/Backend/EncryptedTest.php b/app/code/Magento/Config/Test/Unit/Model/Config/Backend/EncryptedTest.php index f1531003fea7b..ee04a4ec0817f 100644 --- a/app/code/Magento/Config/Test/Unit/Model/Config/Backend/EncryptedTest.php +++ b/app/code/Magento/Config/Test/Unit/Model/Config/Backend/EncryptedTest.php @@ -88,17 +88,23 @@ 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()); } /** @@ -106,6 +112,6 @@ public function testBeforeSave($value, $encryptMethodCall) */ public function beforeSaveDataProvider() { - return [['someValue', 1], ['****', 0]]; + return [['someValue', 'encrypted', 1], ['****', '****', 0]]; } }