Skip to content

Commit

Permalink
Merge pull request #200 from sandervanhooft/allow_apikey_empty
Browse files Browse the repository at this point in the history
Allow empty mollie key
  • Loading branch information
sandervanhooft authored Sep 13, 2022
2 parents a0e10d8 + eecc53b commit d7d0587
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Wrappers/MollieApiWrapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,11 @@ public function __construct(Repository $config, MollieApiClient $client)
$this->config = $config;
$this->client = $client;

$this->setApiKey($this->config->get('mollie.key'));
$key = $this->config->get('mollie.key');

if(! empty($key)) {
$this->setApiKey($key);
}
}

/**
Expand Down
9 changes: 9 additions & 0 deletions tests/Wrappers/MollieApiWrapperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,15 @@ public function testSetBadApiKey()
$wrapper->setApiKey('live_');
}

public function testDoesNotSetKeyWhenEmpty()
{
config(['mollie.key' => '']);
$this->assertEmpty($this->app['config']['mollie']['key']);
$this->api->expects($this->never())->method('setApiKey');

$wrapper = new MollieApiWrapper($this->app['config'], $this->api);
}

public function testSetGoodToken()
{
$this->api->expects($this->once())->method('setAccessToken')->with('access_xxx');
Expand Down

0 comments on commit d7d0587

Please sign in to comment.