Skip to content
This repository was archived by the owner on Mar 14, 2024. It is now read-only.

Commit fb418b9

Browse files
committed
Add test for default parameter of helper function
1 parent e1ce653 commit fb418b9

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

tests/CredentialTest.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,22 @@ public function it_can_use_the_helper_function()
124124
$this->assertSame('my-secret-value', credentials('key'));
125125
}
126126

127+
/** @test */
128+
public function it_can_give_a_default_to_the_helper_function()
129+
{
130+
$this->app['config']->set('credentials.file', __DIR__ . '/temp/credentials.php.enc');
131+
132+
$data = [
133+
'key' => 'my-secret-value'
134+
];
135+
136+
$credentials = app(Credentials::class);
137+
138+
$credentials->store($data, __DIR__ . '/temp/credentials.php.enc');
139+
140+
$this->assertSame('my-fallback-value', credentials('wrong-key', 'my-fallback-value'));
141+
}
142+
127143
/** @test */
128144
public function it_replaces_credential_strings_in_the_configuration_files()
129145
{

0 commit comments

Comments
 (0)