cvs: pear /Services_Technorati package.xml package2.xml /Services_Technorati/test Services_Technorati_Test.php

From: Date: Sat, 10 Feb 2007 13:38:58 +0000
Subject: cvs: pear /Services_Technorati package.xml package2.xml /Services_Technorati/test Services_Technorati_Test.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-44603@lists.php.net to get a copy of this message
jystewart Sat Feb 10 13:38:58 2007 UTC Added files: /pear/Services_Technorati package2.xml Removed files: /pear/Services_Technorati package.xml Modified files: /pear/Services_Technorati/test Services_Technorati_Test.php Log: Switch to package2.xml

http://cvs.php.net/viewvc.cgi/pear/Services_Technorati/test/Services_Technorati_Test.php?r1=1.4&r2=1.5&diff_format=u Index: pear/Services_Technorati/test/Services_Technorati_Test.php diff -u pear/Services_Technorati/test/Services_Technorati_Test.php:1.4 pear/Services_Technorati/test/Services_Technorati_Test.php:1.5 --- pear/Services_Technorati/test/Services_Technorati_Test.php:1.4 Tue Oct 4 21:37:52 2005 +++ pear/Services_Technorati/test/Services_Technorati_Test.php Sat Feb 10 13:38:58 2007 @@ -1,24 +1,27 @@ <?php +require '../Services/Technorati2.php'; +require 'PHPUnit.php'; + class Services_Technorati_Test extends PHPUnit_Testcase { - // contains the object handle of our Technorati class. - var $tapi; - - // contains our API key - var $key = "492a5486316000b6c9797e05cd64d846"; - + // contains the object handle of our Technorati class. + var $tapi; + + // contains our API key + var $key = "492a5486316000b6c9797e05cd64d846"; + /* constructor for test suite */ function Services_Technorati_Test($name) { - $this->PHPUnit_TestCase($name); + $this->PHPUnit_TestCase($name); } function setUp() { - $this->tapi =& Services_Technorati::factory($this->key, null, 1.0); + $this->tapi =& Services_Technorati::factory($this->key, null, 1.0); } function tearDown() { - unset($this->tapi); + unset($this->tapi); } /* Test that the factory brings the same result as going directly to the @@ -26,15 +29,15 @@ * version */ function testFactory() { - $testTapi = new Services_Technorati($this->key, null, 1.0); - $this->assertTrue($this->tapi == $testTapi); + $testTapi = new Services_Technorati($this->key, null, 1.0); + $this->assertTrue($this->tapi == $testTapi); } /* Test that the keyinfo query returns the two numeric values we need */ function testKeyInfo() { - $array = $this->tapi->keyInfo(); - $this->assertTrue(is_numeric($array['document']['result']['apiqueries']) - && is_numeric($array['document']['result']['maxqueries'])); + $array = $this->tapi->keyInfo(); + $this->assertTrue(is_numeric($array['document']['result']['apiqueries']) + && is_numeric($array['document']['result']['maxqueries'])); } /* Test that the result of a cosmos query is either a relevant PEAR error or an @@ -42,10 +45,10 @@ * passed is a URL. */ function testCosmos() { - $result = $this->tapi->cosmos('http://www.example.com'); - $this->assertTrue((is_array($result) && - $result['document']['result']['url'] == 'http://www.example.com') or - (PEAR::isError($result) && $result->message == 'Technorati Response Error')); + $result = $this->tapi->cosmos('http://www.example.com'); + $this->assertTrue((is_array($result) && + $result['document']['result']['url'] == 'http://www.example.com') or + (PEAR::isError($result) && $result->message == 'Technorati Response Error')); } /* Test that the result of a search query is either a relevant PEAR error or an @@ -54,9 +57,9 @@ */ function testSearch() { $result = $this->tapi->search('example'); - $this->assertTrue((is_array($result) && - $result['document']['result']['query'] == 'example') or - (PEAR::isError($result) && $result->message == 'Technorati Response Error')); + $this->assertTrue((is_array($result) && + $result['document']['result']['query'] == 'example') or + (PEAR::isError($result) && $result->message == 'Technorati Response Error')); } /* Test that the result of a getInfo query is either a relevant PEAR error or an @@ -65,9 +68,9 @@ */ function testGetInfo() { $result = $this->tapi->getInfo('jystewart'); - $this->assertTrue((is_array($result) && - $result['document']['result']['username'] == 'jystewart') or - (PEAR::isError($result) && $result->message == 'Technorati Response Error')); + $this->assertTrue((is_array($result) && + $result['document']['result']['username'] == 'jystewart') or + (PEAR::isError($result) && $result->message == 'Technorati Response Error')); } /* Test that the result of an outbound query is either a relevant PEAR error or an @@ -76,9 +79,9 @@ */ function testOutbound() { $result = $this->tapi->outbound('http://www.example.com'); - $this->assertTrue((is_array($result) && - $result['document']['result']['url'] == 'http://www.example.com') or - (PEAR::isError($result) && $result->message == 'Technorati Response Error')); + $this->assertTrue((is_array($result) && + $result['document']['result']['url'] == 'http://www.example.com') or + (PEAR::isError($result) && $result->message == 'Technorati Response Error')); } @@ -88,9 +91,9 @@ */ function testBlogInfo() { $result = $this->tapi->blogInfo('http://www.example.com'); - $this->assertTrue((is_array($result) && - $result['document']['result']['url'] == 'http://www.example.com') or - (PEAR::isError($result) && $result->message == 'Technorati Response Error')); + $this->assertTrue((is_array($result) && + $result['document']['result']['url'] == 'http://www.example.com') or + (PEAR::isError($result) && $result->message == 'Technorati Response Error')); } /* Test that the result of a tag query is either a relevant PEAR error or an @@ -99,9 +102,9 @@ */ function testTag() { $result = $this->tapi->tag('example'); - $this->assertTrue((is_array($result) && - $result['document']['result']['query'] == 'example') or - (PEAR::isError($result) && $result->message == 'Technorati Response Error')); + $this->assertTrue((is_array($result) && + $result['document']['result']['query'] == 'example') or + (PEAR::isError($result) && $result->message == 'Technorati Response Error')); } /* Test that the result of a TopTags query is either a relevant PEAR error or an @@ -109,14 +112,14 @@ */ function testTopTags() { $result = $this->tapi->topTags(); - $this->assertTrue((is_array($result) && - is_numeric($result['document']['result']['limit'])) or - (PEAR::isError($result) && $result->message == 'Technorati Response Error')); + $this->assertTrue((is_array($result) && + is_numeric($result['document']['result']['limit'])) or + (PEAR::isError($result) && $result->message == 'Technorati Response Error')); } /* Send a query that doesn't exist and test for error */ function test_sendRequest_404() { - $this->assertTrue(PEAR::isError($this->tapi->_sendRequest("example"))); + $this->assertTrue(PEAR::isError($this->tapi->_sendRequest("example"))); } /* The ideal here would be to validate the return value against @@ -124,34 +127,34 @@ * returns an array */ function test_sendRequest_success() { - $result = $this->tapi->_sendRequest('cosmos', array('url' => 'http://www.example.com')); + $result = $this->tapi->_sendRequest('cosmos', array('url' => 'http://www.example.com')); $this->assertTrue((is_array($result) && - $result['document']['result']['url'] == 'http://www.example.com') or - (PEAR::isError($result) && $result->message == 'Technorati Response Error')); + $result['document']['result']['url'] == 'http://www.example.com') or + (PEAR::isError($result) && $result->message == 'Technorati Response Error')); } function test_checkOptions_extraoptions() { - $current = array( - 'value1' => 1, - 'value2' => 1, - 'value3' => 1, - 'valuea' => 1, - 'valueb' => 1); - $allowed = array('value1','value3','valueb'); - $this->assertTrue( - array_keys($this->tapi->_checkOptions($current, $allowed)) == $allowed); + $current = array( + 'value1' => 1, + 'value2' => 1, + 'value3' => 1, + 'valuea' => 1, + 'valueb' => 1); + $allowed = array('value1','value3','valueb'); + $this->assertTrue( + array_keys($this->tapi->_checkOptions($current, $allowed)) == $allowed); } function test_checkOptions_success() { - $current = array( - 'value1' => 1, - 'value2' => 1, - 'value3' => 1, - 'valuea' => 1, - 'valueb' => 1); - $allowed = array('value1','value2','value3','valuea','valueb'); - $this->assertTrue( - array_keys($this->tapi->_checkOptions($current, $allowed)) == $allowed); + $current = array( + 'value1' => 1, + 'value2' => 1, + 'value3' => 1, + 'valuea' => 1, + 'valueb' => 1); + $allowed = array('value1','value2','value3','valuea','valueb'); + $this->assertTrue( + array_keys($this->tapi->_checkOptions($current, $allowed)) == $allowed); } } http://cvs.php.net/viewvc.cgi/pear/Services_Technorati/package2.xml?view=markup&rev=1.1 Index: pear/Services_Technorati/package2.xml +++ pear/Services_Technorati/package2.xml <?xml version="1.0" encoding="UTF-8"?> <package packagerversion="1.5.0" version="2.0" xmlns="http://pear.php.net/dtd/package-2.0" xmlns:tasks="http://pear.php.net/dtd/tasks-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://pear.php.net/dtd/tasks-1.0 http://pear.php.net/dtd/tasks-1.0.xsd http://pear.php.net/dtd/package-2.0 http://pear.php.net/dtd/package-2.0.xsd"> <name>Services_Technorati</name> <channel>pear.php.net</channel> <summary>A class for interacting with the Technorati API</summary> <description>Services_Technorati is a wrapper for the REST-based Technorati webservices API. Technorati is a blog search engine that provides a number of interfaces for interacting with recent blog entries, such as searching for entries that link to a certain URL, are linked from a certain URL, or have been given certain tags. Services_Technorati provides an interface to all of the query types in Technorati API version 1.0, and supports filesystem caching of query data using Cache_Lite compatible cache objects. </description> <lead> <name>James Stewart</name> <user>jystewart</user> <email>james@jystewart.net</email> <active>yes</active> </lead> <developer> <name>Ryan King</name> <user>ryansking</user> <email>ryansking@php.net</email> <active>yes</active> </developer> <date>2007-02-10</date> <time>08:38:27</time> <version> <release>0.6.7beta</release> <api>0.6.7beta</api> </version> <stability> <release>beta</release> <api>beta</api> </stability> <license uri="http://www.php.net/license">PHP License</license> <notes>Added run-tests.php test harness </notes> <contents> <dir name="/"> <dir name="Services"> <file baseinstalldir="" name="Technorati.php" role="php"> <tasks:replace from="@package_version@" to="version" type="package-info" /> </file> </dir> <!-- /Services --> <dir name="test"> <file baseinstalldir="" name="run-tests.php" role="test" /> <file baseinstalldir="" name="Services_Technorati_Test.php" role="test" /> </dir> <!-- /test --> </dir> <!-- / --> </contents> <dependencies> <required> <php> <min>4.0.0</min> </php> <pearinstaller> <min>1.4.0b1</min> </pearinstaller> <package> <name>XML_Serializer</name> <channel>pear.php.net</channel> </package> <package> <name>HTTP_Request</name> <channel>pear.php.net</channel> </package> </required> <optional> <package> <name>Cache_Lite</name> <channel>pear.php.net</channel> </package> </optional> </dependencies> <phprelease /> <changelog> <release> <version> <release>0.6.6beta</release> <api>0.6.6beta</api> </version> <stability> <release>beta</release> <api>beta</api> </stability> <date>2005-09-24</date> <license uri="http://www.php.net/license">PHP License</license> <notes>Cleaning up docblocks and versioning data Changed license to LGPL Fixed bug in return value of _checkOptions() Fixed typo in topTags method </notes> </release> <release> <version> <release>0.6.5beta</release> <api>0.6.5beta</api> </version> <stability> <release>beta</release> <api>beta</api> </stability> <date>2005-09-22</date> <license uri="http://www.php.net/license">PHP License</license> <notes>Resolved bug #5500 - misuse of array_merge </notes> </release> <release> <version> <release>0.6.4beta</release> <api>0.6.4beta</api> </version> <stability> <release>beta</release> <api>beta</api> </stability> <date>2005-09-04</date> <license uri="http://www.php.net/license">PHP License</license> <notes>Added support for new blogPostTags API method Refactored most calls and broke up _sendRequest method Fixed typos in comments </notes> </release> <release> <version> <release>0.6.3alpha</release> <api>0.6.3alpha</api> </version> <stability> <release>alpha</release> <api>alpha</api> </stability> <date>2005-05-01</date> <license uri="http://www.php.net/license">PHP License</license> <notes>Completed unit tests and made several minor changes (mainly type checking) as a result Added checks to be sure we have a cache object before trying to use it. </notes> </release> <release> <version> <release>0.6.2alpha</release> <api>0.6.2alpha</api> </version> <stability> <release>alpha</release> <api>alpha</api> </stability> <date>2005-05-01</date> <license uri="http://www.php.net/license">PHP License</license> <notes>Removed debug code that had been left in (thanks to Greg Beaver for spotting this) </notes> </release> <release> <version> <release>0.6.1alpha</release> <api>0.6.1alpha</api> </version> <stability> <release>alpha</release> <api>alpha</api> </stability> <date>2005-05-01</date> <license uri="http://www.php.net/license">PHP License</license> <notes>Cleaned up factory method. This should now be the standard way to instantiate No longer dependent on Cache_Lite (instead accepts handle for external cache) Added initial unit tests </notes> </release> <release> <version> <release>0.6.0alpha</release> <api>0.6.0alpha</api> </version> <stability> <release>alpha</release> <api>alpha</api> </stability> <date>2005-04-17</date> <license uri="http://www.php.net/license">PHP License</license> <notes>Clean up to match coding standards (thanks to Ryan King for assistance) </notes> </release> <release> <version> <release>0.5.6</release> <api>0.5.6</api> </version> <stability> <release>devel</release> <api>devel</api> </stability> <date>2005-04-16</date> <license uri="http://www.php.net/license">PHP License</license> <notes>Fixed parse error on line 586 (bug #4166) Now checks returns from all calls to $this-&gt;_checkOptions and returns error on failure (bug (bug #4167) Cleaned up topTags() function </notes> </release> <release> <version> <release>0.5.5</release> <api>0.5.5</api> </version> <stability> <release>devel</release> <api>devel</api> </stability> <date>2005-04-05</date> <license uri="http://www.php.net/license">PHP License</license> <notes>Removed &apos;query&apos; from method names. First release on PEAR site </notes> </release> <release> <version> <release>0.5.4</release> <api>0.5.4</api> </version> <stability> <release>devel</release> <api>devel</api> </stability> <date>2005-03-21</date> <license uri="http://www.php.net/license">PHP License</license> <notes>Added support for TopTags query Made fact that caching is optional more explicit Cleaned up error handling Added factory method </notes> </release> <release> <version> <release>0.52</release> <api>0.52</api> </version> <stability> <release>devel</release> <api>devel</api> </stability> <date>2005-03-02</date> <license uri="http://www.php.net/license">PHP License</license> <notes>Added support for keyInfo query </notes> </release> <release> <version> <release>0.51</release> <api>0.51</api> </version> <stability> <release>devel</release> <api>devel</api> </stability> <date>2005-02-22</date> <license uri="http://www.php.net/license">PHP License</license> <notes>Switched caching to use Cache_Lite </notes> </release> <release> <version> <release>0.5</release> <api>0.5</api> </version> <stability> <release>devel</release> <api>devel</api> </stability> <date>2005-02-08</date> <license uri="http://www.php.net/license">PHP License</license> <notes>Refactored package into PEAR style Brought up to date with API version 1.0 </notes> </release> </changelog> </package>
« previous php.pear.cvs (#44603) next »