當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Parser::getEvents方法代碼示例

本文整理匯總了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&#039;re not centred around specific languages, technologies or disciplines; we believe there&#039;s stuff to learn from mixing everyone together. There&#039;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&#039;re not centred around specific languages, technologies or disciplines; we believe there&#039;s stuff to learn from mixing everyone together. There&#039;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&#039;re not centred around specific languages, technologies or disciplines; we believe there&#039;s stuff to learn from mixing everyone together. There&#039;s no cost to attend, and food and drink are provided.", $event2->getDescriptionHtml());
 }
開發者ID:JMB-Technology-Limited,項目名稱:HTMLIsAnEvent,代碼行數:28,代碼來源:SchemaTest.php

示例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());
 }
開發者ID:JMB-Technology-Limited,項目名稱:HTMLIsAnEvent,代碼行數:19,代碼來源:BothTest.php

示例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());
 }
開發者ID:JMB-Technology-Limited,項目名稱:HTMLIsAnEvent,代碼行數:20,代碼來源:HEventTest.php


注:本文中的Parser::getEvents方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。