diff --git a/tests/unit/multi-currency/test-class-multi-currency.php b/tests/unit/multi-currency/test-class-multi-currency.php index 6c687f866ec..6de7574db51 100644 --- a/tests/unit/multi-currency/test-class-multi-currency.php +++ b/tests/unit/multi-currency/test-class-multi-currency.php @@ -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() ) ); } @@ -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() ); }