fs_test_dummy_auth(); } function tearDown() { } function testUseragentParsing() { require_once FS_ABS_PATH . '/php/db-hit.php'; $agregators = array ( array("Feedfetcher-Google; (+http://www.google.com/feedfetcher.html; 8 subscribers; feed-id=723583932179907102)",8,"Feedfetcher-Google; (+http://www.google.com/feedfetcher.html; # subscribers; feed-id=723583932179907102)","Feedfetcher-Google; (+http://www.google.com/feedfetcher.html; # subscribers; feed-id=#)"), array("NewsGatorOnline/2.0 (http://www.newsgator.com; 11 subscribers)", 11, null,"NewsGatorOnline/2.0 (http://www.newsgator.com; # subscribers)"), array("Netvibes (http://www.netvibes.com/; 6 subscribers)", 6, null,"Netvibes (http://www.netvibes.com/; # subscribers)"), array("LiveJournal.com (webmaster@livejournal.com; for http://www.livejournal.com/users/tzafrir_feed/; 1 readers)",1, null,"LiveJournal.com (webmaster@livejournal.com; for http://www.livejournal.com/users/tzafrir_feed/; # readers)"), array("Mozilla/5.0 (blah blah; Aggregating on behalf of 12 subscriber(s) online at http://www.rojo.com/?feed-id=3939372) Gecko/20021130",12,"Mozilla/5.0 (blah blah; Aggregating on behalf of # subscriber(s) online at http://www.rojo.com/?feed-id=3939372) Gecko/20021130","Mozilla/5.0 (blah blah; Aggregating on behalf of # subscriber(s) online at http://www.rojo.com/?feed-id=#) Gecko/20021130"), array("RssFwd (compatible; MSIE 6.0; Mozilla/4.0; http://www.rssfwd.com/; 1 subscribers)",1,null,"RssFwd (compatible; MSIE 6.0; Mozilla/4.0; http://www.rssfwd.com/; # subscribers)"), array("FeedBlitz/1.0 (55 subscribers)",55,null,"FeedBlitz/1.0 (# subscribers)"), array("kb.Rmail (http://www.r-mail.org; 1 subscribers)",1,null,"kb.Rmail (http://www.r-mail.org; # subscribers)"), array("AideRSS/1.0 (aiderss.com); 50 subscribers",50,null,"AideRSS/1.0 (aiderss.com); # subscribers"), array("Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.5) Gecko/20070713 Firefox/2.0.0.5",1,null,"Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.5) Gecko/20070713 Firefox/2.0.0.5"), array("Some unknown aggregator, 90 subscribers; feed-id=123",90,"Some unknown aggregator, # subscribers; feed-id=123","Some unknown aggregator, # subscribers; feed-id=#"), array("Netvibes (http://www.netvibes.com/; 80 subscribers; feedId: 316953)",80,"Netvibes (http://www.netvibes.com/; # subscribers; feedId: 316953)","Netvibes (http://www.netvibes.com/; # subscribers; feedId: #)"), ); foreach($agregators as $a) { $original_useragent = $a[0]; $expected_subscribers = $a[1]; $expected_identifier = $a[2]; $expected_useragent = $a[3]; $res = fs_get_feed_hit_data($original_useragent, null); $this->assertEquals($expected_subscribers, $res->subscribers, "Error processing : $original_useragent"); $this->assertEquals($expected_identifier, $res->identifier, "Error processing : $original_useragent"); $this->assertEquals($expected_useragent, $res->useragent, "Error processing : $original_useragent"); } } function fs_test_dummy_auth() { $user = new stdClass(); $user->id = 1; $user->dummy = true; $user->name = "Dummy admin"; $user->security_level = SEC_ADMIN; $res = fs_start_user_session($user); if ($res) fs_store_session(); } } ?>