|
@@ 39-64 (lines=26) @@
|
| 36 |
|
$this->assertInstanceOf(Extract\Events::class, $events); |
| 37 |
|
} |
| 38 |
|
|
| 39 |
|
public function testDateSwap() |
| 40 |
|
{ |
| 41 |
|
$extract = $this->getExtract(); |
| 42 |
|
$track = $this->getTrack(); |
| 43 |
|
|
| 44 |
|
$this->assertCount(0, $this->orm->source(Statistics::class)); |
| 45 |
|
|
| 46 |
|
$datetime1 = new \DateTime('now'); |
| 47 |
|
$datetime2 = new \DateTime('tomorrow'); |
| 48 |
|
|
| 49 |
|
$track->event('event1', 1, $datetime1); |
| 50 |
|
$track->event('event2', 1, $datetime1); |
| 51 |
|
$track->event('event2', 2, $datetime2); |
| 52 |
|
|
| 53 |
|
$this->assertCount(3, $this->orm->source(Statistics::class)); |
| 54 |
|
|
| 55 |
|
$start = new \DateTime('-2 days'); |
| 56 |
|
$end = new \DateTime('+2 days'); |
| 57 |
|
|
| 58 |
|
$range = new Extract\Range\DailyRange(); |
| 59 |
|
|
| 60 |
|
$this->assertEquals( |
| 61 |
|
$extract->events($start, $end, $range, ['event1']), |
| 62 |
|
$extract->events($end, $start, $range, ['event1']) |
| 63 |
|
); |
| 64 |
|
} |
| 65 |
|
|
| 66 |
|
public function testFillGaps() |
| 67 |
|
{ |
|
@@ 66-89 (lines=24) @@
|
| 63 |
|
); |
| 64 |
|
} |
| 65 |
|
|
| 66 |
|
public function testFillGaps() |
| 67 |
|
{ |
| 68 |
|
$extract = $this->getExtract(); |
| 69 |
|
$track = $this->getTrack(); |
| 70 |
|
|
| 71 |
|
$this->assertCount(0, $this->orm->source(Statistics::class)); |
| 72 |
|
|
| 73 |
|
$datetime1 = new \DateTime('now'); |
| 74 |
|
$datetime2 = new \DateTime('tomorrow'); |
| 75 |
|
|
| 76 |
|
$track->event('event1', 1, $datetime1); |
| 77 |
|
$track->event('event2', 1, $datetime1); |
| 78 |
|
$track->event('event2', 2, $datetime2); |
| 79 |
|
|
| 80 |
|
$this->assertCount(3, $this->orm->source(Statistics::class)); |
| 81 |
|
|
| 82 |
|
$start = new \DateTime('-2 days'); |
| 83 |
|
$end = new \DateTime('+2 days'); |
| 84 |
|
|
| 85 |
|
$range = new Extract\Range\DailyRange(); |
| 86 |
|
$events = $extract->events($start, $end, $range, ['event1']); |
| 87 |
|
|
| 88 |
|
$this->assertCount(5, $events->getRows()); |
| 89 |
|
} |
| 90 |
|
} |