@@ 40-57 (lines=18) @@ | ||
37 | $this->assertSame(3.57, $event->value); |
|
38 | } |
|
39 | ||
40 | public function testSignEventInc() |
|
41 | { |
|
42 | $track = $this->getTrack(); |
|
43 | ||
44 | $this->assertCount(0, $this->orm->source(Statistics::class)); |
|
45 | ||
46 | $datetime = new \DateTime('now'); |
|
47 | $track->event('some-event', 1.23, $datetime); |
|
48 | $track->event('some-event', -2.34, $datetime); |
|
49 | ||
50 | $this->assertCount(1, $this->orm->source(Statistics::class)); |
|
51 | ||
52 | /** @var Statistics $event */ |
|
53 | $event = $this->orm->source(Statistics::class)->findOne(); |
|
54 | ||
55 | $this->assertNotEmpty($event); |
|
56 | $this->assertSame(-1.11, $event->value); |
|
57 | } |
|
58 | ||
59 | public function testZeroEventInc() |
|
60 | { |
|
@@ 103-124 (lines=22) @@ | ||
100 | $this->assertCount(0, $this->orm->source(Statistics::class)); |
|
101 | } |
|
102 | ||
103 | public function testEventsInc() |
|
104 | { |
|
105 | $track = $this->getTrack(); |
|
106 | ||
107 | $this->assertCount(0, $this->orm->source(Statistics::class)); |
|
108 | ||
109 | $datetime = new \DateTime('now'); |
|
110 | $track->events([ |
|
111 | 'some-event' => 1.23, |
|
112 | ], $datetime); |
|
113 | $track->events([ |
|
114 | 'some-event' => 2.34, |
|
115 | ], $datetime); |
|
116 | ||
117 | $this->assertCount(1, $this->orm->source(Statistics::class)); |
|
118 | ||
119 | /** @var Statistics $event */ |
|
120 | $event = $this->orm->source(Statistics::class)->findOne(); |
|
121 | ||
122 | $this->assertNotEmpty($event); |
|
123 | $this->assertSame(3.57, $event->value); |
|
124 | } |
|
125 | ||
126 | public function testSignEventsInc() |
|
127 | { |
|
@@ 126-147 (lines=22) @@ | ||
123 | $this->assertSame(3.57, $event->value); |
|
124 | } |
|
125 | ||
126 | public function testSignEventsInc() |
|
127 | { |
|
128 | $track = $this->getTrack(); |
|
129 | ||
130 | $this->assertCount(0, $this->orm->source(Statistics::class)); |
|
131 | ||
132 | $datetime = new \DateTime('now'); |
|
133 | $track->events([ |
|
134 | 'some-event' => 1.23, |
|
135 | ], $datetime); |
|
136 | $track->events([ |
|
137 | 'some-event' => -2.34, |
|
138 | ], $datetime); |
|
139 | ||
140 | $this->assertCount(1, $this->orm->source(Statistics::class)); |
|
141 | ||
142 | /** @var Statistics $event */ |
|
143 | $event = $this->orm->source(Statistics::class)->findOne(); |
|
144 | ||
145 | $this->assertNotEmpty($event); |
|
146 | $this->assertSame(-1.11, $event->value); |
|
147 | } |
|
148 | ||
149 | public function testZeroEventsInc() |
|
150 | { |
|
@@ 149-170 (lines=22) @@ | ||
146 | $this->assertSame(-1.11, $event->value); |
|
147 | } |
|
148 | ||
149 | public function testZeroEventsInc() |
|
150 | { |
|
151 | $track = $this->getTrack(); |
|
152 | ||
153 | $this->assertCount(0, $this->orm->source(Statistics::class)); |
|
154 | ||
155 | $datetime = new \DateTime('now'); |
|
156 | $track->events([ |
|
157 | 'some-event' => 1.23, |
|
158 | ], $datetime); |
|
159 | $track->events([ |
|
160 | 'some-event' => 0, |
|
161 | ], $datetime); |
|
162 | ||
163 | $this->assertCount(1, $this->orm->source(Statistics::class)); |
|
164 | ||
165 | /** @var Statistics $event */ |
|
166 | $event = $this->orm->source(Statistics::class)->findOne(); |
|
167 | ||
168 | $this->assertNotEmpty($event); |
|
169 | $this->assertSame(1.23, $event->value); |
|
170 | } |
|
171 | } |