11 class DataTest extends \PHPUnit\Framework\TestCase
41 protected function setUp()
43 $this->quoteMock = $this->createMock(\
Magento\Quote\Model\Quote::class);
45 $objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
48 $this->checkoutSessionMock =
$arguments[
'checkoutSession'];
51 $this->scopeConfigMock = $context->getScopeConfig();
57 $this->scopeConfigMock->expects(
62 \
Magento\Multishipping\Helper\Data::XML_PATH_CHECKOUT_MULTIPLE_MAXIMUM_QUANTITY
64 $this->returnValue($maximumQty)
67 $this->assertEquals($maximumQty, $this->helper->getMaximumQty());
85 $hasItemsWithDecimalQty,
86 $validateMinimumAmount,
91 $this->scopeConfigMock->expects(
96 \
Magento\Multishipping\Helper\Data::XML_PATH_CHECKOUT_MULTIPLE_AVAILABLE
98 $this->returnValue($isMultiShipping)
100 $this->checkoutSessionMock->expects(
105 $this->returnValue($this->quoteMock)
107 $this->quoteMock->expects($this->once())->method(
'hasItems')->will($this->returnValue($quoteHasItems));
109 $this->quoteMock->expects(
112 'hasItemsWithDecimalQty' 114 $this->returnValue($hasItemsWithDecimalQty)
116 $this->quoteMock->expects(
119 'validateMinimumAmount' 123 $this->returnValue($validateMinimumAmount)
125 $this->quoteMock->expects(
130 $this->returnValue($itemsSummaryQty)
132 $this->quoteMock->expects(
137 $this->returnValue($itemVirtualQty)
139 $this->scopeConfigMock->expects(
144 \
Magento\Multishipping\Helper\Data::XML_PATH_CHECKOUT_MULTIPLE_MAXIMUM_QUANTITY
146 $this->returnValue($maximumQty)
149 $this->assertEquals(
$result, $this->helper->isMultishippingCheckoutAvailable());
160 [
true,
false,
true,
null,
null,
null,
null,
null],
161 [
false,
false,
false,
null,
null,
null,
null,
null],
162 [
false,
true,
true,
true,
null,
null,
null,
null],
163 [
false,
true,
true,
false,
false,
null,
null,
null],
164 [
true,
true,
true,
false,
true, 2, 1, 3],
165 [
false,
true,
true,
false,
true, 1, 2,
null],
166 [
false,
true,
true,
false,
true, 2, 1, 1],
testIsMultishippingCheckoutAvailable( $result, $quoteHasItems, $isMultiShipping, $hasItemsWithDecimalQty, $validateMinimumAmount, $itemsSummaryQty, $itemVirtualQty, $maximumQty)
isMultishippingCheckoutAvailableDataProvider()