public function testGetIntervalsWithoutSpecifiedPeriod() { $startDate = new \DateTime('-3 day'); $endDate = new \DateTime('+3 day'); $this->_model->setInterval($startDate, $endDate); $this->assertEquals(0, $this->_model->getSize()); }
public function testGetIntervalsWithoutSpecifiedPeriod() { $startDate = date('m/d/Y', strtotime('-3 day')); $endDate = date('m/d/Y', strtotime('+3 day')); $this->_model->setInterval($startDate, $endDate); $startDateMock = $this->getMock('Magento\\Framework\\Stdlib\\DateTime\\DateInterface', [], [], '', false); $endDateMock = $this->getMock('Magento\\Framework\\Stdlib\\DateTime\\DateInterface', [], [], '', false); $map = [[$startDate, null, null, $startDateMock], [$endDate, null, null, $endDateMock]]; $this->_factoryMock->expects($this->exactly(2))->method('create')->will($this->returnValueMap($map)); $startDateMock->expects($this->once())->method('compare')->with($endDateMock)->will($this->returnValue(true)); $this->assertEquals(0, $this->_model->getSize()); }
/** * @param string $period * @param \DateTime $fromDate * @param \DateTime $toDate * @param int $size * @dataProvider intervalsDataProvider * @return void */ public function testGetReports($period, $fromDate, $toDate, $size) { $this->collection->setPeriod($period); $this->collection->setInterval($fromDate, $toDate); $reports = $this->collection->getReports(); foreach ($reports as $report) { $this->assertInstanceOf('\\Magento\\Framework\\Object', $report); $reportData = $report->getData(); $this->assertTrue(empty($reportData['children'])); $this->assertTrue($reportData['is_empty']); } $this->assertEquals($size, count($reports)); }