This repository has been archived by the owner on Feb 2, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added currency and currencyLocale support
- Loading branch information
1 parent
738320c
commit d2b85e9
Showing
4 changed files
with
100 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?php | ||
|
||
namespace Laravel\Cashier\Tests; | ||
|
||
use Laravel\Cashier\Cashier; | ||
use Laravel\Cashier\CashierServiceProvider; | ||
|
||
class CashierServiceProviderTest extends BaseTestCase | ||
{ | ||
/** @test */ | ||
public function canOptionallySetCurrencyInConfig() | ||
{ | ||
$this->assertEquals('INEXISTENT', config('cashier.currency', 'INEXISTENT')); | ||
|
||
$this->assertEquals('€', Cashier::usesCurrencySymbol()); | ||
$this->assertEquals('eur', Cashier::usesCurrency()); | ||
|
||
config(['cashier.currency' => 'usd']); | ||
$this->rebootCashierServiceProvider(); | ||
|
||
$this->assertEquals('usd', Cashier::usesCurrency()); | ||
$this->assertEquals('$', Cashier::usesCurrencySymbol()); | ||
} | ||
|
||
/** @test */ | ||
public function canOptionallySetCurrencyLocaleInConfig() | ||
{ | ||
$this->assertEquals('INEXISTENT', config('cashier.currency_locale', 'INEXISTENT')); | ||
$this->assertEquals('de_DE', Cashier::usesCurrencyLocale()); | ||
|
||
config(['cashier.currency_locale' => 'nl_NL']); | ||
$this->rebootCashierServiceProvider(); | ||
|
||
$this->assertEquals('nl_NL', Cashier::usesCurrencyLocale()); | ||
} | ||
|
||
protected function rebootCashierServiceProvider() | ||
{ | ||
tap(new CashierServiceProvider($this->app))->register()->boot(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters