3 namespace Sabre\VObject\Component;
5 use Sabre\VObject\Component;
7 class VJournalTest extends \PHPUnit_Framework_TestCase {
10 * @dataProvider timeRangeTestData
12 public function testInTimeRange(VJournal $vtodo,$start,$end,$outcome) {
14 $this->assertEquals($outcome, $vtodo->isInTimeRange($start, $end));
18 public function timeRangeTestData() {
22 $vjournal = Component::create('VJOURNAL');
23 $vjournal->DTSTART = '20111223T120000Z';
24 $tests[] = array($vjournal, new \DateTime('2011-01-01'), new \DateTime('2012-01-01'), true);
25 $tests[] = array($vjournal, new \DateTime('2011-01-01'), new \DateTime('2011-11-01'), false);
27 $vjournal2 = Component::create('VJOURNAL');
28 $vjournal2->DTSTART = '20111223';
29 $vjournal2->DTSTART['VALUE'] = 'DATE';
30 $tests[] = array($vjournal2, new \DateTime('2011-01-01'), new \DateTime('2012-01-01'), true);
31 $tests[] = array($vjournal2, new \DateTime('2011-01-01'), new \DateTime('2011-11-01'), false);
33 $vjournal3 = Component::create('VJOURNAL');
34 $tests[] = array($vjournal3, new \DateTime('2011-01-01'), new \DateTime('2012-01-01'), false);
35 $tests[] = array($vjournal3, new \DateTime('2011-01-01'), new \DateTime('2011-11-01'), false);