Skip to content

Commit c8e1812

Browse files
author
Pavlo Cherniavskyi
committed
MAGETWO-31559: [TD] Removing NominalItems usage
-- integration test for start method
1 parent c8b5248 commit c8e1812

File tree

1 file changed

+54
-0
lines changed

1 file changed

+54
-0
lines changed

dev/tests/integration/testsuite/Magento/Paypal/Model/Express/CheckoutTest.php

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,60 @@ public function testPrepareNewCustomerQuoteConfirmationRequired()
127127
);
128128
}
129129

130+
/**
131+
* @magentoDataFixture Magento/Paypal/_files/quote_payment_express_with_customer.php
132+
* @magentoAppIsolation enabled
133+
* @magentoDbIsolation enabled
134+
*/
135+
public function testGuestExpressCheckoutStart()
136+
{
137+
/** @var Quote $quote */
138+
$quote = $this->_getFixtureQuote();
139+
140+
$quote->setIsMultiShipping(false);
141+
$quote->setCheckoutMethod(Onepage::METHOD_GUEST);
142+
$quote->getShippingAddress()->setSameAsBilling(0);
143+
144+
$paypalConfigMock = $this->getMock('Magento\Paypal\Model\Config', [], [], '', false);
145+
$apiTypeFactory = $this->getMock('Magento\Paypal\Model\Api\Type\Factory', [], [], '', false);
146+
$paypalInfo = $this->getMock('Magento\Paypal\Model\Info', [], [], '', false);
147+
148+
$apiMock = $this->getMockBuilder('\Magento\Paypal\Model\Api\Nvp')
149+
->disableOriginalConstructor()
150+
->setMethods(['call', 'callSetExpressCheckout'])
151+
->getMock();
152+
153+
$apiMock->expects($this->any())->method('call')->will($this->returnValue([]));
154+
$apiMock->expects($this->once())->method('callSetExpressCheckout');
155+
156+
$apiMock->expects($this->never())->method('getBillingAgreementType');
157+
$apiMock->expects($this->never())->method('setBillingType');
158+
159+
$apiTypeFactory->expects($this->any())->method('create')->will($this->returnValue($apiMock));
160+
161+
/** @var \Magento\Paypal\Model\Express\Checkout $checkout */
162+
$checkout = $this->_objectManager->create(
163+
'Magento\Paypal\Model\Express\Checkout',
164+
[
165+
'params' => ['quote' => $quote, 'config' => $paypalConfigMock],
166+
'apiTypeFactory' => $apiTypeFactory,
167+
'paypalInfo' => $paypalInfo
168+
]
169+
);
170+
171+
$checkout->setIsBillingAgreementRequested(false);
172+
$checkout->setIsBml(false);
173+
174+
$checkout->setCustomerData($quote->getCustomer());
175+
176+
$token = $checkout->start("https://domain.com/some/return/url", "https://domain.com/some/cancel/url");
177+
178+
$this->assertNull($token);
179+
$this->assertTrue($quote->getTotalsCollectedFlag());
180+
$this->assertFalse($quote->hasDataChanges());
181+
$this->assertTrue($quote->getPayment()->hasMethod());
182+
}
183+
130184
/**
131185
* Verify that after placing the order, addresses are associated with the order and the quote is a guest quote.
132186
*

0 commit comments

Comments
 (0)