diff --git a/app/code/Magento/Quote/Model/Quote.php b/app/code/Magento/Quote/Model/Quote.php
index 5daefcfe5f7f6..1d663cfd5d942 100644
--- a/app/code/Magento/Quote/Model/Quote.php
+++ b/app/code/Magento/Quote/Model/Quote.php
@@ -27,7 +27,6 @@
* sales_quote_delete_after
*
* @method Quote setStoreId(int $value)
- * @method Quote setIsVirtual(int $value)
* @method int getIsMultiShipping()
* @method Quote setIsMultiShipping(int $value)
* @method float getStoreToBaseRate()
@@ -556,6 +555,14 @@ public function setIsActive($isActive)
return $this->setData(self::KEY_IS_ACTIVE, $isActive);
}
+ /**
+ * {@inheritdoc}
+ */
+ public function setIsVirtual($isVirtual)
+ {
+ return $this->setData(self::KEY_IS_VIRTUAL, $isVirtual);
+ }
+
/**
* {@inheritdoc}
*/
@@ -772,6 +779,9 @@ public function beforeSave()
$this->setCustomerId($this->_customer->getId());
}
+ //mark quote if it has virtual products only
+ $this->setIsVirtual($this->getIsVirtual());
+
parent::beforeSave();
}
diff --git a/app/code/Magento/Quote/Test/Unit/Model/QuoteTest.php b/app/code/Magento/Quote/Test/Unit/Model/QuoteTest.php
index 8aab4a28cb4b2..98c15827761b5 100644
--- a/app/code/Magento/Quote/Test/Unit/Model/QuoteTest.php
+++ b/app/code/Magento/Quote/Test/Unit/Model/QuoteTest.php
@@ -10,6 +10,7 @@
use Magento\Quote\Model\Quote\Address;
use Magento\Store\Model\ScopeInterface;
+use Magento\Quote\Api\Data\CartInterface;
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
/**
@@ -1040,4 +1041,94 @@ public function testAddItem()
$this->quote->addItem($item);
}
+
+ /**
+ * @param array $productTypes
+ * @param int $expected
+ * @dataProvider dataProviderForTestBeforeSaveIsVirtualQuote
+ */
+ public function testBeforeSaveIsVirtualQuote(array $productTypes, $expected)
+ {
+ $storeId = 1;
+ $currencyMock = $this->getMockBuilder('Magento\Directory\Model\Currency')
+ ->disableOriginalConstructor()
+ ->getMock();
+ $currencyMock->expects($this->any())
+ ->method('getCode')
+ ->will($this->returnValue('test_code'));
+ $currencyMock->expects($this->any())
+ ->method('getRate')
+ ->will($this->returnValue('test_rate'));
+ $storeMock = $this->getMockBuilder('Magento\Store\Model\Store')
+ ->disableOriginalConstructor()
+ ->getMock();
+ $storeMock->expects($this->once())
+ ->method('getBaseCurrency')
+ ->will($this->returnValue($currencyMock));
+ $storeMock->expects($this->once())
+ ->method('getCurrentCurrency')
+ ->will($this->returnValue($currencyMock));
+
+ $this->storeManagerMock->expects($this->any())
+ ->method('getStore')
+ ->with($storeId)
+ ->will($this->returnValue($storeMock));
+ $this->quote->setStoreId($storeId);
+
+ $collectionMock = $this->getMock(
+ 'Magento\Quote\Model\Resource\Quote\Item\Collection',
+ [],
+ [],
+ '',
+ false
+ );
+ $items = [];
+ foreach ($productTypes as $type) {
+ $productMock = $this->getMock('\Magento\Catalog\Model\Product', [], [], '', false);;
+ $productMock->expects($this->any())->method('getIsVirtual')->willReturn($type);
+
+ $itemMock = $this->getMock(
+ 'Magento\Quote\Model\Quote\Item',
+ ['isDeleted', 'getParentItemId', 'getProduct'],
+ [],
+ '',
+ false
+ );
+ $itemMock->expects($this->any())
+ ->method('isDeleted')
+ ->willReturn(false);
+ $itemMock->expects($this->any())
+ ->method('getParentItemId')
+ ->willReturn(false);
+ $itemMock->expects($this->any())
+ ->method('getProduct')
+ ->willReturn($productMock);
+ $items[] = $itemMock;
+ }
+ $iterator = new \ArrayIterator($items);
+ $collectionMock->expects($this->any())
+ ->method('getIterator')
+ ->will($this->returnValue($iterator));
+ $this->quoteItemCollectionFactoryMock->expects($this->once())
+ ->method('create')
+ ->will($this->returnValue($collectionMock));
+
+ $this->quote->beforeSave();
+ $this->assertEquals($expected, $this->quote->getDataByKey(CartInterface::KEY_IS_VIRTUAL));
+ }
+
+
+ /**
+ * @return array
+ */
+ public function dataProviderForTestBeforeSaveIsVirtualQuote()
+ {
+ return [
+ [[true], 1],
+ [[true, true], 1],
+ [[false], 0],
+ [[true, false], 0],
+ [[false, false], 0]
+ ];
+ }
}
diff --git a/dev/tests/functional/composer.json b/dev/tests/functional/composer.json
index 41482866c1b24..5f5074addbc39 100644
--- a/dev/tests/functional/composer.json
+++ b/dev/tests/functional/composer.json
@@ -1,6 +1,6 @@
{
"require": {
- "magento/mtf": "1.0.0-rc21",
+ "magento/mtf": "1.0.0-rc22",
"php": "~5.5.0|~5.6.0",
"phpunit/phpunit": "4.1.0",
"phpunit/phpunit-selenium": ">=1.2",
diff --git a/dev/tests/functional/credentials.xml.dist b/dev/tests/functional/credentials.xml.dist
index 6c23762bae421..80746c30f0380 100644
--- a/dev/tests/functional/credentials.xml.dist
+++ b/dev/tests/functional/credentials.xml.dist
@@ -7,35 +7,38 @@
-->
+
+
+
+
-
-
-
+
+
-
-
-
-
+
+
+
+
-
-
-
-
+
+
+
+
+
-
-
+
+
+
+
-
-
+
+
-
-
-
-
+
+
+
-
-
-
-
-
+
+
+
diff --git a/dev/tests/functional/tests/app/Magento/Backend/Test/Repository/ConfigData.xml b/dev/tests/functional/tests/app/Magento/Backend/Test/Repository/ConfigData.xml
index e15167c85b4c6..b0c8be8dae155 100644
--- a/dev/tests/functional/tests/app/Magento/Backend/Test/Repository/ConfigData.xml
+++ b/dev/tests/functional/tests/app/Magento/Backend/Test/Repository/ConfigData.xml
@@ -1,4 +1,4 @@
-
+
-
-
-
-
-
-
- 0
-
-
- CURRENT_TIMESTAMP
-
-
- 0000-00-00 00:00:00
-
-
-
-
-
- 1
-
-
- 0
-
-
- 0
-
-
-
- 0
-
-
- 0.0000
-
-
- 0
-
-
- 0.0000
-
-
- 0.0000
-
-
-
-
-
-
-
-
-
-
-
- 0.0000
-
-
- 0.0000
-
-
-
-
-
- 0
-
-
- 0
-
-
- 0
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 1
-
-
- 0
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 0
-
-
-
-
-
- 0
-
-
-
-
-
-
+
+
+
+
+
+
+ 0
+
+
+ CURRENT_TIMESTAMP
+
+
+ 0000-00-00 00:00:00
+
+
+
+
+
+ 1
+
+
+ 0
+
+
+ 0
+
+
+
+ 0
+
+
+ 0.0000
+
+
+ 0
+
+
+ 0.0000
+
+
+ 0.0000
+
+
+
+
+
+
+
+
+
+
+
+ 0.0000
+
+
+ 0.0000
+
+
+
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1
+
+
+ 0
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 0
+
+
+
+
+
+ 0
+
+
+
+
+
+
+
+
+
diff --git a/dev/tests/functional/tests/app/Magento/CheckoutAgreements/Test/Repository/ConfigData.xml b/dev/tests/functional/tests/app/Magento/CheckoutAgreements/Test/Repository/ConfigData.xml
index cc48fe65a7363..16e8dc69362c7 100644
--- a/dev/tests/functional/tests/app/Magento/CheckoutAgreements/Test/Repository/ConfigData.xml
+++ b/dev/tests/functional/tests/app/Magento/CheckoutAgreements/Test/Repository/ConfigData.xml
@@ -1,4 +1,4 @@
-
+
+
+
+
+ MAGETWO-12850 – Use DHL International (EU) Online Shipping Carrier on Checkout as a Registered Customer
+ catalogProductSimple::default, configurableProduct::default, bundleProduct::bundle_fixed_product
+ login
+ customer_DE
+ customer_DE
+ customer_DE
+ DHL
+ Express worldwide
+ Express worldwide
+ checkmo
+ checkmo, dhl_eu, shipping_origin_CH, config_base_currency_ch
+ test_type:3rd_party_test
+
+
+
+
+
+
diff --git a/dev/tests/functional/tests/app/Magento/Fedex/Test/Repository/ConfigData.xml b/dev/tests/functional/tests/app/Magento/Fedex/Test/Repository/ConfigData.xml
index f9e73dddcd2ba..55edec45ea52e 100644
--- a/dev/tests/functional/tests/app/Magento/Fedex/Test/Repository/ConfigData.xml
+++ b/dev/tests/functional/tests/app/Magento/Fedex/Test/Repository/ConfigData.xml
@@ -1,4 +1,4 @@
-
+
+
+
+
+ Checkout as guest using FedEx with US shipping origin and UK customer
+ catalogProductSimple::default, configurableProduct::default, bundleProduct::bundle_fixed_product
+ guest
+ customer_UK
+ customer_UK
+ customer_UK
+ Federal Express
+ International Economy
+ International Economy
+ checkmo
+ checkmo, fedex, shipping_origin_US_CA
+
+
+
+
+
+ MAGETWO-12849 – Use FedEx Online Shipping Carrier on Checkout as a Registered Customer
+ catalogProductSimple::default, configurableProduct::default, bundleProduct::bundle_fixed_product
+ login
+ customer_DE
+ customer_DE
+ customer_DE
+ Federal Express
+ Ground
+ Ground
+ checkmo
+ checkmo, fedex, shipping_origin_US_CA
+ test_type:3rd_party_test
+
+
+
+
+
+
diff --git a/dev/tests/functional/tests/app/Magento/GiftMessage/Test/Repository/ConfigData.xml b/dev/tests/functional/tests/app/Magento/GiftMessage/Test/Repository/ConfigData.xml
index 2808d830e70af..57be761d32021 100644
--- a/dev/tests/functional/tests/app/Magento/GiftMessage/Test/Repository/ConfigData.xml
+++ b/dev/tests/functional/tests/app/Magento/GiftMessage/Test/Repository/ConfigData.xml
@@ -1,4 +1,4 @@
-
+
+
+
+
+ MAGETWO-12848 – Use UPS Online Shipping Carrier on Checkout as a Registered Customer
+ catalogProductSimple::default, configurableProduct::default, bundleProduct::bundle_fixed_product
+ login
+ customer_US
+ customer_US
+ United Parcel Service
+ UPS Ground
+ UPS Ground
+ checkmo
+ checkmo, ups, shipping_origin_US_CA
+ test_type:3rd_party_test
+
+
+
+
+
+ Checkout as guest using UPS with US shipping origin and UK customer
+ catalogProductSimple::default, configurableProduct::default, bundleProduct::bundle_fixed_product
+ guest
+ customer_UK
+ customer_UK
+ customer_UK
+ United Parcel Service
+ UPS Worldwide Expedited
+ UPS Worldwide Expedited
+ checkmo
+ checkmo, ups, shipping_origin_US_CA
+
+
+
+
+
+
diff --git a/dev/tests/functional/tests/app/Magento/Usps/Test/Repository/ConfigData.xml b/dev/tests/functional/tests/app/Magento/Usps/Test/Repository/ConfigData.xml
index 00deb1ffd6069..03dbba33fad4b 100644
--- a/dev/tests/functional/tests/app/Magento/Usps/Test/Repository/ConfigData.xml
+++ b/dev/tests/functional/tests/app/Magento/Usps/Test/Repository/ConfigData.xml
@@ -1,4 +1,4 @@
-
+
+
+
+
+ MAGETWO-12444 – Use USPS Online Shipping Carrier on Checkout as a Registered Customer
+ catalogProductSimple::default, configurableProduct::default, bundleProduct::bundle_fixed_product
+ login
+ customer_US
+ customer_US
+ United States Postal Service
+ Priority Mail 1-Day
+ Priority Mail 1-Day
+ checkmo
+ checkmo, usps, shipping_origin_US_CA
+ test_type:3rd_party_test
+
+
+
+
+
+ Checkout as guest using USPS with US shipping origin and UK customer
+ catalogProductSimple::default, configurableProduct::default, bundleProduct::bundle_fixed_product
+ guest
+ customer_UK
+ customer_UK
+ customer_UK
+ United States Postal Service
+ Priority Mail International
+ Priority Mail International
+ checkmo
+ checkmo, usps, shipping_origin_US_CA
+
+
+
+
+
+
diff --git a/dev/tests/functional/tests/app/Magento/Weee/Test/Repository/ConfigData.xml b/dev/tests/functional/tests/app/Magento/Weee/Test/Repository/ConfigData.xml
index 754c0ceb95f07..c78a826e8500c 100644
--- a/dev/tests/functional/tests/app/Magento/Weee/Test/Repository/ConfigData.xml
+++ b/dev/tests/functional/tests/app/Magento/Weee/Test/Repository/ConfigData.xml
@@ -1,4 +1,4 @@
-
+