diff --git a/modules.local/ppcp-button/src/Assets/SmartButton.php b/modules.local/ppcp-button/src/Assets/SmartButton.php index 1c1adea39..9d317791d 100644 --- a/modules.local/ppcp-button/src/Assets/SmartButton.php +++ b/modules.local/ppcp-button/src/Assets/SmartButton.php @@ -285,14 +285,12 @@ class SmartButton implements SmartButtonInterface 'url' => $this->url(), 'mini_cart_style' => [ 'layout' => $this->styleForContext('layout', 'mini-cart'), - 'size' => $this->styleForContext('size', 'mini-cart'), 'color' => $this->styleForContext('color', 'mini-cart'), 'shape' => $this->styleForContext('shape', 'mini-cart'), 'label' => $this->styleForContext('label', 'mini-cart'), ], 'style' => [ 'layout' => $this->styleForContext('layout', $this->context()), - 'size' => $this->styleForContext('size', $this->context()), 'color' => $this->styleForContext('color', $this->context()), 'shape' => $this->styleForContext('shape', $this->context()), 'label' => $this->styleForContext('label', $this->context()), diff --git a/modules.local/ppcp-wc-gateway/services.php b/modules.local/ppcp-wc-gateway/services.php index 6efea40c4..5f3d89c00 100644 --- a/modules.local/ppcp-wc-gateway/services.php +++ b/modules.local/ppcp-wc-gateway/services.php @@ -444,29 +444,6 @@ return [ 'requirements' => [], 'gateway' => 'paypal', ], - 'button_size' => [ - 'title' => __('Button Size', 'woocommerce-paypal-commerce-gateway'), - 'type' => 'select', - 'class' => ['wc-enhanced-select'], - 'default' => 'responsive', - 'desc_tip' => true, - 'description' => __( - 'PayPal offers different sizes of the "PayPal Checkout" buttons, allowing you to select a size that best fits your site\'s theme. This setting will allow you to choose which size button(s) appear on your page. (The "Responsive" option adjusts to container size, and is available and recommended for Smart Payment Buttons.)', - 'woocommerce-paypal-commerce-gateway' - ), - 'options' => [ - 'small' => __('Small', 'woocommerce-paypal-commerce-gateway'), - 'medium' => __('Medium', 'woocommerce-paypal-commerce-gateway'), - 'large' => __('Large', 'woocommerce-paypal-commerce-gateway'), - 'responsive' => __('Responsive', 'woocommerce-paypal-commerce-gateway'), - ], - 'screens' => [ - State::STATE_PROGRESSIVE, - State::STATE_ONBOARDED, - ], - 'requirements' => [], - 'gateway' => 'paypal', - ], 'button_label' => [ 'title' => __('Button Label', 'woocommerce-paypal-commerce-gateway'), 'type' => 'select', @@ -579,29 +556,6 @@ return [ 'requirements' => [], 'gateway' => 'paypal', ], - 'button_single_product_size' => [ - 'title' => __('Button Size', 'woocommerce-paypal-commerce-gateway'), - 'type' => 'select', - 'class' => ['wc-enhanced-select'], - 'default' => 'responsive', - 'desc_tip' => true, - 'description' => __( - 'PayPal offers different sizes of the "PayPal Checkout" buttons, allowing you to select a size that best fits your site\'s theme. This setting will allow you to choose which size button(s) appear on your page. (The "Responsive" option adjusts to container size, and is available and recommended for Smart Payment Buttons.)', - 'woocommerce-paypal-commerce-gateway' - ), - 'options' => [ - 'small' => __('Small', 'woocommerce-paypal-commerce-gateway'), - 'medium' => __('Medium', 'woocommerce-paypal-commerce-gateway'), - 'large' => __('Large', 'woocommerce-paypal-commerce-gateway'), - 'responsive' => __('Responsive', 'woocommerce-paypal-commerce-gateway'), - ], - 'screens' => [ - State::STATE_PROGRESSIVE, - State::STATE_ONBOARDED, - ], - 'requirements' => [], - 'gateway' => 'paypal', - ], 'button_single_product_label' => [ 'title' => __('Button Label', 'woocommerce-paypal-commerce-gateway'), 'type' => 'select', @@ -714,29 +668,6 @@ return [ 'requirements' => [], 'gateway' => 'paypal', ], - 'button_mini-cart_size' => [ - 'title' => __('Button Size', 'woocommerce-paypal-commerce-gateway'), - 'type' => 'select', - 'class' => ['wc-enhanced-select'], - 'default' => 'responsive', - 'desc_tip' => true, - 'description' => __( - 'PayPal offers different sizes of the "PayPal Checkout" buttons, allowing you to select a size that best fits your site\'s theme. This setting will allow you to choose which size button(s) appear on your page. (The "Responsive" option adjusts to container size, and is available and recommended for Smart Payment Buttons.)', - 'woocommerce-paypal-commerce-gateway' - ), - 'options' => [ - 'small' => __('Small', 'woocommerce-paypal-commerce-gateway'), - 'medium' => __('Medium', 'woocommerce-paypal-commerce-gateway'), - 'large' => __('Large', 'woocommerce-paypal-commerce-gateway'), - 'responsive' => __('Responsive', 'woocommerce-paypal-commerce-gateway'), - ], - 'screens' => [ - State::STATE_PROGRESSIVE, - State::STATE_ONBOARDED, - ], - 'requirements' => [], - 'gateway' => 'paypal', - ], 'button_mini-cart_label' => [ 'title' => __('Button Label', 'woocommerce-paypal-commerce-gateway'), 'type' => 'select', @@ -849,29 +780,6 @@ return [ 'requirements' => [], 'gateway' => 'paypal', ], - 'button_cart_size' => [ - 'title' => __('Button Size', 'woocommerce-paypal-commerce-gateway'), - 'type' => 'select', - 'class' => ['wc-enhanced-select'], - 'default' => 'responsive', - 'desc_tip' => true, - 'description' => __( - 'PayPal offers different sizes of the "PayPal Checkout" buttons, allowing you to select a size that best fits your site\'s theme. This setting will allow you to choose which size button(s) appear on your page. (The "Responsive" option adjusts to container size, and is available and recommended for Smart Payment Buttons.)', - 'woocommerce-paypal-commerce-gateway' - ), - 'options' => [ - 'small' => __('Small', 'woocommerce-paypal-commerce-gateway'), - 'medium' => __('Medium', 'woocommerce-paypal-commerce-gateway'), - 'large' => __('Large', 'woocommerce-paypal-commerce-gateway'), - 'responsive' => __('Responsive', 'woocommerce-paypal-commerce-gateway'), - ], - 'screens' => [ - State::STATE_PROGRESSIVE, - State::STATE_ONBOARDED, - ], - 'requirements' => [], - 'gateway' => 'paypal', - ], 'button_cart_label' => [ 'title' => __('Button Label', 'woocommerce-paypal-commerce-gateway'), 'type' => 'select', diff --git a/tests/PHPUnit/WcGateway/Checkout/CheckoutPayPalAddressPresetTest.php b/tests/PHPUnit/WcGateway/Checkout/CheckoutPayPalAddressPresetTest.php index 405c96bec..b1c851008 100644 --- a/tests/PHPUnit/WcGateway/Checkout/CheckoutPayPalAddressPresetTest.php +++ b/tests/PHPUnit/WcGateway/Checkout/CheckoutPayPalAddressPresetTest.php @@ -157,6 +157,50 @@ class CheckoutPayPalAddressPresetTest extends TestCase ]; } + public function testReadShippingFromOrder(): void + { + $shipping = \Mockery::mock(Shipping::class); + $purchaseUnit = \Mockery::mock(PurchaseUnit::class); + $purchaseUnit->shouldReceive('shipping') + ->once() + ->andReturn($shipping); + $purchaseUnitLast = \Mockery::mock(PurchaseUnit::class); + $purchaseUnitLast->shouldReceive('shipping') + ->never(); + $order = \Mockery::mock( + Order::class, + [ + 'id' => 'whatever', + ] + ); + $order->shouldReceive('purchaseUnits') + ->once() + ->andReturn( + [ + \Mockery::mock(PurchaseUnit::class, ['shipping' => null]), + $purchaseUnit, + $purchaseUnitLast, + ] + ); + + $this->buildTestee()[0]->shouldReceive('order') + ->andReturn($order); + + $testee = $this->buildTestee()[1]; + $method = (new \ReflectionClass($testee)) + ->getMethod('readShippingFromOrder'); + $method->setAccessible(true); + + self::assertSame( + $shipping, + $method->invoke($testee) + ); + self::assertSame( + $shipping, + $method->invoke($testee) + ); + } + /** * @return MockInterface[] */