Skip to content

Commit

Permalink
Merge pull request #11 from florianv/turkey
Browse files Browse the repository at this point in the history
Added the Central Bank of the Republic of Turkey provider
  • Loading branch information
florianv committed Apr 3, 2016
2 parents 1170db4 + 63d4df9 commit e4b0ef5
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
@@ -1,3 +1,4 @@
composer.lock
phpunit.xml
vendor
bin/
2 changes: 1 addition & 1 deletion composer.json
Expand Up @@ -34,7 +34,7 @@
"illuminate/contracts": "~5.0",
"illuminate/support": "~5.0",
"illuminate/view": "~5.0",
"florianv/swap": "~2.1"
"florianv/swap": "~2.4"
},
"require-dev": {
"graham-campbell/testbench": "~2.1"
Expand Down
4 changes: 4 additions & 0 deletions src/SwapServiceProvider.php
Expand Up @@ -15,6 +15,7 @@
use Illuminate\Contracts\Foundation\Application;
use Illuminate\Support\ServiceProvider;
use Swap\Cache\IlluminateCache;
use Swap\Provider\CentralBankOfRepublicTurkeyProvider;
use Swap\Provider\ChainProvider;
use Swap\Provider\EuropeanCentralBankProvider;
use Swap\Provider\GoogleFinanceProvider;
Expand Down Expand Up @@ -123,6 +124,9 @@ private function registerProvider(Application $app)
$providerConfig['token']
);
break;
case 'central_bank_of_republic_turkey':
$providers[] = new CentralBankOfRepublicTurkeyProvider($app['swap.http_adapter']);
break;
default:
throw new \RuntimeException(sprintf('Unknown provider with name "%s".', $providerName));
}
Expand Down
12 changes: 10 additions & 2 deletions tests/SwapServiceProviderTest.php
Expand Up @@ -89,14 +89,22 @@ public function testDefaultProvider()
$this->assertInstanceOf('Swap\Provider\ChainProvider', $this->app['swap.provider']);
}

public function testMultipleProviders()
public function testAllProviders()
{
$this->app->config->set('swap.providers', [
'yahoo_finance' => true,
'google_finance' => true,
'european_central_bank' => true,
'national_bank_of_romania' => true,
'webservicex' => true,
'open_exchange_rates' => [
'app_id' => 'foo',
'enterprise' => true,
]
],
'xignite' => [
'token' => 'bar'
],
'central_bank_of_republic_turkey' => true
]);

$this->assertInstanceOf('Swap\Provider\ChainProvider', $this->app['swap.provider']);
Expand Down

0 comments on commit e4b0ef5

Please sign in to comment.