Example #1
0
 public function testSetPaymentMethod()
 {
     $expectedData = ['paymentaction' => 'authorization', 'notify_url' => 'https://test.com/notifyurl', 'cancel_return' => 'https://test.com/cancelurl', 'return' => 'https://test.com/returnurl', 'lc' => 'US', 'template' => 'mobile-iframe', 'showBillingAddress' => 'false', 'showShippingAddress' => 'true', 'showBillingEmail' => 'false', 'showBillingPhone' => 'false', 'showCustomerName' => 'false', 'showCardInfo' => 'true', 'showHostedThankyouPage' => 'false'];
     $paymentMethodMock = $this->getMockBuilder('Magento\\Paypal\\Model\\Hostedpro')->disableOriginalConstructor()->setMethods([])->getMock();
     $paymentMethodMock->expects($this->once())->method('getConfigData')->with('payment_action')->willReturn('Authorization');
     $paymentMethodMock->expects($this->once())->method('getNotifyUrl')->willReturn('https://test.com/notifyurl');
     $paymentMethodMock->expects($this->once())->method('getCancelUrl')->willReturn('https://test.com/cancelurl');
     $paymentMethodMock->expects($this->once())->method('getReturnUrl')->willReturn('https://test.com/returnurl');
     $this->localeResolverMock->expects($this->once())->method('getLocale')->willReturn('en_US');
     $this->assertEquals($this->_model, $this->_model->setPaymentMethod($paymentMethodMock));
     $this->assertEquals('US', $this->_model->getData('lc'));
     $this->assertEquals($expectedData, $this->_model->getData());
 }