diff --git a/app/code/Magento/Bundle/Block/Catalog/Product/View/Type/Bundle.php b/app/code/Magento/Bundle/Block/Catalog/Product/View/Type/Bundle.php
index 41f11b3d529ee..62a2fa1c47e1e 100644
--- a/app/code/Magento/Bundle/Block/Catalog/Product/View/Type/Bundle.php
+++ b/app/code/Magento/Bundle/Block/Catalog/Product/View/Type/Bundle.php
@@ -188,6 +188,10 @@ public function getJsonConfig()
$configValue = $preConfiguredValues->getData('bundle_option/' . $optionId);
if ($configValue) {
$defaultValues[$optionId] = $configValue;
+ $configQty = $preConfiguredValues->getData('bundle_option_qty/' . $optionId);
+ if ($configQty) {
+ $options[$optionId]['selections'][$configValue]['qty'] = $configQty;
+ }
}
}
$position++;
diff --git a/app/code/Magento/Catalog/Model/Indexer/Product/Flat/Action/Eraser.php b/app/code/Magento/Catalog/Model/Indexer/Product/Flat/Action/Eraser.php
index 8182e6f07fab1..6762602aecaf1 100644
--- a/app/code/Magento/Catalog/Model/Indexer/Product/Flat/Action/Eraser.php
+++ b/app/code/Magento/Catalog/Model/Indexer/Product/Flat/Action/Eraser.php
@@ -8,7 +8,12 @@
namespace Magento\Catalog\Model\Indexer\Product\Flat\Action;
use Magento\Framework\App\ResourceConnection;
+use Magento\Catalog\Model\Product\Attribute\Source\Status;
+use Magento\Store\Model\Store;
+/**
+ * Flat item eraser. Used to clear items from the catalog flat table.
+ */
class Eraser
{
/**
@@ -50,12 +55,7 @@ public function __construct(
*/
public function removeDeletedProducts(array &$ids, $storeId)
{
- $select = $this->connection->select()->from(
- $this->productIndexerHelper->getTable('catalog_product_entity')
- )->where(
- 'entity_id IN(?)',
- $ids
- );
+ $select = $this->getSelectForProducts($ids);
$result = $this->connection->query($select);
$existentProducts = [];
@@ -69,6 +69,61 @@ public function removeDeletedProducts(array &$ids, $storeId)
$this->deleteProductsFromStore($productsToDelete, $storeId);
}
+ /**
+ * Remove products with "Disabled" status from the flat table(s).
+ *
+ * @param array $ids
+ * @param int $storeId
+ * @return void
+ */
+ public function removeDisabledProducts(array &$ids, $storeId)
+ {
+ /* @var $statusAttribute \Magento\Eav\Model\Entity\Attribute */
+ $statusAttribute = $this->productIndexerHelper->getAttribute('status');
+
+ $select = $this->getSelectForProducts($ids);
+ $select->joinLeft(
+ ['status_global_attr' => $statusAttribute->getBackendTable()],
+ ' status_global_attr.attribute_id = ' . (int)$statusAttribute->getAttributeId()
+ . ' AND status_global_attr.store_id = ' . Store::DEFAULT_STORE_ID,
+ []
+ );
+ $select->joinLeft(
+ ['status_attr' => $statusAttribute->getBackendTable()],
+ ' status_attr.attribute_id = ' . (int)$statusAttribute->getAttributeId()
+ . ' AND status_attr.store_id = ' . $storeId,
+ []
+ );
+ $select->where('IFNULL(status_attr.value, status_global_attr.value) = ?', Status::STATUS_DISABLED);
+
+ $result = $this->connection->query($select);
+
+ $disabledProducts = [];
+ foreach ($result->fetchAll() as $product) {
+ $disabledProducts[] = $product['entity_id'];
+ }
+
+ if (!empty($disabledProducts)) {
+ $ids = array_diff($ids, $disabledProducts);
+ $this->deleteProductsFromStore($disabledProducts, $storeId);
+ }
+ }
+
+ /**
+ * Get Select object for existed products.
+ *
+ * @param array $ids
+ * @return \Magento\Framework\DB\Select
+ */
+ private function getSelectForProducts(array $ids)
+ {
+ $productTable = $this->productIndexerHelper->getTable('catalog_product_entity');
+ $select = $this->connection->select()->from($productTable)
+ ->columns('entity_id')
+ ->where('entity_id IN(?)', $ids);
+ return $select;
+ }
+
/**
* Delete products from flat table(s)
*
diff --git a/app/code/Magento/Catalog/Model/Indexer/Product/Flat/Action/Row.php b/app/code/Magento/Catalog/Model/Indexer/Product/Flat/Action/Row.php
index 6d0727259d9db..d9bfc96b7817a 100644
--- a/app/code/Magento/Catalog/Model/Indexer/Product/Flat/Action/Row.php
+++ b/app/code/Magento/Catalog/Model/Indexer/Product/Flat/Action/Row.php
@@ -90,6 +90,7 @@ public function execute($id = null)
$tableExists = $this->_isFlatTableExists($store->getId());
if ($tableExists) {
$this->flatItemEraser->removeDeletedProducts($ids, $store->getId());
+ $this->flatItemEraser->removeDisabledProducts($ids, $store->getId());
}
/* @var $status \Magento\Eav\Model\Entity\Attribute */
diff --git a/app/code/Magento/Catalog/Model/Product/Url.php b/app/code/Magento/Catalog/Model/Product/Url.php
index c291dc33fedab..f3ac9f55d1aea 100644
--- a/app/code/Magento/Catalog/Model/Product/Url.php
+++ b/app/code/Magento/Catalog/Model/Product/Url.php
@@ -7,6 +7,7 @@
use Magento\UrlRewrite\Model\UrlFinderInterface;
use Magento\UrlRewrite\Service\V1\Data\UrlRewrite;
+use Magento\Framework\App\Config\ScopeConfigInterface;
/**
* Product Url model
@@ -45,6 +46,11 @@ class Url extends \Magento\Framework\DataObject
*/
protected $urlFinder;
+ /**
+ * @var \Magento\Framework\App\Config\ScopeConfigInterface
+ */
+ private $scopeConfig;
+
/**
* @param \Magento\Framework\UrlFactory $urlFactory
* @param \Magento\Store\Model\StoreManagerInterface $storeManager
@@ -52,6 +58,7 @@ class Url extends \Magento\Framework\DataObject
* @param \Magento\Framework\Session\SidResolverInterface $sidResolver
* @param UrlFinderInterface $urlFinder
* @param array $data
+ * @param ScopeConfigInterface|null $scopeConfig
*/
public function __construct(
\Magento\Framework\UrlFactory $urlFactory,
@@ -59,7 +66,8 @@ public function __construct(
\Magento\Framework\Filter\FilterManager $filter,
\Magento\Framework\Session\SidResolverInterface $sidResolver,
UrlFinderInterface $urlFinder,
- array $data = []
+ array $data = [],
+ ScopeConfigInterface $scopeConfig = null
) {
parent::__construct($data);
$this->urlFactory = $urlFactory;
@@ -67,16 +75,8 @@ public function __construct(
$this->filter = $filter;
$this->sidResolver = $sidResolver;
$this->urlFinder = $urlFinder;
- }
-
- /**
- * Retrieve URL Instance
- *
- * @return \Magento\Framework\UrlInterface
- */
- private function getUrlInstance()
- {
- return $this->urlFactory->create();
+ $this->scopeConfig = $scopeConfig ?:
+ \Magento\Framework\App\ObjectManager::getInstance()->get(ScopeConfigInterface::class);
}
/**
@@ -157,10 +157,19 @@ public function getUrl(\Magento\Catalog\Model\Product $product, $params = [])
UrlRewrite::ENTITY_TYPE => \Magento\CatalogUrlRewrite\Model\ProductUrlRewriteGenerator::ENTITY_TYPE,
UrlRewrite::STORE_ID => $storeId,
];
+ $useCategories = $this->scopeConfig->getValue(
+ \Magento\Catalog\Helper\Product::XML_PATH_PRODUCT_URL_USE_CATEGORY,
+ \Magento\Store\Model\ScopeInterface::SCOPE_STORE
+ );
+
if ($categoryId) {
$filterData[UrlRewrite::METADATA]['category_id'] = $categoryId;
+ } elseif (!$useCategories) {
+ $filterData[UrlRewrite::METADATA]['category_id'] = '';
}
+
$rewrite = $this->urlFinder->findOneByData($filterData);
+
if ($rewrite) {
$requestPath = $rewrite->getRequestPath();
$product->setRequestPath($requestPath);
@@ -194,6 +203,7 @@ public function getUrl(\Magento\Catalog\Model\Product $product, $params = [])
$routeParams['_query'] = [];
}
- return $this->getUrlInstance()->setScope($storeId)->getUrl($routePath, $routeParams);
+ $url = $this->urlFactory->create()->setScope($storeId);
+ return $url->getUrl($routePath, $routeParams);
}
}
diff --git a/app/code/Magento/Catalog/Model/ResourceModel/Product/Collection.php b/app/code/Magento/Catalog/Model/ResourceModel/Product/Collection.php
index fdd98442150ae..0d62d120f80e0 100644
--- a/app/code/Magento/Catalog/Model/ResourceModel/Product/Collection.php
+++ b/app/code/Magento/Catalog/Model/ResourceModel/Product/Collection.php
@@ -1423,8 +1423,13 @@ protected function _addUrlRewrite()
['cu' => $this->getTable('catalog_url_rewrite_product_category')],
'u.url_rewrite_id=cu.url_rewrite_id'
)->where('cu.category_id IN (?)', $this->_urlRewriteCategory);
+ } else {
+ $select->joinLeft(
+ ['cu' => $this->getTable('catalog_url_rewrite_product_category')],
+ 'u.url_rewrite_id=cu.url_rewrite_id'
+ )->where('cu.url_rewrite_id IS NULL');
}
-
+
// more priority is data with category id
$urlRewrites = [];
diff --git a/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductFormSection.xml b/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductFormSection.xml
index a138c9bbac073..51199300206a9 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductFormSection.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductFormSection.xml
@@ -23,6 +23,7 @@
+
diff --git a/app/code/Magento/Catalog/Test/Unit/Model/Indexer/Product/Flat/Action/EraserTest.php b/app/code/Magento/Catalog/Test/Unit/Model/Indexer/Product/Flat/Action/EraserTest.php
index cc6f5d84ef001..c04428eadef0d 100644
--- a/app/code/Magento/Catalog/Test/Unit/Model/Indexer/Product/Flat/Action/EraserTest.php
+++ b/app/code/Magento/Catalog/Test/Unit/Model/Indexer/Product/Flat/Action/EraserTest.php
@@ -54,6 +54,7 @@ public function testRemoveDeletedProducts()
$productsToDeleteIds = [1, 2];
$select = $this->createMock(\Magento\Framework\DB\Select::class);
$select->expects($this->once())->method('from')->with('catalog_product_entity')->will($this->returnSelf());
+ $select->expects($this->once())->method('columns')->with('entity_id')->will($this->returnSelf());
$select->expects($this->once())->method('where')->with('entity_id IN(?)', $productsToDeleteIds)
->will($this->returnSelf());
$products = [['entity_id' => 2]];
diff --git a/app/code/Magento/Catalog/etc/adminhtml/system.xml b/app/code/Magento/Catalog/etc/adminhtml/system.xml
index 71a799fd22427..d6c98b92596fd 100644
--- a/app/code/Magento/Catalog/etc/adminhtml/system.xml
+++ b/app/code/Magento/Catalog/etc/adminhtml/system.xml
@@ -83,8 +83,9 @@
Magento\Catalog\Model\Indexer\Product\Flat\System\Config\Mode
Magento\Config\Model\Config\Source\Yesno
-
+
+ Applies to category pages
Magento\Catalog\Model\Config\Source\ListSort
diff --git a/app/code/Magento/Checkout/Test/Mftf/ActionGroup/StorefrontShippmentFromActionGroup.xml b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/StorefrontShippmentFromActionGroup.xml
new file mode 100644
index 0000000000000..354ad6d2b44ba
--- /dev/null
+++ b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/StorefrontShippmentFromActionGroup.xml
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/code/Magento/Checkout/Test/Mftf/Section/CheckoutShippingSection.xml b/app/code/Magento/Checkout/Test/Mftf/Section/CheckoutShippingSection.xml
index 494a365ffd507..ff7f8995c0681 100644
--- a/app/code/Magento/Checkout/Test/Mftf/Section/CheckoutShippingSection.xml
+++ b/app/code/Magento/Checkout/Test/Mftf/Section/CheckoutShippingSection.xml
@@ -31,6 +31,7 @@
+
diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/ZeroSubtotalOrdersWithProcessingStatusTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/ZeroSubtotalOrdersWithProcessingStatusTest.xml
new file mode 100644
index 0000000000000..aaedaedb7236c
--- /dev/null
+++ b/app/code/Magento/Checkout/Test/Mftf/Test/ZeroSubtotalOrdersWithProcessingStatusTest.xml
@@ -0,0 +1,100 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/code/Magento/Customer/Helper/Address.php b/app/code/Magento/Customer/Helper/Address.php
index c74c62dc6d98c..cfc76753fa10a 100644
--- a/app/code/Magento/Customer/Helper/Address.php
+++ b/app/code/Magento/Customer/Helper/Address.php
@@ -127,6 +127,8 @@ public function getBookUrl()
}
/**
+ * Retrieve edit url.
+ *
* @return void
*/
public function getEditUrl()
@@ -134,6 +136,8 @@ public function getEditUrl()
}
/**
+ * Retrieve delete url.
+ *
* @return void
*/
public function getDeleteUrl()
@@ -141,6 +145,8 @@ public function getDeleteUrl()
}
/**
+ * Retrieve create url.
+ *
* @return void
*/
public function getCreateUrl()
@@ -148,6 +154,8 @@ public function getCreateUrl()
}
/**
+ * Retrieve block renderer.
+ *
* @param string $renderer
* @return \Magento\Framework\View\Element\BlockInterface
*/
@@ -204,6 +212,8 @@ public function getStreetLines($store = null)
}
/**
+ * Retrieve address format.
+ *
* @param string $code
* @return Format|string
*/
@@ -391,4 +401,23 @@ public function isAttributeVisible($code)
}
return false;
}
+
+ /**
+ * Retrieve attribute required
+ *
+ * @param string $code
+ * @return bool
+ * @throws NoSuchEntityException
+ * @throws \Magento\Framework\Exception\LocalizedException
+ */
+ public function isAttributeRequired($code)
+ {
+ $attributeMetadata = $this->_addressMetadataService->getAttributeMetadata($code);
+
+ if ($attributeMetadata) {
+ return $attributeMetadata->isRequired();
+ }
+
+ return false;
+ }
}
diff --git a/app/code/Magento/Customer/Test/Unit/Helper/AddressTest.php b/app/code/Magento/Customer/Test/Unit/Helper/AddressTest.php
index 74af4ec57c77f..fd06f778efe45 100644
--- a/app/code/Magento/Customer/Test/Unit/Helper/AddressTest.php
+++ b/app/code/Magento/Customer/Test/Unit/Helper/AddressTest.php
@@ -414,4 +414,43 @@ public function isAttributeVisibleDataProvider()
['invalid_code', false]
];
}
+
+ /**
+ * Test is required filed by attribute code
+ *
+ * @param string $attributeCode
+ * @param bool $isMetadataExists
+ * @dataProvider isAttributeRequiredDataProvider
+ * @covers \Magento\Customer\Helper\Address::isAttributeRequired()
+ * @return void
+ */
+ public function testIsAttributeRequired($attributeCode, $isMetadataExists)
+ {
+ $attributeMetadata = null;
+ if ($isMetadataExists) {
+ $attributeMetadata = $this->getMockBuilder(\Magento\Customer\Api\Data\AttributeMetadataInterface::class)
+ ->getMockForAbstractClass();
+ $attributeMetadata->expects($this->once())
+ ->method('isRequired')
+ ->willReturn(true);
+ }
+ $this->addressMetadataService->expects($this->once())
+ ->method('getAttributeMetadata')
+ ->with($attributeCode)
+ ->willReturn($attributeMetadata);
+ $this->assertEquals($isMetadataExists, $this->helper->isAttributeRequired($attributeCode));
+ }
+
+ /**
+ * Data provider for test testIsAttributeRequire
+ *
+ * @return array
+ */
+ public function isAttributeRequiredDataProvider()
+ {
+ return [
+ ['fax', true],
+ ['invalid_code', false]
+ ];
+ }
}
diff --git a/app/code/Magento/Customer/view/base/ui_component/customer_form.xml b/app/code/Magento/Customer/view/base/ui_component/customer_form.xml
index 4de6644b948fb..d2a9b3f44624d 100644
--- a/app/code/Magento/Customer/view/base/ui_component/customer_form.xml
+++ b/app/code/Magento/Customer/view/base/ui_component/customer_form.xml
@@ -486,9 +486,6 @@
-
- true
-
text
diff --git a/app/code/Magento/Newsletter/Controller/Subscriber/Unsubscribe.php b/app/code/Magento/Newsletter/Controller/Subscriber/Unsubscribe.php
index efc469e15deaa..88fa128162700 100644
--- a/app/code/Magento/Newsletter/Controller/Subscriber/Unsubscribe.php
+++ b/app/code/Magento/Newsletter/Controller/Subscriber/Unsubscribe.php
@@ -1,16 +1,21 @@
messageManager->addException($e, __('Something went wrong while unsubscribing you.'));
}
}
- $this->getResponse()->setRedirect($this->_redirect->getRedirectUrl());
+ /** @var \Magento\Backend\Model\View\Result\Redirect $redirect */
+ $redirect = $this->resultFactory->create(\Magento\Framework\Controller\ResultFactory::TYPE_REDIRECT);
+ $redirectUrl = $this->_redirect->getRedirectUrl();
+ return $redirect->setUrl($redirectUrl);
}
}
diff --git a/app/code/Magento/Payment/etc/config.xml b/app/code/Magento/Payment/etc/config.xml
index 9fe859c96a941..663734fb066c7 100644
--- a/app/code/Magento/Payment/etc/config.xml
+++ b/app/code/Magento/Payment/etc/config.xml
@@ -13,6 +13,7 @@
Magento\Payment\Model\Method\Free
pending
No Payment Information Required
+ authorize
0
1
diff --git a/app/code/Magento/Reports/Block/Adminhtml/Sales/Tax/Grid.php b/app/code/Magento/Reports/Block/Adminhtml/Sales/Tax/Grid.php
index 79deb27423be5..f65a2b964fb38 100644
--- a/app/code/Magento/Reports/Block/Adminhtml/Sales/Tax/Grid.php
+++ b/app/code/Magento/Reports/Block/Adminhtml/Sales/Tax/Grid.php
@@ -53,7 +53,8 @@ public function __construct(
}
/**
- * {@inheritdoc}
+ * @inheritdoc
+ *
* @codeCoverageIgnore
*/
protected function _construct()
@@ -64,7 +65,7 @@ protected function _construct()
}
/**
- * {@inheritdoc}
+ * @inheritdoc
*/
public function getResourceCollectionName()
{
@@ -74,7 +75,7 @@ public function getResourceCollectionName()
}
/**
- * {@inheritdoc}
+ * @inheritdoc
*/
protected function _prepareColumns()
{
@@ -123,7 +124,6 @@ protected function _prepareColumns()
[
'header' => __('Orders'),
'index' => 'orders_count',
- 'total' => 'sum',
'type' => 'number',
'sortable' => false,
'header_css_class' => 'col-qty',
diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/View/History.php b/app/code/Magento/Sales/Block/Adminhtml/Order/View/History.php
index 1912655a9292d..10b80b6f4e527 100644
--- a/app/code/Magento/Sales/Block/Adminhtml/Order/View/History.php
+++ b/app/code/Magento/Sales/Block/Adminhtml/Order/View/History.php
@@ -88,7 +88,8 @@ public function getStatuses()
*/
public function canSendCommentEmail()
{
- return $this->_salesData->canSendOrderCommentEmail($this->getOrder()->getStore()->getId());
+ return $this->_salesData->canSendOrderCommentEmail($this->getOrder()->getStore()->getId())
+ && $this->_authorization->isAllowed('Magento_Sales::email');
}
/**
diff --git a/app/code/Magento/SalesRule/Test/Mftf/Section/DiscountSection.xml b/app/code/Magento/SalesRule/Test/Mftf/Section/DiscountSection.xml
index cbab097c5291b..e14bfb554b3f6 100644
--- a/app/code/Magento/SalesRule/Test/Mftf/Section/DiscountSection.xml
+++ b/app/code/Magento/SalesRule/Test/Mftf/Section/DiscountSection.xml
@@ -8,8 +8,9 @@
diff --git a/app/code/Magento/Store/Test/Mftf/Data/StorePaymentMethodsData.xml b/app/code/Magento/Store/Test/Mftf/Data/StorePaymentMethodsData.xml
new file mode 100644
index 0000000000000..912399142fa61
--- /dev/null
+++ b/app/code/Magento/Store/Test/Mftf/Data/StorePaymentMethodsData.xml
@@ -0,0 +1,30 @@
+
+
+
+
+ active
+ orderStatus
+
+
+ 1
+
+
+ processing
+
+
+
+ zeroSubEnable
+ zeroSubOrderStatus
+
+
+ 1
+
+
+ 1
+
+
diff --git a/app/code/Magento/Store/Test/Mftf/Data/StoreShippingMethodsData.xml b/app/code/Magento/Store/Test/Mftf/Data/StoreShippingMethodsData.xml
new file mode 100644
index 0000000000000..6e3e7ce7eb0d3
--- /dev/null
+++ b/app/code/Magento/Store/Test/Mftf/Data/StoreShippingMethodsData.xml
@@ -0,0 +1,30 @@
+
+
+
+
+ active
+
+
+ 1
+
+
+
+
+ DefaultFreeShipping
+
+
+ 0
+
+
+
+ disableFreeShipping
+
+
+ 1
+
+
diff --git a/app/code/Magento/Store/Test/Mftf/Metadata/store_payment_methods-meta.xml b/app/code/Magento/Store/Test/Mftf/Metadata/store_payment_methods-meta.xml
new file mode 100644
index 0000000000000..cbad7265cbbd6
--- /dev/null
+++ b/app/code/Magento/Store/Test/Mftf/Metadata/store_payment_methods-meta.xml
@@ -0,0 +1,46 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ integer
+
+
+
+
+ integer
+
+
+
+
+
+
+
+
+
diff --git a/app/code/Magento/Store/Test/Mftf/Metadata/store_shipping_methods-meta.xml b/app/code/Magento/Store/Test/Mftf/Metadata/store_shipping_methods-meta.xml
new file mode 100644
index 0000000000000..83288ecfdaf71
--- /dev/null
+++ b/app/code/Magento/Store/Test/Mftf/Metadata/store_shipping_methods-meta.xml
@@ -0,0 +1,38 @@
+
+
+
+
+
+
+
+
+
+ string
+
+
+
+
+
+
+
+
+
+
+
+
+ integer
+
+
+
+
+
+
+
+
+
diff --git a/app/code/Magento/Tax/Model/ResourceModel/Report/Tax/Createdat.php b/app/code/Magento/Tax/Model/ResourceModel/Report/Tax/Createdat.php
index ebf699db552d6..60cb6fe2898ae 100644
--- a/app/code/Magento/Tax/Model/ResourceModel/Report/Tax/Createdat.php
+++ b/app/code/Magento/Tax/Model/ResourceModel/Report/Tax/Createdat.php
@@ -11,6 +11,9 @@
*/
namespace Magento\Tax\Model\ResourceModel\Report\Tax;
+/**
+ * Class for tax report resource model with aggregation by created at
+ */
class Createdat extends \Magento\Reports\Model\ResourceModel\Report\AbstractReport
{
/**
@@ -84,7 +87,7 @@ protected function _aggregateByOrder($aggregationField, $from, $to)
'order_status' => 'e.status',
'percent' => 'MAX(tax.' . $connection->quoteIdentifier('percent') . ')',
'orders_count' => 'COUNT(DISTINCT e.entity_id)',
- 'tax_base_amount_sum' => 'SUM(tax.base_amount * e.base_to_global_rate)',
+ 'tax_base_amount_sum' => 'SUM(tax.base_real_amount * e.base_to_global_rate)',
];
$select = $connection->select()->from(
diff --git a/app/code/Magento/Tax/Test/Mftf/ActionGroup/AdminTaxActionGroup.xml b/app/code/Magento/Tax/Test/Mftf/ActionGroup/AdminTaxActionGroup.xml
index 1a95bf0282b40..aaea515aa9017 100644
--- a/app/code/Magento/Tax/Test/Mftf/ActionGroup/AdminTaxActionGroup.xml
+++ b/app/code/Magento/Tax/Test/Mftf/ActionGroup/AdminTaxActionGroup.xml
@@ -115,4 +115,44 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/code/Magento/Tax/Test/Mftf/Data/TaxCodeData.xml b/app/code/Magento/Tax/Test/Mftf/Data/TaxCodeData.xml
index 42fd01357375e..36929ef2e3fa1 100644
--- a/app/code/Magento/Tax/Test/Mftf/Data/TaxCodeData.xml
+++ b/app/code/Magento/Tax/Test/Mftf/Data/TaxCodeData.xml
@@ -26,4 +26,16 @@
*
0
+
+ Texas
+ United States
+ 78729
+ 7.25
+
+
+ Texas
+ United States
+ 78729
+ 0.125
+
diff --git a/app/code/Magento/Tax/Test/Mftf/Section/AdminTaxReportsSection.xml b/app/code/Magento/Tax/Test/Mftf/Section/AdminTaxReportsSection.xml
new file mode 100644
index 0000000000000..80101687e173e
--- /dev/null
+++ b/app/code/Magento/Tax/Test/Mftf/Section/AdminTaxReportsSection.xml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
diff --git a/app/code/Magento/Tax/Test/Mftf/Section/AdminTaxRulesSection.xml b/app/code/Magento/Tax/Test/Mftf/Section/AdminTaxRulesSection.xml
index 9727c649d7e66..6c258f2de18e7 100644
--- a/app/code/Magento/Tax/Test/Mftf/Section/AdminTaxRulesSection.xml
+++ b/app/code/Magento/Tax/Test/Mftf/Section/AdminTaxRulesSection.xml
@@ -19,5 +19,14 @@
+
+
+
+
+
+
+
+
+
diff --git a/app/code/Magento/Tax/Test/Mftf/Test/AdminTaxReportGridTest.xml b/app/code/Magento/Tax/Test/Mftf/Test/AdminTaxReportGridTest.xml
new file mode 100644
index 0000000000000..68fe8087c4fcd
--- /dev/null
+++ b/app/code/Magento/Tax/Test/Mftf/Test/AdminTaxReportGridTest.xml
@@ -0,0 +1,222 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ $0.15
+ amountOfFirstTaxRate
+
+
+
+ $8.92
+ amountOfSecondTaxRate
+
+
+
+ $9.07
+ amountOfSubtotalTaxRate
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/lib/internal/Magento/Framework/MessageQueue/Test/Unit/Consumer/Config/XsdTest.php b/lib/internal/Magento/Framework/MessageQueue/Test/Unit/Consumer/Config/XsdTest.php
index 2e0120ad7ea82..448a8a3db7407 100644
--- a/lib/internal/Magento/Framework/MessageQueue/Test/Unit/Consumer/Config/XsdTest.php
+++ b/lib/internal/Magento/Framework/MessageQueue/Test/Unit/Consumer/Config/XsdTest.php
@@ -10,15 +10,26 @@ class XsdTest extends \PHPUnit\Framework\TestCase
/**
* @var string
*/
- protected $_schemaFile;
+ private $schemaFile;
+ /**
+ * @var string
+ */
+ private $schemaQueueFile;
+
+ /**
+ * Set up.
+ *
+ * @return void
+ */
protected function setUp()
{
if (!function_exists('libxml_set_external_entity_loader')) {
$this->markTestSkipped('Skipped on HHVM. Will be fixed in MAGETWO-45033');
}
$urnResolver = new \Magento\Framework\Config\Dom\UrnResolver();
- $this->_schemaFile = $urnResolver->getRealPath('urn:magento:framework-message-queue:etc/consumer.xsd');
+ $this->schemaFile = $urnResolver->getRealPath('urn:magento:framework-message-queue:etc/consumer.xsd');
+ $this->schemaQueueFile = $urnResolver->getRealPath('urn:magento:framework-message-queue:etc/queue.xsd');
}
/**
@@ -29,13 +40,13 @@ protected function setUp()
public function testExemplarXml($fixtureXml, array $expectedErrors)
{
$validationState = $this->createMock(\Magento\Framework\Config\ValidationStateInterface::class);
- $validationState->expects($this->any())
+ $validationState->expects($this->atLeastOnce())
->method('isValidationRequired')
->willReturn(true);
$messageFormat = '%message%';
$dom = new \Magento\Framework\Config\Dom($fixtureXml, $validationState, [], null, null, $messageFormat);
$actualErrors = [];
- $actualResult = $dom->validate($this->_schemaFile, $actualErrors);
+ $actualResult = $dom->validate($this->schemaFile, $actualErrors);
$this->assertEquals(empty($expectedErrors), $actualResult, "Validation result is invalid.");
$this->assertEquals($expectedErrors, $actualErrors, "Validation errors does not match.");
}
@@ -125,4 +136,106 @@ public function exemplarXmlDataProvider()
];
// @codingStandardsIgnoreEnd
}
+
+ /**
+ * @param string $fixtureXml
+ * @param array $expectedErrors
+ * @dataProvider exemplarQueueXmlDataProvider
+ */
+ public function testExemplarQueueXml($fixtureXml, array $expectedErrors)
+ {
+ $validationState = $this->createMock(\Magento\Framework\Config\ValidationStateInterface::class);
+ $validationState->expects($this->atLeastOnce())
+ ->method('isValidationRequired')
+ ->willReturn(true);
+ $messageFormat = '%message%';
+ $dom = new \Magento\Framework\Config\Dom($fixtureXml, $validationState, [], null, null, $messageFormat);
+ $actualErrors = [];
+ $actualResult = $dom->validate($this->schemaQueueFile, $actualErrors);
+ $this->assertEquals(empty($expectedErrors), $actualResult, "Validation result is invalid.");
+ $this->assertEquals($expectedErrors, $actualErrors, "Validation errors does not match.");
+ }
+
+ /**
+ * @return array
+ * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
+ */
+ public function exemplarQueueXmlDataProvider()
+ {
+ // @codingStandardsIgnoreStart
+ return [
+ 'valid' => [
+ '
+
+
+
+
+ ',
+ [],
+ ],
+ 'invalid handler format' => [
+ '
+
+
+
+
+ ',
+ [
+ "Element 'queue', attribute 'handler': [facet 'pattern'] The value 'handlerClass_One1::handlerMethod1' is not accepted by the pattern '[a-zA-Z0-9\\\\]+::[a-zA-Z0-9]+'.",
+ "Element 'queue', attribute 'handler': 'handlerClass_One1::handlerMethod1' is not a valid value of the atomic type 'handlerType'.",
+ "Element 'queue', attribute 'handler': [facet 'pattern'] The value 'handlerClassOne2::handler_Method2' is not accepted by the pattern '[a-zA-Z0-9\\\\]+::[a-zA-Z0-9]+'.",
+ "Element 'queue', attribute 'handler': 'handlerClassOne2::handler_Method2' is not a valid value of the atomic type 'handlerType'.",
+ ],
+ ],
+ 'invalid instance format' => [
+ '
+
+
+
+
+ ',
+ [
+ "Element 'queue', attribute 'consumerInstance': [facet 'pattern'] The value 'consumer_Class1' is not accepted by the pattern '[a-zA-Z0-9\\\\]+'.",
+ "Element 'queue', attribute 'consumerInstance': 'consumer_Class1' is not a valid value of the atomic type 'instanceType'.",
+ "Element 'queue', attribute 'consumerInstance': [facet 'pattern'] The value 'consumerClass_2' is not accepted by the pattern '[a-zA-Z0-9\\\\]+'.",
+ "Element 'queue', attribute 'consumerInstance': 'consumerClass_2' is not a valid value of the atomic type 'instanceType'.",
+ ],
+ ],
+ 'invalid maxMessages format' => [
+ '
+
+
+
+
+ ',
+ [
+ "Element 'queue', attribute 'maxMessages': 'ABC' is not a valid value of the atomic type 'xs:integer'.",
+ ],
+ ],
+ 'unexpected element' => [
+ '
+
+
+
+
+
+ ',
+ [
+ "Element 'unexpected': This element is not expected. Expected is ( queue ).",
+ ],
+ ],
+ 'unexpected attribute' => [
+ '
+
+
+
+
+ ',
+ [
+ "Element 'queue', attribute 'unexpected': The attribute 'unexpected' is not allowed.",
+ ],
+ ],
+ ];
+ // @codingStandardsIgnoreEnd
+ }
}
diff --git a/lib/internal/Magento/Framework/MessageQueue/etc/queue_base.xsd b/lib/internal/Magento/Framework/MessageQueue/etc/queue_base.xsd
index 4b326d637f274..bede197ec34de 100644
--- a/lib/internal/Magento/Framework/MessageQueue/etc/queue_base.xsd
+++ b/lib/internal/Magento/Framework/MessageQueue/etc/queue_base.xsd
@@ -41,7 +41,7 @@
-
+
@@ -53,7 +53,7 @@
-
+