-
Notifications
You must be signed in to change notification settings - Fork 0
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
2676886
commit 2b33701
Showing
3 changed files
with
419 additions
and
13 deletions.
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,68 @@ | ||
<?php | ||
|
||
|
||
namespace JMBTechnologyLimited\HTMLIsAnEvent; | ||
|
||
|
||
/** | ||
* | ||
* @link https://github.com/JMB-Technology-Limited/HTMLIsAnEvent | ||
* @license https://raw.github.com/JMB-Technology-Limited/HTMLIsAnEvent/master/LICENSE.txt 3-clause BSD | ||
* @copyright (c) 2015, JMB Technology Limited, http://jmbtechnology.co.uk/ | ||
* @author James Baster <[email protected]> | ||
*/ | ||
class BothTest extends \PHPUnit_Framework_TestCase { | ||
|
||
function testFile1() { | ||
|
||
$parser = new Parser(file_get_contents(__DIR__.DIRECTORY_SEPARATOR."data".DIRECTORY_SEPARATOR."both1.html"), "http://example.com"); | ||
|
||
$events = $parser->getEvents(); | ||
|
||
$this->assertEquals(2, count($events)); | ||
|
||
|
||
############################### Event | ||
|
||
$event1 = $events[0]; | ||
|
||
|
||
$this->assertEquals("IndieWebCamp 2015",$event1->getTitle()); | ||
$this->assertEquals(1, $event1->getUrlsCount()); | ||
$this->assertEquals("http://indiewebcamp.com/2015",$event1->getUrls()[0]->getUrl()); | ||
|
||
|
||
$this->assertNotNull($event1->getStart()); | ||
$this->assertEquals("2015-07-11T16:30:00+00:00",$event1->getStart()->format("c")); | ||
$this->assertEquals("+00:00",$event1->getStart()->getTimezone()->getName()); | ||
|
||
$this->assertNotNull($event1->getEnd()); | ||
$this->assertEquals("2015-07-11T16:30:00+00:00",$event1->getEnd()->format("c")); | ||
$this->assertEquals("+00:00",$event1->getEnd()->getTimezone()->getName()); | ||
|
||
$this->assertNull($event1->getDescriptionHtml()); | ||
$this->assertNull($event1->getDescriptionText()); | ||
|
||
############################### Event | ||
|
||
$event2 = $events[1]; | ||
|
||
$this->assertEquals("IndieWebCamp 2015",$event2->getTitle()); | ||
$this->assertEquals(1, $event2->getUrlsCount()); | ||
$this->assertEquals("http://indiewebcamp.com/2015",$event2->getUrls()[0]->getUrl()); | ||
|
||
|
||
$this->assertNotNull($event2->getStart()); | ||
$this->assertEquals("2015-07-11T09:30:00+00:00",$event2->getStart()->format("c")); | ||
$this->assertEquals("UTC",$event2->getStart()->getTimezone()->getName()); | ||
|
||
$this->assertNotNull($event2->getEnd()); | ||
$this->assertEquals("2015-07-12T18:00:00+00:00",$event2->getEnd()->format("c")); | ||
$this->assertEquals("UTC",$event2->getEnd()->getTimezone()->getName()); | ||
|
||
$this->assertNull($event2->getDescriptionHtml()); | ||
$this->assertNull($event2->getDescriptionText()); | ||
} | ||
|
||
} | ||
|
Oops, something went wrong.