diff --git a/app/code/Magento/CatalogImportExport/Test/Mftf/ActionGroup/AdminExportActionGroup.xml b/app/code/Magento/CatalogImportExport/Test/Mftf/ActionGroup/AdminExportActionGroup.xml
index b9eea2b114634..65588daa96cc4 100644
--- a/app/code/Magento/CatalogImportExport/Test/Mftf/ActionGroup/AdminExportActionGroup.xml
+++ b/app/code/Magento/CatalogImportExport/Test/Mftf/ActionGroup/AdminExportActionGroup.xml
@@ -53,13 +53,34 @@
-
-
+
-
+
+
+
+
+
+
+
+
diff --git a/app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportBundleProductTest.xml b/app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportBundleProductTest.xml
index 1f5ae6b6905bc..f720cf30b8cc5 100644
--- a/app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportBundleProductTest.xml
+++ b/app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportBundleProductTest.xml
@@ -80,19 +80,15 @@
-
-
-
+
+
+
+
-
-
-
-
-
@@ -105,6 +101,10 @@
+
+
+
+
diff --git a/app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportGroupedProductWithSpecialPriceTest.xml b/app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportGroupedProductWithSpecialPriceTest.xml
index a587d71ba0e68..b350ea2cbdaca 100644
--- a/app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportGroupedProductWithSpecialPriceTest.xml
+++ b/app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportGroupedProductWithSpecialPriceTest.xml
@@ -48,19 +48,15 @@
-
-
-
+
+
+
+
-
-
-
-
-
@@ -69,6 +65,10 @@
+
+
+
+
diff --git a/app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportSimpleAndConfigurableProductsWithCustomOptionsTest.xml b/app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportSimpleAndConfigurableProductsWithCustomOptionsTest.xml
index 6f64da4693692..8adbf566b65ec 100644
--- a/app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportSimpleAndConfigurableProductsWithCustomOptionsTest.xml
+++ b/app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportSimpleAndConfigurableProductsWithCustomOptionsTest.xml
@@ -73,19 +73,15 @@
-
-
-
+
+
+
+
-
-
-
-
-
@@ -93,6 +89,10 @@
+
+
+
+
diff --git a/app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportSimpleProductAndConfigurableProductsWithAssignedImagesTest.xml b/app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportSimpleProductAndConfigurableProductsWithAssignedImagesTest.xml
index 993f1c9cd9da2..87552c5977545 100644
--- a/app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportSimpleProductAndConfigurableProductsWithAssignedImagesTest.xml
+++ b/app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportSimpleProductAndConfigurableProductsWithAssignedImagesTest.xml
@@ -89,19 +89,15 @@
-
-
-
+
+
+
+
-
-
-
-
-
@@ -109,6 +105,10 @@
+
+
+
+
diff --git a/app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportSimpleProductAssignedToMainWebsiteAndConfigurableProductAssignedToCustomWebsiteTest.xml b/app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportSimpleProductAssignedToMainWebsiteAndConfigurableProductAssignedToCustomWebsiteTest.xml
index 491d20604a08b..496abfb3b94ef 100644
--- a/app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportSimpleProductAssignedToMainWebsiteAndConfigurableProductAssignedToCustomWebsiteTest.xml
+++ b/app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportSimpleProductAssignedToMainWebsiteAndConfigurableProductAssignedToCustomWebsiteTest.xml
@@ -71,19 +71,15 @@
-
-
-
+
+
+
+
-
-
-
-
-
@@ -94,6 +90,10 @@
+
+
+
+
diff --git a/app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportSimpleProductWithCustomAttributeTest.xml b/app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportSimpleProductWithCustomAttributeTest.xml
index f671b54803e35..5d6554d89aef6 100644
--- a/app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportSimpleProductWithCustomAttributeTest.xml
+++ b/app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportSimpleProductWithCustomAttributeTest.xml
@@ -28,24 +28,24 @@
-
-
-
+
+
+
+
-
-
-
-
-
+
+
+
+
diff --git a/app/code/Magento/Checkout/Test/Mftf/ActionGroup/AssertStorefrontShoppingCartSummaryItemsActionGroup.xml b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/AssertStorefrontShoppingCartSummaryItemsActionGroup.xml
index 54fde1be70bce..9b963273b0409 100644
--- a/app/code/Magento/Checkout/Test/Mftf/ActionGroup/AssertStorefrontShoppingCartSummaryItemsActionGroup.xml
+++ b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/AssertStorefrontShoppingCartSummaryItemsActionGroup.xml
@@ -13,10 +13,11 @@
-
-
-
-
+
+
+
+
+
diff --git a/app/code/Magento/Checkout/Test/Mftf/ActionGroup/AssertStorefrontShoppingCartSummaryWithShippingActionGroup.xml b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/AssertStorefrontShoppingCartSummaryWithShippingActionGroup.xml
index 73dfad9cff4bb..49425b5cc5e55 100644
--- a/app/code/Magento/Checkout/Test/Mftf/ActionGroup/AssertStorefrontShoppingCartSummaryWithShippingActionGroup.xml
+++ b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/AssertStorefrontShoppingCartSummaryWithShippingActionGroup.xml
@@ -11,9 +11,8 @@
-
-
-
-
+
+
+
diff --git a/app/code/Magento/Checkout/Test/Mftf/Section/CheckoutCartSummarySection.xml b/app/code/Magento/Checkout/Test/Mftf/Section/CheckoutCartSummarySection.xml
index 0737186c92b20..ec1c1cc808cbc 100644
--- a/app/code/Magento/Checkout/Test/Mftf/Section/CheckoutCartSummarySection.xml
+++ b/app/code/Magento/Checkout/Test/Mftf/Section/CheckoutCartSummarySection.xml
@@ -14,7 +14,9 @@
-
+
+
+
diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddBundleDynamicProductToShoppingCartTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddBundleDynamicProductToShoppingCartTest.xml
index 9810fc04eaa01..cb34e1b3810b8 100644
--- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddBundleDynamicProductToShoppingCartTest.xml
+++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddBundleDynamicProductToShoppingCartTest.xml
@@ -89,8 +89,8 @@
-
-
+
+
diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddBundleDynamicProductToShoppingCartWithDisableMiniCartSidebarTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddBundleDynamicProductToShoppingCartWithDisableMiniCartSidebarTest.xml
index 60513fb122805..b9b88f0c6dfbd 100644
--- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddBundleDynamicProductToShoppingCartWithDisableMiniCartSidebarTest.xml
+++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddBundleDynamicProductToShoppingCartWithDisableMiniCartSidebarTest.xml
@@ -107,8 +107,8 @@
-
-
+
+
diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddConfigurableProductToShoppingCartTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddConfigurableProductToShoppingCartTest.xml
index b25b6ffe9b5da..90dc47ca9c215 100644
--- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddConfigurableProductToShoppingCartTest.xml
+++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddConfigurableProductToShoppingCartTest.xml
@@ -134,8 +134,8 @@
-
-
+
+
diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddDownloadableProductToShoppingCartTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddDownloadableProductToShoppingCartTest.xml
index 8a501ca7bc28f..7a4655bb19ce3 100644
--- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddDownloadableProductToShoppingCartTest.xml
+++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddDownloadableProductToShoppingCartTest.xml
@@ -49,7 +49,7 @@
-
+
diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddGroupedProductToShoppingCartTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddGroupedProductToShoppingCartTest.xml
index 7d624c464e0c2..03cc0a29435d5 100644
--- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddGroupedProductToShoppingCartTest.xml
+++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddGroupedProductToShoppingCartTest.xml
@@ -97,8 +97,8 @@
-
-
+
+
diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddOneBundleMultiSelectOptionToTheShoppingCartTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddOneBundleMultiSelectOptionToTheShoppingCartTest.xml
index df8993ad1c0e1..c852a1050fc38 100644
--- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddOneBundleMultiSelectOptionToTheShoppingCartTest.xml
+++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddOneBundleMultiSelectOptionToTheShoppingCartTest.xml
@@ -88,8 +88,8 @@
-
-
+
+
diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddTwoBundleMultiSelectOptionsToTheShoppingCartTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddTwoBundleMultiSelectOptionsToTheShoppingCartTest.xml
index d4f5e64dc67a1..7137804f12898 100644
--- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddTwoBundleMultiSelectOptionsToTheShoppingCartTest.xml
+++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddTwoBundleMultiSelectOptionsToTheShoppingCartTest.xml
@@ -86,8 +86,8 @@
-
-
+
+
diff --git a/app/code/Magento/Reports/Helper/Data.php b/app/code/Magento/Reports/Helper/Data.php
index 411c7dde14c9d..cd105eb5f4bfd 100644
--- a/app/code/Magento/Reports/Helper/Data.php
+++ b/app/code/Magento/Reports/Helper/Data.php
@@ -4,15 +4,13 @@
* See COPYING.txt for license details.
*/
-/**
- * Reports data helper
- */
namespace Magento\Reports\Helper;
use Magento\Framework\Data\Collection;
-use Magento\Framework\Stdlib\DateTime;
/**
+ * Reports data helper.
+ *
* @api
* @since 100.0.2
*/
@@ -63,22 +61,27 @@ public function getIntervals($from, $to, $period = self::REPORT_PERIOD_TYPE_DAY)
$dateStart = new \DateTime($from);
$dateEnd = new \DateTime($to);
+ $dateFormat = 'Y-m-d';
+ $dateInterval = new \DateInterval('P1D');
+ switch ($period) {
+ case self::REPORT_PERIOD_TYPE_MONTH:
+ $dateFormat = 'Y-m';
+ $dateInterval = new \DateInterval('P1M');
+ break;
+ case self::REPORT_PERIOD_TYPE_YEAR:
+ $dateFormat = 'Y';
+ $dateInterval = new \DateInterval('P1Y');
+ break;
+ }
while ($dateStart->diff($dateEnd)->invert == 0) {
- switch ($period) {
- case self::REPORT_PERIOD_TYPE_DAY:
- $intervals[] = $dateStart->format('Y-m-d');
- $dateStart->add(new \DateInterval('P1D'));
- break;
- case self::REPORT_PERIOD_TYPE_MONTH:
- $intervals[] = $dateStart->format('Y-m');
- $dateStart->add(new \DateInterval('P1M'));
- break;
- case self::REPORT_PERIOD_TYPE_YEAR:
- $intervals[] = $dateStart->format('Y');
- $dateStart->add(new \DateInterval('P1Y'));
- break;
- }
+ $intervals[] = $dateStart->format($dateFormat);
+ $dateStart->add($dateInterval);
}
+
+ if (!in_array($dateEnd->format($dateFormat), $intervals)) {
+ $intervals[] = $dateEnd->format($dateFormat);
+ }
+
return $intervals;
}
diff --git a/app/code/Magento/Reports/Test/Unit/Helper/DataTest.php b/app/code/Magento/Reports/Test/Unit/Helper/DataTest.php
index 25981c9d3cfcd..d92b51e8b9b78 100644
--- a/app/code/Magento/Reports/Test/Unit/Helper/DataTest.php
+++ b/app/code/Magento/Reports/Test/Unit/Helper/DataTest.php
@@ -6,34 +6,41 @@
namespace Magento\Reports\Test\Unit\Helper;
+use Magento\Framework\App\Helper\Context;
+use Magento\Framework\Data\Collection;
use Magento\Reports\Helper\Data;
+use Magento\Reports\Model\Item;
+use Magento\Reports\Model\ItemFactory;
+/**
+ * Unit tests for \Magento\Reports\Helper\Data class.
+ */
class DataTest extends \PHPUnit\Framework\TestCase
{
/**
- * @var \Magento\Reports\Helper\Data
+ * @var Data
*/
protected $data;
/**
- * @var \Magento\Framework\App\Helper\Context|\PHPUnit_Framework_MockObject_MockObject
+ * @var Context|\PHPUnit_Framework_MockObject_MockObject
*/
protected $contextMock;
/**
- * @var \Magento\Reports\Model\ItemFactory|\PHPUnit_Framework_MockObject_MockObject
+ * @var ItemFactory|\PHPUnit_Framework_MockObject_MockObject
*/
protected $itemFactoryMock;
/**
- * {@inheritDoc}
+ * @inheritdoc
*/
protected function setUp()
{
- $this->contextMock = $this->getMockBuilder(\Magento\Framework\App\Helper\Context::class)
+ $this->contextMock = $this->getMockBuilder(Context::class)
->disableOriginalConstructor()
->getMock();
- $this->itemFactoryMock = $this->getMockBuilder(\Magento\Reports\Model\ItemFactory::class)
+ $this->itemFactoryMock = $this->getMockBuilder(ItemFactory::class)
->setMethods(['create'])
->disableOriginalConstructor()
->getMock();
@@ -67,12 +74,12 @@ public function testGetIntervals($from, $to, $period, $results)
*/
public function testPrepareIntervalsCollection($from, $to, $period, $results)
{
- $collection = $this->getMockBuilder(\Magento\Framework\Data\Collection::class)
+ $collection = $this->getMockBuilder(Collection::class)
->disableOriginalConstructor()
->setMethods(['addItem'])
->getMock();
- $item = $this->getMockBuilder(\Magento\Reports\Model\Item::class)
+ $item = $this->getMockBuilder(Item::class)
->disableOriginalConstructor()
->setMethods(['setPeriod', 'setIsEmpty'])
->getMock();
@@ -103,44 +110,50 @@ public function intervalsDataProvider()
[
'from' => '2000-01-15 10:00:00',
'to' => '2000-01-15 11:00:00',
- 'period' => \Magento\Reports\Helper\Data::REPORT_PERIOD_TYPE_DAY,
- 'results' => ['2000-01-15']
+ 'period' => Data::REPORT_PERIOD_TYPE_DAY,
+ 'results' => ['2000-01-15'],
],
[
'from' => '2000-01-15 10:00:00',
'to' => '2000-01-17 10:00:00',
- 'period' => \Magento\Reports\Helper\Data::REPORT_PERIOD_TYPE_MONTH,
- 'results' => ['2000-01']
+ 'period' => Data::REPORT_PERIOD_TYPE_MONTH,
+ 'results' => ['2000-01'],
],
[
'from' => '2000-01-15 10:00:00',
'to' => '2000-02-15 10:00:00',
- 'period' => \Magento\Reports\Helper\Data::REPORT_PERIOD_TYPE_YEAR,
+ 'period' => Data::REPORT_PERIOD_TYPE_YEAR,
'results' => ['2000']
],
[
'from' => '2000-01-15 10:00:00',
'to' => '2000-01-16 11:00:00',
- 'period' => \Magento\Reports\Helper\Data::REPORT_PERIOD_TYPE_DAY,
- 'results' => ['2000-01-15', '2000-01-16']
+ 'period' => Data::REPORT_PERIOD_TYPE_DAY,
+ 'results' => ['2000-01-15', '2000-01-16'],
],
[
'from' => '2000-01-15 10:00:00',
'to' => '2000-02-17 10:00:00',
- 'period' => \Magento\Reports\Helper\Data::REPORT_PERIOD_TYPE_MONTH,
- 'results' => ['2000-01', '2000-02']
+ 'period' => Data::REPORT_PERIOD_TYPE_MONTH,
+ 'results' => ['2000-01', '2000-02'],
],
[
'from' => '2000-01-15 10:00:00',
'to' => '2003-02-15 10:00:00',
- 'period' => \Magento\Reports\Helper\Data::REPORT_PERIOD_TYPE_YEAR,
- 'results' => ['2000', '2001', '2002', '2003']
+ 'period' => Data::REPORT_PERIOD_TYPE_YEAR,
+ 'results' => ['2000', '2001', '2002', '2003'],
+ ],
+ [
+ 'from' => '2000-12-31 10:00:00',
+ 'to' => '2001-01-01 10:00:00',
+ 'period' => Data::REPORT_PERIOD_TYPE_YEAR,
+ 'results' => ['2000', '2001'],
],
[
'from' => '',
'to' => '',
- 'period' => \Magento\Reports\Helper\Data::REPORT_PERIOD_TYPE_YEAR,
- 'results' => []
+ 'period' => Data::REPORT_PERIOD_TYPE_YEAR,
+ 'results' => [],
]
];
}
diff --git a/dev/tests/functional/tests/app/Magento/Reports/Test/Constraint/AssertReportStatisticsNoticeMessage.php b/dev/tests/functional/tests/app/Magento/Reports/Test/Constraint/AssertReportStatisticsNoticeMessage.php
index f68666366a663..4abb2a6ead8a8 100644
--- a/dev/tests/functional/tests/app/Magento/Reports/Test/Constraint/AssertReportStatisticsNoticeMessage.php
+++ b/dev/tests/functional/tests/app/Magento/Reports/Test/Constraint/AssertReportStatisticsNoticeMessage.php
@@ -7,8 +7,6 @@
namespace Magento\Reports\Test\Constraint;
use Magento\Reports\Test\Page\Adminhtml\SalesReport;
-use Magento\Sales\Test\Fixture\OrderInjectable;
-use DateTime;
/**
* Assert that message in Sales Reports Pages displays correct date/time.
@@ -27,22 +25,22 @@ class AssertReportStatisticsNoticeMessage extends AbstractAssertSalesReportResul
*
* @param array $salesReport
* @param SalesReport $salesReportPage
- * @param DateTime $currentDate
* @return void
*/
public function processAssert(
array $salesReport,
- SalesReport $salesReportPage,
- DateTime $currentDate
+ SalesReport $salesReportPage
) {
+ $timezone = new \DateTimeZone($_ENV['magento_timezone']);
+ $initialDate = new \DateTime('now', $timezone);
$this->salesReportPage = $salesReportPage;
$this->searchInSalesReportGrid($salesReport);
- $date = $this->getLastUpdatedDate();
- $currentDateTime = $currentDate->format('M j, Y, g');
- $displayedDateTime = date('M j, Y, g', strtotime($date));
- \PHPUnit\Framework\Assert::assertEquals(
- $currentDateTime,
- $displayedDateTime,
+ $displayedDate = new \DateTime($this->getLastUpdatedDate(), $timezone);
+ $currentDate = new \DateTime('now', $timezone);
+
+ \PHPUnit\Framework\Assert::assertTrue(
+ $displayedDate->getTimestamp() > $initialDate->getTimestamp()
+ && $displayedDate->getTimestamp() < $currentDate->getTimestamp(),
"Message in Sales Reports Page is displayed in an incorrect timezone."
);
}
diff --git a/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/SalesOrderReportEntityTest.xml b/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/SalesOrderReportEntityTest.xml
index 998102bcfbc45..20501b73813fd 100644
--- a/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/SalesOrderReportEntityTest.xml
+++ b/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/SalesOrderReportEntityTest.xml
@@ -22,7 +22,6 @@
- stable:no
default
full_invoice
Order Created
@@ -36,7 +35,6 @@
- stable:no
default
full_invoice
Order Updated
@@ -50,5 +48,19 @@
+
+ default
+ full_invoice
+ Order Created
+ Year
+ 12/31/Y 12:00 a-1 year
+ m/d/Y 12:00
+ Any
+ Yes
+ No
+
+
+
+
diff --git a/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/SalesRefundsReportEntityTest.xml b/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/SalesRefundsReportEntityTest.xml
index 27014c0afb375..58fad5925e5bf 100644
--- a/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/SalesRefundsReportEntityTest.xml
+++ b/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/SalesRefundsReportEntityTest.xml
@@ -20,7 +20,6 @@
- stable:no
assert refunds month report
default
full_invoice
@@ -33,7 +32,6 @@
- stable:no
assert refund Daily report
default
full_invoice