public function testDispatchButtonNotEnabled() { $resultRedirect = new \Magento\Framework\DataObject(); $this->braintreePayPalConfigMock->expects($this->once())->method('isActive')->willReturn(true); $this->braintreePayPalConfigMock->expects($this->once())->method('isShortcutCheckoutEnabled')->willReturn(false); $this->actionFlagMock->expects($this->once())->method('set')->with('', \Magento\Framework\App\ActionInterface::FLAG_NO_DISPATCH); $this->resultRedirectFactoryMock->expects($this->once())->method('create')->willReturn($resultRedirect); $this->assertEquals($resultRedirect, $this->controller->execute($this->requestMock)); $this->assertEquals('noRoute', $resultRedirect->getPath()); }
/** * @param \Magento\Framework\App\Action\Context $context * @param \Magento\Customer\Model\Session $customerSession * @param \Magento\Checkout\Model\Session $checkoutSession * @param \Magento\Braintree\Model\Config\PayPal $braintreePayPalConfig * @param \Magento\Paypal\Model\Config $paypalConfig * @param \Magento\Braintree\Model\CheckoutFactory $checkoutFactory * @param \Magento\Checkout\Api\AgreementsValidatorInterface $agreementsValidator */ public function __construct(\Magento\Framework\App\Action\Context $context, \Magento\Customer\Model\Session $customerSession, \Magento\Checkout\Model\Session $checkoutSession, \Magento\Braintree\Model\Config\PayPal $braintreePayPalConfig, \Magento\Paypal\Model\Config $paypalConfig, \Magento\Braintree\Model\CheckoutFactory $checkoutFactory, \Magento\Checkout\Api\AgreementsValidatorInterface $agreementsValidator) { $this->agreementsValidator = $agreementsValidator; parent::__construct($context, $customerSession, $checkoutSession, $braintreePayPalConfig, $paypalConfig, $checkoutFactory); }
/** * @param \Magento\Framework\App\Action\Context $context * @param \Magento\Customer\Model\Session $customerSession * @param \Magento\Checkout\Model\Session $checkoutSession * @param \Magento\Braintree\Model\Config\PayPal $braintreePayPalConfig * @param \Magento\Paypal\Model\Config $paypalConfig * @param \Magento\Braintree\Model\CheckoutFactory $checkoutFactory * @param \Magento\Framework\Json\Helper\Data $jsonHelper */ public function __construct(Context $context, Session $customerSession, \Magento\Checkout\Model\Session $checkoutSession, \Magento\Braintree\Model\Config\PayPal $braintreePayPalConfig, \Magento\Paypal\Model\Config $paypalConfig, \Magento\Braintree\Model\CheckoutFactory $checkoutFactory, \Magento\Framework\Json\Helper\Data $jsonHelper) { parent::__construct($context, $customerSession, $checkoutSession, $braintreePayPalConfig, $paypalConfig, $checkoutFactory); $this->jsonHelper = $jsonHelper; }