Skip to content

Commit

Permalink
Additional test for multi-currency, clean up of other tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
jessepearson committed Jun 8, 2021
1 parent 4b75cad commit b9a7c71
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions tests/unit/multi-currency/test-class-multi-currency.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,10 +133,6 @@ public function test_get_enabled_currencies_returns_correctly() {
]
);

// Recreate Multi_Currency instance to use the recently set currencies.
$this->reset_multi_currency_instance();
$this->multi_currency = WCPay\Multi_Currency\Multi_Currency::instance();

$this->assertSame( $expected, wp_json_encode( $this->multi_currency->get_enabled_currencies() ) );
}

Expand All @@ -146,6 +142,16 @@ public function test_set_enabled_currencies() {
$this->assertSame( $currencies, get_option( 'wcpay_multi_currency_enabled_currencies' ) );
}

public function test_enabled_but_unavailable_currencies_are_skipped() {
update_option( 'wcpay_multi_currency_enabled_currencies', [ 'RANDOM_CURRENCY', 'USD' ] );

// Recreate Multi_Currency instance to use the recently set currencies.
$this->reset_multi_currency_instance();
$this->multi_currency = WCPay\Multi_Currency\Multi_Currency::instance();

$this->assertSame( [ 'USD' ], array_keys( $this->multi_currency->get_enabled_currencies() ) );
}

public function test_get_selected_currency_returns_default_currency_for_empty_session_and_user() {
$this->assertSame( get_woocommerce_currency(), $this->multi_currency->get_selected_currency()->get_code() );
}
Expand Down

0 comments on commit b9a7c71

Please sign in to comment.