-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a3fd2c6
commit 9788388
Showing
3 changed files
with
110 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
<?php | ||
|
||
namespace JMBTechnologyLimited\ICalDissect; | ||
|
||
/** | ||
* | ||
* @link https://github.com/JMB-Technology-Limited/ICalDissect | ||
* @license https://raw.github.com/JMB-Technology-Limited/ICalDissect/master/LICENSE.txt 3-clause BSD | ||
* @copyright (c) 2014, JMB Technology Limited, http://jmbtechnology.co.uk/ | ||
* @author James Baster <[email protected]> | ||
*/ | ||
class GeoTest extends \PHPUnit_Framework_TestCase { | ||
|
||
function dataForTestGeo1() { | ||
return array( | ||
array('GeoExample.ics',37.5739497,-85.7399606), | ||
); | ||
} | ||
|
||
/** | ||
* @dataProvider dataForTestGeo1 | ||
*/ | ||
function testGeo1 ($filename, $lat, $lng) { | ||
$parser = new ICalParser(); | ||
$this->assertTrue($parser->parseFromFile(dirname(__FILE__)."/data/".$filename)); | ||
|
||
$events = $parser->getEvents(); | ||
$this->assertEquals(1, count($events)); | ||
|
||
/** @var $event ICalEvent */ | ||
$event = $events[0]; | ||
|
||
$this->assertTrue($event->hasGeo()); | ||
$this->assertEquals($lat, $event->getGeoLat()); | ||
$this->assertEquals($lng, $event->getGeoLng()); | ||
|
||
} | ||
|
||
function dataForTestNoGeo1() { | ||
return array( | ||
array('exdate1.ics'), | ||
); | ||
} | ||
|
||
/** | ||
* @dataProvider dataForTestNoGeo1 | ||
*/ | ||
function testNoGeo1 ($filename, $lat, $lng) { | ||
$parser = new ICalParser(); | ||
$this->assertTrue($parser->parseFromFile(dirname(__FILE__)."/data/".$filename)); | ||
|
||
$events = $parser->getEvents(); | ||
$this->assertEquals(1, count($events)); | ||
|
||
/** @var $event ICalEvent */ | ||
$event = $events[0]; | ||
|
||
$this->assertFalse($event->hasGeo()); | ||
} | ||
|
||
} | ||
|
24 changes: 24 additions & 0 deletions
24
tests/JMBTechnologyLimited/ICalDissect/data/GeoExample.ics
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
BEGIN:VCALENDAR | ||
VERSION:2.0 | ||
PRODID:-//ZContent.net//Zap Calendar 1.0//EN | ||
CALSCALE:GREGORIAN | ||
METHOD:PUBLISH | ||
BEGIN:VEVENT | ||
SUMMARY:Abraham Lincoln | ||
UID:[email protected] | ||
SEQUENCE:0 | ||
STATUS:CONFIRMED | ||
TRANSP:TRANSPARENT | ||
RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=2;BYMONTHDAY=12 | ||
DTSTART:20080212 | ||
DTEND:20080213 | ||
DTSTAMP:20150421T141403 | ||
CATEGORIES:U.S. Presidents,Civil War People | ||
LOCATION:Hodgenville\, Kentucky | ||
GEO:37.5739497;-85.7399606 | ||
DESCRIPTION:Born February 12\, 1809\nSixteenth President (1861-1865)\n\n\n | ||
\nhttp://AmericanHistoryCalendar.com | ||
URL:http://americanhistorycalendar.com/peoplecalendar/1,328-abraham-lincol | ||
n | ||
END:VEVENT | ||
END:VCALENDAR |