Skip to content

Commit

Permalink
Fix Unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaelzaleski committed Jul 17, 2024
1 parent 87874a6 commit 0e21d8f
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ public function set_up() {
->setMethods(
[
'is_checkout',
'should_show_express_checkout_button'
]
)
->getMock();
Expand Down Expand Up @@ -233,8 +234,8 @@ public function test_display_express_checkout_buttons_all_enabled() {
->method( 'should_show_woopay_button' )
->willReturn( true );

$this->mock_payment_request_button_handler
->method( 'should_show_payment_request_button' )
$this->mock_express_checkout_helper
->method( 'should_show_express_checkout_button' )
->willReturn( true );

$this->mock_express_checkout_helper
Expand All @@ -244,8 +245,10 @@ public function test_display_express_checkout_buttons_all_enabled() {
ob_start();
$this->express_checkout_button_display_handler->display_express_checkout_buttons();

var_dump( ob_get_contents() );

$this->assertStringContainsString( 'wcpay-woopay-button', ob_get_contents() );
$this->assertStringContainsString( 'wcpay-payment-request-button', ob_get_contents() );
$this->assertStringContainsString( 'wcpay-express-checkout-element', ob_get_contents() );
$this->assertStringNotContainsString( 'wcpay-payment-request-button-separator', ob_get_contents() );
ob_end_clean();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ public function test_common_get_button_settings() {
'type' => 'buy',
'theme' => 'dark',
'height' => '48',
'radius' => ''
],
$this->mock_express_checkout_helper->get_common_button_settings()
);
Expand Down
1 change: 1 addition & 0 deletions tests/unit/test-class-wc-payments-features.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ class WC_Payments_Features_Test extends WCPAY_UnitTestCase {
'_wcpay_feature_customer_multi_currency' => 'multiCurrency',
'_wcpay_feature_documents' => 'documents',
'_wcpay_feature_auth_and_capture' => 'isAuthAndCaptureEnabled',
'_wcpay_feature_stripe_ece' => 'isStripeEceEnabled'
];

public function set_up() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -820,6 +820,7 @@ public function test_get_button_settings() {
'height' => '48',
'locale' => 'en',
'branded_type' => 'long',
'radius' => ''
],
$this->pr->get_button_settings()
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -511,6 +511,7 @@ public function test_get_button_settings() {
'height' => '48',
'size' => 'medium',
'context' => 'product',
'radius' => ''
],
$this->mock_pr->get_button_settings()
);
Expand Down

0 comments on commit 0e21d8f

Please sign in to comment.