Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
AssertReportsUpdatedTimezone.php
Go to the documentation of this file.
1 <?php
8 
9 use Magento\Reports\Test\Page\Adminhtml\Statistics;
10 use Magento\Mtf\Constraint\AbstractConstraint;
11 
15 class AssertReportsUpdatedTimezone extends AbstractConstraint
16 {
23  public function processAssert(Statistics $reportStatistics)
24  {
25  $reportStatistics->open();
26  $dates = $reportStatistics->getGridBlock()->getRowsData(['updated_at']);
27  $currentDate = new \DateTime();
28  $currentDate->setTimezone(new \DateTimeZone($_ENV['magento_timezone']));
29  foreach ($dates as $date) {
30  \PHPUnit\Framework\Assert::assertContains(
31  $currentDate->format('M j, Y, g'),
32  date('M j, Y, g', strtotime($date['updated_at'])),
33  "Reports 'Updated' column values are displayed in an incorrect timezone."
34  );
35  }
36  }
37 
43  public function toString()
44  {
45  return "Reports 'Updated' column values are displayed in the correct timezone.";
46  }
47 }