@@ -127,6 +127,60 @@ public function testPrepareNewCustomerQuoteConfirmationRequired()
127
127
);
128
128
}
129
129
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
+
130
184
/**
131
185
* Verify that after placing the order, addresses are associated with the order and the quote is a guest quote.
132
186
*
0 commit comments