mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-05 08:59:14 +08:00
Do not remove mini-cart location for pay later
This commit is contained in:
parent
8c1af84204
commit
2adc0d57e1
4 changed files with 105 additions and 17 deletions
60
tests/PHPUnit/WcGateway/Settings/LocationsTest.php
Normal file
60
tests/PHPUnit/WcGateway/Settings/LocationsTest.php
Normal file
|
@ -0,0 +1,60 @@
|
|||
<?php
|
||||
|
||||
namespace WooCommerce\PayPalCommerce\WcGateway\Settings;
|
||||
|
||||
use WooCommerce\PayPalCommerce\Helper\SettingsStub;
|
||||
use WooCommerce\PayPalCommerce\ModularTestCase;
|
||||
|
||||
class LocationsTest extends ModularTestCase
|
||||
{
|
||||
private $appContainer;
|
||||
|
||||
private $settings;
|
||||
|
||||
public function setUp(): void {
|
||||
parent::setUp();
|
||||
|
||||
$this->settings = new SettingsStub([]);
|
||||
|
||||
$this->appContainer = $this->bootstrapModule([
|
||||
'wcgateway.settings' => function () {
|
||||
return $this->settings;
|
||||
},
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider payLaterButtonLocationsData
|
||||
*/
|
||||
public function testPayLaterButtonLocations(array $selectedLocations, array $expectedResult) {
|
||||
$this->settings->set('smart_button_locations', $selectedLocations);
|
||||
|
||||
$result = $this->appContainer->get('wcgateway.settings.pay-later.button-locations');
|
||||
|
||||
self::assertEquals($expectedResult, $result);
|
||||
}
|
||||
|
||||
public function payLaterButtonLocationsData()
|
||||
{
|
||||
yield [
|
||||
['product', 'cart', 'checkout', 'mini-cart'],
|
||||
[
|
||||
'product' => 'Single Product',
|
||||
'cart' => 'Cart',
|
||||
'checkout' => 'Checkout',
|
||||
'mini-cart' => 'Mini Cart',
|
||||
],
|
||||
];
|
||||
yield [
|
||||
['cart', 'checkout'],
|
||||
[
|
||||
'cart' => 'Cart',
|
||||
'checkout' => 'Checkout',
|
||||
],
|
||||
];
|
||||
yield [
|
||||
[],
|
||||
[],
|
||||
];
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue