Skip to content

Commit

Permalink
Merge pull request #48 from 10n/patch-1
Browse files Browse the repository at this point in the history
Revert BC break - allow `array` structures for private keys, rather than just `string`
  • Loading branch information
Ocramius authored Apr 7, 2022
2 parents 05d2c0e + 63af12f commit ab1a1a0
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/ConfigTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@

trait ConfigTrait
{
protected function getPrivateKey(ContainerInterface $container): string
/** @return non-empty-string|non-empty-array */
protected function getPrivateKey(ContainerInterface $container)
{
$config = $container->get('config')['authentication'] ?? [];

Expand Down
20 changes: 20 additions & 0 deletions test/ConfigTraitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,26 @@ public function testGetPrivateKey()
$this->assertEquals($this->config['authentication']['private_key'], $result);
}

public function testGetPrivateKeyArray()
{
$config = [
'authentication' => [
'private_key' => [
'key_or_path' => 'xxx',
'pass_phrase' => 'test',
'key_permissions_check' => false,
],
],
];

$this->container
->get('config')
->willReturn($config);

$result = $this->trait->proxy('getPrivateKey', $this->container->reveal());
$this->assertEquals($config['authentication']['private_key'], $result);
}

public function testGetEncryptionKeyNoConfig()
{
$this->container
Expand Down

0 comments on commit ab1a1a0

Please sign in to comment.