@@ -190,26 +190,25 @@ public function testRetrieveByUrl()
190
190
191
191
public function testStoreTime ()
192
192
{
193
- $ dt = new \DateTime ('now ' );
194
- $ start = $ dt ->getTimestamp ();
193
+ $ start = $ now = time ();
195
194
196
195
for ($ i = 0 ; $ i < 3 ; ++$ i ) {
197
- $ dt -> modify ( ' +1 minute ' ) ;
196
+ $ now += 60 ;
198
197
$ profile = new Profile ('time_ ' .$ i );
199
198
$ profile ->setIp ('127.0.0.1 ' );
200
199
$ profile ->setUrl ('http://foo.bar ' );
201
- $ profile ->setTime ($ dt -> getTimestamp () );
200
+ $ profile ->setTime ($ now );
202
201
$ profile ->setMethod ('GET ' );
203
202
$ this ->storage ->write ($ profile );
204
203
}
205
204
206
- $ records = $ this ->storage ->find ('' , '' , 3 , 'GET ' , $ start , time () + 3 * 60 );
205
+ $ records = $ this ->storage ->find ('' , '' , 3 , 'GET ' , $ start , $ start + 3 * 60 );
207
206
$ this ->assertCount (3 , $ records , '->find() returns all previously added records ' );
208
207
$ this ->assertEquals ('time_2 ' , $ records [0 ]['token ' ], '->find() returns records ordered by time in descendant order ' );
209
208
$ this ->assertEquals ('time_1 ' , $ records [1 ]['token ' ], '->find() returns records ordered by time in descendant order ' );
210
209
$ this ->assertEquals ('time_0 ' , $ records [2 ]['token ' ], '->find() returns records ordered by time in descendant order ' );
211
210
212
- $ records = $ this ->storage ->find ('' , '' , 3 , 'GET ' , $ start , time () + 2 * 60 );
211
+ $ records = $ this ->storage ->find ('' , '' , 3 , 'GET ' , $ start , $ start + 2 * 60 );
213
212
$ this ->assertCount (2 , $ records , '->find() should return only first two of the previously added records ' );
214
213
}
215
214
0 commit comments