Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
CredentialStoreTest.php
Go to the documentation of this file.
1 <?php
8 
11 use AspectMock\Test as AspectMock;
12 
14 {
15 
19  public function testBasicEncryptDecrypt()
20  {
21  $testKey = 'myKey';
22  $testValue = 'myValue';
23 
24  AspectMock::double(CredentialStore::class, [
25  'readInCredentialsFile' => ["$testKey=$testValue"]
26  ]);
27 
28  $encryptedCred = CredentialStore::getInstance()->getSecret($testKey);
29 
30  // assert the value we've gotten is in fact not identical to our test value
31  $this->assertNotEquals($testValue, $encryptedCred);
32 
33  $actualValue = CredentialStore::getInstance()->decryptSecretValue($encryptedCred);
34 
35  // assert that we are able to successfully decrypt our secret value
36  $this->assertEquals($testValue, $actualValue);
37  }
38 }