当前位置: 首页>>代码示例>>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;未经允许,请勿转载。