本文整理匯總了PHP中Parser::getEvents方法的典型用法代碼示例。如果您正苦於以下問題:PHP Parser::getEvents方法的具體用法?PHP Parser::getEvents怎麽用?PHP Parser::getEvents使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Parser
的用法示例。
在下文中一共展示了Parser::getEvents方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: Parser
function testFile2()
{
$parser = new Parser(file_get_contents(__DIR__ . DIRECTORY_SEPARATOR . "data" . DIRECTORY_SEPARATOR . "schema2.html"), "http://example.com");
$events = $parser->getEvents();
$this->assertEquals(2, count($events));
############################### Event
$event1 = $events[0];
$this->assertEquals("TechMeetup Edinburgh", $event1->getTitle());
$this->assertEquals(1, $event1->getUrlsCount());
$this->assertEquals("http://example.com/event/2595-techmeetup-edinburgh", $event1->getUrls()[0]->getUrl());
$this->assertNotNull($event1->getStart());
$this->assertEquals("2015-07-08T18:30:00+01:00", $event1->getStart()->format("c"));
$this->assertEquals("+01:00", $event1->getStart()->getTimezone()->getName());
$this->assertNull($event1->getEnd());
$this->assertEquals("Welcoming anyone involved or working in technology. TechMeetup is a monthly excuse for developers and the tech community around Scotland to meet up and learn new stuff from each other. No name badges, no sales pitches, just informative presentations from your peers and a chance to meet some of the tech community around you. We're not centred around specific languages, technologies or disciplines; we believe there's stuff to learn from mixing everyone together. There's no cost to attend, and food and drink are provided.", $event1->getDescriptionText());
$this->assertEquals("Welcoming anyone involved or working in technology.<br /> <br /> TechMeetup is a monthly excuse for developers and the tech community around Scotland to meet up and learn new stuff from each other. No name badges, no sales pitches, just informative presentations from your peers and a chance to meet some of the tech community around you.<br /> <br /> We're not centred around specific languages, technologies or disciplines; we believe there's stuff to learn from mixing everyone together. There's no cost to attend, and food and drink are provided.", $event1->getDescriptionHtml());
############################### Event
$event2 = $events[1];
$this->assertEquals("TechMeetup Edinburgh", $event2->getTitle());
$this->assertEquals(1, $event2->getUrlsCount());
$this->assertEquals("http://example.com/event/2596-techmeetup-edinburgh", $event2->getUrls()[0]->getUrl());
$this->assertNotNull($event2->getStart());
$this->assertEquals("2015-08-12T18:30:00+01:00", $event2->getStart()->format("c"));
$this->assertEquals("+01:00", $event2->getStart()->getTimezone()->getName());
$this->assertNull($event2->getEnd());
$this->assertEquals("Welcoming anyone involved or working in technology. TechMeetup is a monthly excuse for developers and the tech community around Scotland to meet up and learn new stuff from each other. No name badges, no sales pitches, just informative presentations from your peers and a chance to meet some of the tech community around you. We're not centred around specific languages, technologies or disciplines; we believe there's stuff to learn from mixing everyone together. There's no cost to attend, and food and drink are provided.", $event2->getDescriptionText());
$this->assertEquals("Welcoming anyone involved or working in technology.<br /> <br /> TechMeetup is a monthly excuse for developers and the tech community around Scotland to meet up and learn new stuff from each other. No name badges, no sales pitches, just informative presentations from your peers and a chance to meet some of the tech community around you.<br /> <br /> We're not centred around specific languages, technologies or disciplines; we believe there's stuff to learn from mixing everyone together. There's no cost to attend, and food and drink are provided.", $event2->getDescriptionHtml());
}
示例2: Parser
function testFile1()
{
$parser = new Parser(file_get_contents(__DIR__ . DIRECTORY_SEPARATOR . "data" . DIRECTORY_SEPARATOR . "both1.html"), "http://example.com");
$events = $parser->getEvents();
$this->assertEquals(1, 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());
}
示例3: Parser
function testFile2()
{
$parser = new Parser(file_get_contents(__DIR__ . DIRECTORY_SEPARATOR . "data" . DIRECTORY_SEPARATOR . "hevent2.html"), "http://example.com");
$events = $parser->getEvents();
$this->assertEquals(1, count($events));
############################### Event
$event1 = $events[0];
$this->assertEquals("Homebrew Website Club", $event1->getTitle());
$this->assertEquals(2, $event1->getUrlsCount());
$this->assertEquals("http://indiewebcamp.com/events/2015-07-15-homebrew-website-club", $event1->getUrls()[0]->getUrl());
$this->assertEquals("https://aaronparecki.com/events/2015/07/15/1/homebrew-website-club", $event1->getUrls()[1]->getUrl());
$this->assertNotNull($event1->getStart());
$this->assertEquals("2015-07-15T17:30:00-07:00", $event1->getStart()->format("c"));
$this->assertEquals("-07:00", $event1->getStart()->getTimezone()->getName());
$this->assertNotNull($event1->getEnd());
$this->assertEquals("2015-07-15T19:30:00-07:00", $event1->getEnd()->format("c"));
$this->assertEquals("-07:00", $event1->getEnd()->getTimezone()->getName());
$this->assertNull($event1->getDescriptionHtml());
$this->assertNull($event1->getDescriptionText());
}