File: bug2813.phpt

package info (click to toggle)
kronolith2 2.2-1
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 7,936 kB
  • ctags: 3,577
  • sloc: php: 14,001; xml: 1,494; sql: 489; makefile: 68
file content (83 lines) | stat: -rw-r--r-- 1,579 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
--TEST--
Bug #2813: Wrong recurrence end from imported iCalendar events.
--FILE--
<?php

class Driver {
    function getCalendar()
    {
        return 'foo';
    }
}
class Prefs {
    function getValue()
    {
        return 0;
    }
}
$prefs = new Prefs;

require 'Date/Calc.php';
require 'Horde/Date.php';
require 'Horde/Util.php';
require 'Horde/iCalendar.php';

$iCal = new Horde_iCalendar();
$iCal->parsevCalendar(file_get_contents(dirname(__FILE__) . '/bug2813.ics'));
$components = $iCal->getComponents();

putenv('TZ=US/Eastern');

define('KRONOLITH_BASE', dirname(__FILE__) . '/../..');
require KRONOLITH_BASE . '/lib/Kronolith.php';
require KRONOLITH_BASE . '/lib/Driver.php';
require KRONOLITH_BASE . '/lib/Recurrence.php';
$event = new Kronolith_Event(new Driver);
foreach ($components as $content) {
    if (is_a($content, 'Horde_iCalendar_vevent')) {
        $event->fromiCalendar($content);
        break;
    }
}

$after = array('year' => 2006, 'month' => 6);
for ($mday = 16; $mday <= 18; $mday++) {
    $after['mday'] = $mday;
    var_dump($event->recurrence->nextRecurrence($after));
}

?>
--EXPECT--
object(horde_date)(7) {
  ["year"]=>
  int(2006)
  ["month"]=>
  int(6)
  ["mday"]=>
  int(16)
  ["hour"]=>
  int(18)
  ["min"]=>
  int(0)
  ["sec"]=>
  int(0)
  ["_supportedSpecs"]=>
  string(21) "%CdDeHImMnRStTyYbBpxX"
}
object(horde_date)(7) {
  ["year"]=>
  int(2006)
  ["month"]=>
  int(6)
  ["mday"]=>
  int(17)
  ["hour"]=>
  int(18)
  ["min"]=>
  int(0)
  ["sec"]=>
  int(0)
  ["_supportedSpecs"]=>
  string(21) "%CdDeHImMnRStTyYbBpxX"
}
bool(false)