Example #1
0
 function xtestGetCurrentActivities()
 {
     $a = new Services_Gnip_Activity('2008-07-02T11:16:16+00:00', 'upload', 'sally', 'blog_post', 'web', 'trains,planes,automobiles', 'bob', 'http://example.com');
     $this->helper->expect('get', '/publishers/digg/activity/current.xml', array('and_return' => "<activities>" . $a->toXML() . "</activities>"));
     $activities = $this->gnip->getPublisherActivities(new Services_Gnip_Publisher('digg', array()));
     $this->assertEquals($a, $activities[0]);
 }
Example #2
0
 /**
  * Test the ability to get the activities for a Gnip publisher.
  *
  * @access    public
  * @param     void
  * @return    void
  */
 function testGetCurrentActivities()
 {
     $a = new Services_Gnip_Activity("2008-07-02T11:16:16+00:00", "upload", "sally", "blog_post", "web", "trains,planes,automobiles", "bob", "http://example.com");
     $this->helper->expect("get", "/publishers/digg/activity/current.xml", array("and_return" => "<activities>" . $a->toXML() . "</activities>"));
     $activities = $this->gnip->getPublisherActivities(new Services_Gnip_Publisher("digg"));
     $this->assertEquals($a, $activities[0]);
 }
Example #3
0
 /**
  * Test the ability to create a Gnip activity (with string values),
  * and compare against identical values in XML document.
  *
  * @access    public
  * @param     void
  * @return    void
  */
 function testToXml()
 {
     $xml = '<activity at="2008-07-02T11:16:16+00:00" action="upload" actor="sally" ' . 'regarding="blog_post" source="web" tags="trains,planes,automobiles" ' . 'to="bob" url="http://example.com"/>';
     $a = new Services_Gnip_Activity("2008-07-02T11:16:16+00:00", "upload", "sally", "blog_post", "web", "trains,planes,automobiles", "bob", "http://example.com");
     $this->assertEquals($xml, $a->toXML());
 }
Example #4
0
 function testToXMLWithPayloadMediaURLUnbounds()
 {
     $expected_xml = '<activity>' . '<at>2008-07-02T11:16:16+00:00</at>' . '<action>post</action>' . '<activityID>yk994589klsl</activityID>' . '<URL>http://www.gnipcentral.com</URL>' . '<source>web</source>' . '<source>sms</source>' . '<keyword>ping</keyword>' . '<keyword>pong</keyword>' . '<place><point>45.256 -71.92</point></place>' . '<place>' . '<point>22.778 -54.998</point><elev>5280</elev><floor>3</floor><featuretypetag>City</featuretypetag><featurename>Boulder</featurename>' . '</place>' . '<place><point>77.900 - 23.998</point></place>' . '<actor metaURL="http://www.gnipcentral.com/users/joe" uid="1222">Joe</actor>' . '<actor metaURL="http://www.gnipcentral.com/users/bob">Bob</actor>' . '<actor uid="1444">Susan</actor>' . '<destinationURL metaURL="http://somewhere.com/someplace">http://somewhere.com</destinationURL>' . '<destinationURL>http://flickr.com</destinationURL>' . '<tag metaURL="http://gnipcentral.com/tags/horses">horses</tag>' . '<tag>cows</tag>' . '<to metaURL="http://gnipcentral.com/users/mary">Mary</to>' . '<to>James</to>' . '<regardingURL metaURL="http://blogger.com/users/mary">http://blogger.com/users/posts/mary</regardingURL>' . '<regardingURL>http://blogger.com/users/posts/james</regardingURL>' . '<payload><title>title</title><body>body</body><mediaURL type="image" mimeType="image/png">http://www.flickr.com/tour</mediaURL><mediaURL type="movie" mimeType="video/quicktime">http://www.gnipcentral.com/login</mediaURL><raw>H4sIAAAAAAAAAytKLAcAVduzGgMAAAA=</raw></payload>' . '</activity>';
     $d = new Services_Gnip_Activity($this->at, $this->action, $this->activityID, $this->URL, $this->sourceArray, $this->keywordArray, $this->placeArray, $this->actorArray, $this->destinationURLArray, $this->tagArray, $this->toArray, $this->regardingURLArray, $this->payloadArray);
     $this->assertEquals($expected_xml, $d->toXML());
 }