3use PHPUnit\Framework\TestCase;
 
   15        $before = microtime() - 1000;
 
   18        $obj1 = 
new ilGeoLocation(1, 
"older", 0, 0, 
new \DateTimeImmutable($before));
 
   19        $obj2 = 
new ilGeoLocation(1, 
"newer", 0, 0, 
new \DateTimeImmutable($now));
 
   20        $mocked_repo = $this->createMock(ilGeoLocationRepository::class);
 
   21        $mocked_repo->expects($this->once())
 
   22                    ->method(
'getGeoLocationsByCoordinates')
 
   24                    ->will($this->returnValue(array($obj1, $obj2)));
 
   28        $result = $calc->calculateNearestExpiration(1, 2);
 
   31        $this->assertEqual($result, $before);
 
calculateNearestExpiration_validTime_correctNearestExpired()