@@ 15-34 (lines=20) @@ | ||
12 | */ |
|
13 | class StatisticsSourceTest extends BaseTest |
|
14 | { |
|
15 | public function testFindExtractWithEvents() |
|
16 | { |
|
17 | $track = $this->getTrack(); |
|
18 | ||
19 | $this->assertCount(0, $this->orm->source(Statistics::class)); |
|
20 | ||
21 | $datetime = new \DateTime(); |
|
22 | $track->events(['some-event' => 1.23, 'some-event2' => 2.34], $datetime); |
|
23 | ||
24 | $this->assertCount(2, $this->orm->source(Statistics::class)); |
|
25 | ||
26 | $this->assertCount(2, $this->getSource() |
|
27 | ->findExtract(new \DateTime('-1 day'), new \DateTime('+1 day'), [])); |
|
28 | ||
29 | $this->assertCount(1, $this->getSource() |
|
30 | ->findExtract(new \DateTime('-1 day'), new \DateTime('+1 day'), ['some-event'])); |
|
31 | ||
32 | $this->assertCount(0, $this->getSource() |
|
33 | ->findExtract(new \DateTime('-1 day'), new \DateTime('+1 day'), ['some-event3'])); |
|
34 | } |
|
35 | ||
36 | public function testFindExtractWithDateRange() |
|
37 | { |
|
@@ 36-55 (lines=20) @@ | ||
33 | ->findExtract(new \DateTime('-1 day'), new \DateTime('+1 day'), ['some-event3'])); |
|
34 | } |
|
35 | ||
36 | public function testFindExtractWithDateRange() |
|
37 | { |
|
38 | $track = $this->getTrack(); |
|
39 | ||
40 | $this->assertCount(0, $this->orm->source(Statistics::class)); |
|
41 | ||
42 | $datetime = new \DateTime(); |
|
43 | $track->events(['some-event' => 1.23, 'some-event2' => 2.34], $datetime); |
|
44 | ||
45 | $this->assertCount(2, $this->orm->source(Statistics::class)); |
|
46 | ||
47 | $this->assertCount(0, $this->getSource() |
|
48 | ->findExtract(new \DateTime('-3 day'), new \DateTime('-1 day'), [])); |
|
49 | ||
50 | $this->assertCount(0, $this->getSource() |
|
51 | ->findExtract(new \DateTime('-3 day'), new \DateTime('-1 day'), ['some-event'])); |
|
52 | ||
53 | $this->assertCount(0, $this->getSource() |
|
54 | ->findExtract(new \DateTime('-3 day'), new \DateTime('-1 day'), ['some-event3'])); |
|
55 | } |
|
56 | ||
57 | public function testFindByEventNameAndDatetime() |
|
58 | { |