Skip to content

Commit

Permalink
Adding specific unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
wjrosa committed Nov 29, 2024
1 parent 0b3d3f4 commit 8ffc3e3
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions tests/phpunit/test-wc-stripe-express-checkout-element.php
Original file line number Diff line number Diff line change
Expand Up @@ -362,4 +362,26 @@ public function provide_test_display_express_checkout_button_separator_html() {
],
];
}

/**
* Test for `add_order_attribution_data`.
*
* @return void
*/
public function test_add_order_attribution_data() {
$ajax_handler = $this->getMockBuilder( WC_Stripe_Express_Checkout_Ajax_Handler::class )
->disableOriginalConstructor()
->getMock();

$helper = $this->getMockBuilder( WC_Stripe_Express_Checkout_Helper::class )
->disableOriginalConstructor()
->getMock();

$element = new WC_Stripe_Express_Checkout_Element( $ajax_handler, $helper );

ob_start();
$element->add_order_attribution_inputs();
$output = ob_get_clean();
$this->assertStringMatchesFormat( '%aid="wc-stripe-express-checkout__order-attribution-inputs"%a', $output );
}
}

0 comments on commit 8ffc3e3

Please sign in to comment.