本文整理匯總了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);
}