當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Crypt::shouldReceive方法代碼示例

本文整理匯總了PHP中Crypt::shouldReceive方法的典型用法代碼示例。如果您正苦於以下問題:PHP Crypt::shouldReceive方法的具體用法?PHP Crypt::shouldReceive怎麽用?PHP Crypt::shouldReceive使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Crypt的用法示例。


在下文中一共展示了Crypt::shouldReceive方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: testDecrypt

 public function testDecrypt()
 {
     $encrypted_key = 'hu8gZ19fINO3HrPUQkHgqdZ5qaLcKFg4kRgUISFOhQWiAWVYbyo53gE6JQ61gZ64tvclc0RtVghPZCGLvQSJvmQxFwdxzXF7mqvJdepFXhIdwJ6PMIE701kGmdjNoSoXFiOACb73c70DZQmzLA4sVulwcTtJcMWsRgpiC4PayrNWun9x0bWsvsDNNZ2YPZL8yf0paeyfLPsMONfqakSUrJfprYFtjbEkWcgx0hluvZpHj3Nl6AU3TFBJS6b8qFrp99qVsS7wBKAUNSUrDBzGjYNy';
     $decrypted_key = 'FOGdGgtmjWZufLyyCe91QG1njTKrylvn8wv0RaLmoCd7sEhDKAjJ6iHGXJPRrfdm2Mtw2nlpBjbukKBU';
     $credentials_param = Parameter::make(['id' => 'cloud_credentials', 'sensitive' => true, 'value' => ['access_key' => 'test-key', 'secret_key' => $encrypted_key]]);
     $params = ParametersCollection::make(['StackName' => 'test-stack', 'cloud_credentials' => $credentials_param]);
     $unencrypted_values = ['test-stack', 'cloud_credentials', true, 'test-key'];
     foreach ($unencrypted_values as $value) {
         Crypt::shouldReceive('decrypt')->once()->with($value)->andThrow(new \Illuminate\Contracts\Encryption\DecryptException('Invalid data.'));
     }
     Crypt::shouldReceive('decrypt')->once()->with($encrypted_key)->andReturn($decrypted_key);
     $decrypted_params = $params->decrypted()->toArray();
     $this->assertEquals(array_get($decrypted_params, 'cloud_credentials.value.secret_key'), $decrypted_key);
 }
開發者ID:sourcestream,項目名稱:highcore-api,代碼行數:14,代碼來源:ParametersCollectionTest.php


注:本文中的Crypt::shouldReceive方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。