]> git.mxchange.org Git - friendica-addons.git/blob - dav/sabre-vobject/tests/Sabre/VObject/Component/VJournalTest.php
removed community home addon
[friendica-addons.git] / dav / sabre-vobject / tests / Sabre / VObject / Component / VJournalTest.php
1 <?php
2
3 namespace Sabre\VObject\Component;
4
5 use Sabre\VObject\Component;
6
7 class VJournalTest extends \PHPUnit_Framework_TestCase {
8
9     /**
10      * @dataProvider timeRangeTestData
11      */
12     public function testInTimeRange(VJournal $vtodo,$start,$end,$outcome) {
13
14         $this->assertEquals($outcome, $vtodo->isInTimeRange($start, $end));
15
16     }
17
18     public function timeRangeTestData() {
19
20         $tests = array();
21
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);
26
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);
32
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);
36
37         return $tests;
38     }
39
40 }
41