@@ 99-118 (lines=20) @@ | ||
96 | $this->assertSame(3.57, $event->value); |
|
97 | } |
|
98 | ||
99 | public function testSignEventInc() |
|
100 | { |
|
101 | $track = $this->getTrack(); |
|
102 | ||
103 | $this->assertCount(0, $this->orm->source(Occurrence::class)); |
|
104 | $this->assertCount(0, $this->orm->source(Event::class)); |
|
105 | ||
106 | $datetime = new \DateTime('now'); |
|
107 | $track->event('some-event', 1.23, $datetime); |
|
108 | $track->event('some-event', -2.34, $datetime); |
|
109 | ||
110 | $this->assertCount(1, $this->orm->source(Occurrence::class)); |
|
111 | $this->assertCount(1, $this->orm->source(Event::class)); |
|
112 | ||
113 | /** @var Event $event */ |
|
114 | $event = $this->orm->source(Event::class)->findOne(); |
|
115 | ||
116 | $this->assertNotEmpty($event); |
|
117 | $this->assertSame(-1.11, $event->value); |
|
118 | } |
|
119 | ||
120 | public function testSignEventsInc() |
|
121 | { |
|
@@ 120-143 (lines=24) @@ | ||
117 | $this->assertSame(-1.11, $event->value); |
|
118 | } |
|
119 | ||
120 | public function testSignEventsInc() |
|
121 | { |
|
122 | $track = $this->getTrack(); |
|
123 | ||
124 | $this->assertCount(0, $this->orm->source(Occurrence::class)); |
|
125 | $this->assertCount(0, $this->orm->source(Event::class)); |
|
126 | ||
127 | $datetime = new \DateTime('now'); |
|
128 | $track->events([ |
|
129 | 'some-event' => 1.23, |
|
130 | ], $datetime); |
|
131 | $track->events([ |
|
132 | 'some-event' => -2.34, |
|
133 | ], $datetime); |
|
134 | ||
135 | $this->assertCount(1, $this->orm->source(Occurrence::class)); |
|
136 | $this->assertCount(1, $this->orm->source(Event::class)); |
|
137 | ||
138 | /** @var Event $event */ |
|
139 | $event = $this->orm->source(Event::class)->findOne(); |
|
140 | ||
141 | $this->assertNotEmpty($event); |
|
142 | $this->assertSame(-1.11, $event->value); |
|
143 | } |
|
144 | ||
145 | public function testZeroEventInc() |
|
146 | { |