19 declare(strict_types=1);
28 'P12Y4M2DT56H900001M0S',
43 '2001-12-01T23:56:01.1234Z',
47 '2001-13897877-01T23:56:01.1234Z',
48 '2001-13897877-0123:56:01.1234Z',
55 foreach (self::CORRECT_DURS as $dur) {
56 $this->assertTrue($helper->matchesDurationPattern($dur));
58 foreach (self::WRONG_DURS as $dur) {
59 $this->assertFalse($helper->matchesDurationPattern($dur));
66 foreach (self::CORRECT_DATES as $date) {
67 $this->assertTrue($helper->matchesDatetimePattern($date));
69 foreach (self::WRONG_DATES as $date) {
70 $this->assertFalse($helper->matchesDatetimePattern($date));
78 [
'12',
'4',
'2',
'56',
'900001',
'0'],
83 foreach (self::CORRECT_DURS as $index => $dur) {
86 iterator_to_array($helper->durationToIterator($dur))
89 $this->assertEmpty(iterator_to_array($helper->durationToIterator(self::WRONG_DURS[0])));
97 $helper->durationToSeconds(self::CORRECT_DURS[3])
100 56 * 3600 + 4 * 30 * 24 * 3600,
101 $helper->durationToSeconds(self::CORRECT_DURS[1])
111 [
'2001',
'12',
'01',
'23',
'56',
'01',
'1234',
'Z']
113 foreach (self::CORRECT_DATES as $index => $date) {
116 iterator_to_array($helper->datetimeToIterator($date))
119 $this->assertEmpty(iterator_to_array($helper->datetimeToIterator(self::WRONG_DATES[0])));
130 foreach (self::CORRECT_DATES as $index => $date) {
133 $helper->datetimeToObject($date)->format(
'Y-m-d')
138 $helper->datetimeToObject(self::WRONG_DATES[0])->format(
'Y-m-d')
146 [12, 4, 2, 56, 900001, 0],
151 foreach ($int_arrays as $index => $int_array) {
153 self::CORRECT_DURS[$index],
154 $helper->durationFromIntegers(...$int_array)
162 $date = new \DateTimeImmutable(
'2013-07-09');
165 $helper->datetimeFromObject($date)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null