ILIAS
release_5-4 Revision v5.4.26-12-gabc799a52e6
◀ ilDoc Overview
RDateIteratorTest.php
Go to the documentation of this file.
1
<?
php
2
3
namespace
Sabre\VObject\Recur
;
4
5
use
DateTimeImmutable
;
6
use
DateTimeZone
;
7
use
PHPUnit\Framework\TestCase
;
8
9
class
RDateIteratorTest
extends
TestCase {
10
11
function
testSimple
() {
12
13
$utc =
new
DateTimeZone
(
'UTC'
);
14
$it =
new
RDateIterator
(
'20140901T000000Z,20141001T000000Z'
,
new
DateTimeImmutable
(
'2014-08-01 00:00:00'
, $utc));
15
16
$expected = [
17
new
DateTimeImmutable
(
'2014-08-01 00:00:00'
, $utc),
18
new
DateTimeImmutable
(
'2014-09-01 00:00:00'
, $utc),
19
new
DateTimeImmutable
(
'2014-10-01 00:00:00'
, $utc),
20
];
21
22
$this->assertEquals(
23
$expected,
24
iterator_to_array($it)
25
);
26
27
$this->assertFalse($it->isInfinite());
28
29
}
30
31
function
testTimezone
() {
32
33
$tz
=
new
DateTimeZone
(
'Europe/Berlin'
);
34
$it =
new
RDateIterator
(
'20140901T000000,20141001T000000'
,
new
DateTimeImmutable
(
'2014-08-01 00:00:00'
,
$tz
));
35
36
$expected = [
37
new
DateTimeImmutable
(
'2014-08-01 00:00:00'
,
$tz
),
38
new
DateTimeImmutable
(
'2014-09-01 00:00:00'
,
$tz
),
39
new
DateTimeImmutable
(
'2014-10-01 00:00:00'
,
$tz
),
40
];
41
42
$this->assertEquals(
43
$expected,
44
iterator_to_array($it)
45
);
46
47
48
$this->assertFalse($it->isInfinite());
49
50
}
51
52
53
function
testFastForward
() {
54
55
$utc =
new
DateTimeZone
(
'UTC'
);
56
$it =
new
RDateIterator
(
'20140901T000000Z,20141001T000000Z'
,
new
DateTimeImmutable
(
'2014-08-01 00:00:00'
, $utc));
57
58
$it->fastForward(
new
DateTimeImmutable
(
'2014-08-15 00:00:00'
));
59
60
$result
= [];
61
while
($it->valid()) {
62
$result
[] = $it->current();
63
$it->next();
64
}
65
66
$expected = [
67
new
DateTimeImmutable
(
'2014-09-01 00:00:00'
, $utc),
68
new
DateTimeImmutable
(
'2014-10-01 00:00:00'
, $utc),
69
];
70
71
$this->assertEquals(
72
$expected,
73
$result
74
);
75
76
$this->assertFalse($it->isInfinite());
77
78
}
79
}
DateTimeImmutable
DateTimeZone
$tz
$tz
Definition:
inc.setup_header.php:91
$result
$result
Definition:
CleanUpTest.php:463
Sabre\VObject\Recur
Definition:
EventIterator.php:3
Sabre\VObject\Recur\RDateIterator
RRuleParser.
Definition:
RDateIterator.php:22
Sabre\VObject\Recur\RDateIteratorTest\testFastForward
testFastForward()
Definition:
RDateIteratorTest.php:53
Sabre\VObject\Recur\RDateIteratorTest\testTimezone
testTimezone()
Definition:
RDateIteratorTest.php:31
Sabre\VObject\Recur\RDateIteratorTest\testSimple
testSimple()
Definition:
RDateIteratorTest.php:11
php
Sabre\VObject\Recur\RDateIteratorTest
Definition:
RDateIteratorTest.php:9
TestCase
libs
composer
vendor
sabre
vobject
tests
VObject
Recur
RDateIteratorTest.php
Generated on Thu Jan 16 2025 19:01:54 for ILIAS by
1.8.13 (using
Doxyfile
)