Commit: 8d892d71e989384dceb43e7faa91886c06c529cc

Author: gwoo | Date: 2009-11-30 16:16:16 -0800
fixing some errors
diff --git a/extensions/service/Oauth.php b/extensions/service/Oauth.php index fa1c914..17bc3d5 100644 --- a/extensions/service/Oauth.php +++ b/extensions/service/Oauth.php @@ -79,7 +79,7 @@ class Oauth extends \lithium\core\Object { if (isset($this->_config[$key])) { return $this->_config[$key]; } - if ($key) { + if ($key !== null) { return $key; } return $this->_config; diff --git a/extensions/storage/File.php b/extensions/storage/File.php index 48e1775..84f78fa 100644 --- a/extensions/storage/File.php +++ b/extensions/storage/File.php @@ -63,11 +63,11 @@ class File extends \lithium\core\Object { } return $data; } - + /** * undocumented function * - * @param string $key + * @param string $key * @return void */ public function remove($key) { diff --git a/models/Consumer.php b/models/Consumer.php index 0243ec1..a4762f7 100644 --- a/models/Consumer.php +++ b/models/Consumer.php @@ -117,7 +117,7 @@ class Consumer extends \lithium\core\StaticObject { } return "{$url}?oauth_token={$token}"; } - + /** * undocumented function * @@ -138,7 +138,7 @@ class Consumer extends \lithium\core\StaticObject { public static function fetch($key) { return static::$_service->storage->read($key); } - + /** * undocumented function * diff --git a/models/Provider.php b/models/Provider.php index 7155a7a..1c3a89a 100644 --- a/models/Provider.php +++ b/models/Provider.php @@ -113,7 +113,7 @@ class Provider extends \lithium\core\StaticObject { public static function fetch($key) { return static::$_service->storage->read($key); } - + /** * undocumented function * diff --git a/tests/cases/extensions/service/OauthTest.php b/tests/cases/extensions/service/OauthTest.php index f1b056e..1397c06 100644 --- a/tests/cases/extensions/service/OauthTest.php +++ b/tests/cases/extensions/service/OauthTest.php @@ -29,7 +29,7 @@ class OauthTest extends \lithium\test\Unit { $oauth = new MockOauth($this->_testConfig); $config = $oauth->config(); - $expected = 'oauth/request_token'; + $expected = '/oauth/request_token'; $result = $config['request_token']; $this->assertEqual($expected, $result); } @@ -64,7 +64,7 @@ class OauthTest extends \lithium\test\Unit { )); $this->assertEqual($expected, $result); } - + public function testPostAcceesToken() { $oauth = new MockOauth($this->_testConfig); @@ -81,5 +81,13 @@ class OauthTest extends \lithium\test\Unit { )); $this->assertEqual($expected, $result); } + + public function testConfigUrl() { + $oauth = new MockOauth($this->_testConfig); + $expected = 'http://localhost'; + $result = $oauth->url(''); + $this->assertEqual($expected, $result); + + } } ?> \ No newline at end of file diff --git a/tests/cases/models/ConsumerTest.php b/tests/cases/models/ConsumerTest.php index b53bd13..62d91f6 100644 --- a/tests/cases/models/ConsumerTest.php +++ b/tests/cases/models/ConsumerTest.php @@ -11,7 +11,7 @@ namespace li3_oauth\tests\cases\models; use \li3_oauth\models\Consumer; class ConsumerTest extends \lithium\test\Unit { - + public function setUp() { Consumer::config(array( 'host' => 'localhost', @@ -24,7 +24,7 @@ class ConsumerTest extends \lithium\test\Unit { } public function testAuthorize() { - $expected = 'http://localhost/oauth/authorize?oauth_token=requestkey&oauth_token_secret=requestsecret'; + $expected = 'http://localhost/oauth/authorize?oauth_token=requestkey'; $result = Consumer::authorize(array( 'oauth_token' => 'requestkey', 'oauth_token_secret' => 'requestsecret' diff --git a/tests/cases/models/ProviderTest.php b/tests/cases/models/ProviderTest.php index ebdf37b..27ddc35 100644 --- a/tests/cases/models/ProviderTest.php +++ b/tests/cases/models/ProviderTest.php @@ -17,7 +17,6 @@ class ProviderTest extends \lithium\test\Unit { 'host' => 'localhost', 'oauth_consumer_key' => 'key', 'oauth_consumer_secret' => 'secret', - 'port' => 30500 )); } @@ -59,10 +58,11 @@ class ProviderTest extends \lithium\test\Unit { public function testVerify() { $request = array( + 'url' => 'request_token', 'params' => array( 'oauth_consumer_key' => 'key', 'oauth_nonce' => '4d31073c8ce205ecd3145d6cc0a3a4f6', - 'oauth_signature' => 'fKMyRb/Pysuu0XqRoxANOkyiL8I=', + 'oauth_signature' => 'GfCKugOKkspnq5ihgPR/9xxpf+E=', 'oauth_signature_method' => 'HMAC-SHA1', 'oauth_timestamp' => '1259606608', 'oauth_version' => '1.0', ) @@ -73,10 +73,11 @@ class ProviderTest extends \lithium\test\Unit { public function testVerifyWithToken() { $request = array( + 'url' => 'request_token', 'params' => array( 'oauth_consumer_key' => 'key', 'oauth_nonce' => '4d31073c8ce205ecd3145d6cc0a3a4f6', - 'oauth_signature' => 'G/ZDnJOVbvVasoHH/XbDVzdwJ+U=', + 'oauth_signature' => '10xRa+G7ql3KjDgZySmn5NqNLqQ=', 'oauth_signature_method' => 'HMAC-SHA1', 'oauth_timestamp' => '1259606608', 'oauth_version' => '1.0', ),