ILIAS
release_6 Revision v6.24-5-g0c8bfefb3b8
◀ ilDoc Overview
Main Page
Related Pages
Modules
+
Namespaces
Namespace List
+
Namespace Members
+
All
$
_
a
b
c
d
e
f
g
h
i
j
l
m
p
s
t
w
+
Functions
_
a
b
c
f
g
h
i
s
t
w
+
Variables
$
c
d
e
f
g
h
j
l
m
p
s
t
+
Data Structures
Data Structures
Data Structure Index
Class Hierarchy
+
Data Fields
+
All
$
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
+
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
+
Variables
$
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
+
Files
File List
+
Globals
+
All
$
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
+
Functions
_
a
b
c
d
e
f
g
h
i
l
m
n
o
p
r
s
t
u
v
w
x
+
Variables
$
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Examples
•
All
Data Structures
Namespaces
Files
Functions
Variables
Modules
Pages
ilGeoLocationCalculatorTest.php
Go to the documentation of this file.
1
<?
2
3
use
PHPUnit\Framework\TestCase
;
4
5
6
class
ilGeoLocationCalculatorTest
extends
TestCase
7
{
8
13
public
function
calculateNearestExpiration_validTime_correctNearestExpired
()
14
{
15
$now = microtime();
16
$before = microtime() - 1000;
17
18
// Arrange
19
$obj1 =
new
ilGeoLocation
(1,
"older"
, 0, 0,
new
\
DateTimeImmutable
($before));
20
$obj2 =
new
ilGeoLocation
(1,
"newer"
, 0, 0,
new
\
DateTimeImmutable
($now));
21
$mocked_repo = $this->createMock(ilGeoLocationRepository::class);
22
$mocked_repo->expects($this->once())
23
->method(
'getGeoLocationsByCoordinates'
)
24
->with(1, 2)
25
->will($this->returnValue(array($obj1, $obj2)));
26
$calc =
new
ilGeoLocationCalculator
($mocked_repo);
27
28
// Act
29
$result
= $calc->calculateNearestExpiration(1, 2);
30
31
// Assert
32
$this->assertEqual(
$result
, $before);
33
}
34
}
ilGeoLocationCalculatorTest
Definition:
ilGeoLocationCalculatorTest.php:6
DateTimeImmutable
$result
$result
Definition:
CleanUpTest.php:463
ilGeoLocationCalculatorTest\calculateNearestExpiration_validTime_correctNearestExpired
calculateNearestExpiration_validTime_correctNearestExpired()
Definition:
ilGeoLocationCalculatorTest.php:13
ilGeoLocation
Definition:
ilGeoLocation.php:3
TestCase
ilGeoLocationCalculator
Definition:
ilGeoLocationCalculator.php:3
docs
development
code-examples
repository-pattern
03_use_for_unit_tests
ilGeoLocationCalculatorTest.php
Generated on Fri Apr 25 2025 20:00:58 for ILIAS by
1.8.13 (using
Doxyfile
)