Skip to content

Commit

Permalink
Add PHP test for nullish multi-currency widget instance
Browse files Browse the repository at this point in the history
  • Loading branch information
cesarcosta99 committed Feb 3, 2025
1 parent 589e1cb commit 935e7b0
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions tests/unit/multi-currency/test-class-multi-currency.php
Original file line number Diff line number Diff line change
Expand Up @@ -927,6 +927,18 @@ public function test_get_switcher_widget_markup() {
$this->assertEquals( $expected, $this->multi_currency->get_switcher_widget_markup() );
}

public function test_get_switcher_widget_markup_when_widget_instance_is_null() {
$mock_multi_currency = $this
->getMockBuilder( WCPay\MultiCurrency\MultiCurrency::class )
->disableOriginalConstructor()
->onlyMethods( [ 'get_currency_switcher_widget' ] )
->getMock();

$mock_multi_currency->method( 'get_currency_switcher_widget' )->willReturn( null );

$this->assertEquals( '', $mock_multi_currency->get_switcher_widget_markup() );
}

public function test_validate_currency_code_returns_existing_currency_code() {
$this->assertEquals( 'CAD', $this->multi_currency->validate_currency_code( 'CAD' ) );
$this->assertEquals( 'CAD', $this->multi_currency->validate_currency_code( 'cAd' ) );
Expand Down

0 comments on commit 935e7b0

Please sign in to comment.