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