3 class Sabre_VObject_Component_VJournalTest extends PHPUnit_Framework_TestCase {
6 * @dataProvider timeRangeTestData
8 public function testInTimeRange(Sabre_VObject_Component_VJournal $vtodo,$start,$end,$outcome) {
10 $this->assertEquals($outcome, $vtodo->isInTimeRange($start, $end));
14 public function timeRangeTestData() {
18 $vjournal = Sabre_VObject_Component::create('VJOURNAL');
19 $vjournal->DTSTART = '20111223T120000Z';
20 $tests[] = array($vjournal, new DateTime('2011-01-01'), new DateTime('2012-01-01'), true);
21 $tests[] = array($vjournal, new DateTime('2011-01-01'), new DateTime('2011-11-01'), false);
23 $vjournal2 = Sabre_VObject_Component::create('VJOURNAL');
24 $vjournal2->DTSTART = '20111223';
25 $vjournal2->DTSTART['VALUE'] = 'DATE';
26 $tests[] = array($vjournal2, new DateTime('2011-01-01'), new DateTime('2012-01-01'), true);
27 $tests[] = array($vjournal2, new DateTime('2011-01-01'), new DateTime('2011-11-01'), false);
29 $vjournal3 = Sabre_VObject_Component::create('VJOURNAL');
30 $tests[] = array($vjournal3, new DateTime('2011-01-01'), new DateTime('2012-01-01'), false);
31 $tests[] = array($vjournal3, new DateTime('2011-01-01'), new DateTime('2011-11-01'), false);