Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #1 from mehlah/master

QA fixes
  • Loading branch information...
commit 03255a1b0ce58239b10f7bfababb9f82dcd3437c 2 parents bd553ed + 9d5c3bf
@gwoo authored
View
4 config/routes.php
@@ -1,13 +1,15 @@
<?php
-use \lithium\net\http\Router;
+use lithium\net\http\Router;
Router::connect('/oauth', array(
'library' => 'li3_oauth', 'controller' => 'li3_oauth.server', 'action' => 'account'
));
+
Router::connect('/oauth/client/{:action}/{:args}', array(
'library' => 'li3_oauth', 'controller' => 'li3_oauth.client', 'action' => 'index'
));
+
Router::connect('/oauth/{:action}/{:args}', array(
'library' => 'li3_oauth', 'controller' => 'li3_oauth.server', 'action' => 'index'
));
View
4 controllers/ClientController.php
@@ -8,8 +8,8 @@
namespace li3_oauth\controllers;
-use \li3_oauth\models\Consumer;
-use \lithium\storage\Session;
+use li3_oauth\models\Consumer;
+use lithium\storage\Session;
class ClientController extends \lithium\action\Controller {
View
5 controllers/ServerController.php
@@ -8,8 +8,7 @@
namespace li3_oauth\controllers;
-use \li3_oauth\models\Provider;
-use \lithium\storage\Session;
+use li3_oauth\models\Provider;
class ServerController extends \lithium\action\Controller {
@@ -35,7 +34,7 @@ public function request_token() {
}
$isValid = Provider::verify(array(
- 'params' => $this->request->data, 'url' => 'request_token',
+ 'params' => $this->request->data, 'url' => 'request_token'
) + (array) $consumer);
if ($isValid) {
View
6 controllers/TweetController.php
@@ -2,8 +2,8 @@
namespace li3_oauth\controllers;
-use \li3_oauth\models\Consumer;
-use \lithium\storage\Session;
+use li3_oauth\models\Consumer;
+use lithium\storage\Session;
class TweetController extends \lithium\action\Controller {
@@ -12,7 +12,7 @@ protected function _init() {
Consumer::config(array(
'host' => 'twitter.com',
'oauth_consumer_key' => '',
- 'oauth_consumer_secret' => '',
+ 'oauth_consumer_secret' => ''
));
}
View
4 extensions/service/Oauth.php
@@ -26,7 +26,7 @@ class Oauth extends \lithium\net\http\Service {
'media' => '\lithium\net\http\Media',
'request' => '\lithium\net\http\Request',
'response' => '\lithium\net\http\Response',
- 'socket' => '\lithium\net\socket\Context',
+ 'socket' => '\lithium\net\socket\Context'
);
/**
@@ -151,7 +151,7 @@ public function sign($options = array()) {
'oauth_signature_method' => 'HMAC-SHA1',
'oauth_consumer_secret' => $this->_config['oauth_consumer_secret'],
'params' => array(), 'data' => array(),
- 'token' => array('oauth_token' => null, 'oauth_token_secret' => null),
+ 'token' => array('oauth_token' => null, 'oauth_token_secret' => null)
);
$options += $defaults;
$params = $this->_params((array) $options['params'] + (array) $options['token']);
View
3  extensions/storage/File.php
@@ -26,7 +26,7 @@ protected function _init() {
return;
}
if ($this->_file[0] !== '/') {
- $this->_file = LITHIUM_APP_PATH . '/resources/oauth/'. $this->_file;
+ $this->_file = LITHIUM_APP_PATH . '/resources/oauth/' . $this->_file;
}
}
@@ -79,4 +79,5 @@ public function remove($key) {
return file_put_contents($this->_file, $data);
}
}
+
?>
View
6 models/Provider.php
@@ -8,7 +8,7 @@
namespace li3_oauth\models;
-use \li3_oauth\extensions\service\Oauth;
+use li3_oauth\extensions\service\Oauth;
class Provider extends \lithium\core\StaticObject {
@@ -59,7 +59,7 @@ public static function config($config) {
public static function create($type, $key = null, $secret = null) {
$key = $key ?: sha1(mt_rand());
$secret = $secret ?: sha1(mt_rand());
- switch($type) {
+ switch ($type) {
case 'token':
return (object) array(
'oauth_token' => $key, 'oauth_token_secret' => $secret
@@ -77,7 +77,7 @@ public static function create($type, $key = null, $secret = null) {
/**
* undocumented function
*
- * @param string $query
+ * @param string $request
* @return void
*/
public static function verify($request) {
View
18 tests/cases/extensions/service/OauthTest.php
@@ -8,13 +8,13 @@
namespace li3_oauth\tests\cases\extensions\service;
-use \li3_oauth\tests\mocks\extensions\service\MockOauth;
+use li3_oauth\tests\mocks\extensions\service\MockOauth;
class OauthTest extends \lithium\test\Unit {
protected $_testConfig = array(
'classes' => array(
- 'socket' => '\li3_oauth\tests\mocks\extensions\service\MockSocket',
+ 'socket' => '\li3_oauth\tests\mocks\extensions\service\MockSocket'
),
'persistent' => false,
'protocol' => 'http',
@@ -107,8 +107,8 @@ public function testSign() {
'params' => array(
'oauth_consumer_key' => 'key',
'oauth_nonce' => '4d31073c8ce205ecd3145d6cc0a3a4f6',
- 'oauth_timestamp' => '1259606608',
- ),
+ 'oauth_timestamp' => '1259606608'
+ )
);
$params = $oauth->sign($params);
@@ -122,8 +122,8 @@ public function testSign() {
'params' => array(
'oauth_consumer_key' => 'key',
'oauth_nonce' => '4d31073c8ce205ecd3145d6cc0a3a4f6',
- 'oauth_timestamp' => '1259606608',
- ),
+ 'oauth_timestamp' => '1259606608'
+ )
);
$params = $oauth->sign($params);
@@ -134,7 +134,7 @@ public function testSign() {
public function testSignAgain() {
$this->_testConfig += array(
- 'request' => 'libraries/oauth_php/example/request_token.php',
+ 'request' => 'libraries/oauth_php/example/request_token.php'
);
$oauth = new MockOauth($this->_testConfig);
$params = array(
@@ -143,8 +143,8 @@ public function testSignAgain() {
'params' => array(
'oauth_consumer_key' => 'key',
'oauth_nonce' => 'eaa196ab3a032e7b2e55d2b3ea21a13d99f1175e',
- 'oauth_timestamp' => '1276360894',
- ),
+ 'oauth_timestamp' => '1276360894'
+ )
);
$params = $oauth->sign($params);
View
3  tests/cases/extensions/storage/FileTest.php
@@ -8,7 +8,7 @@
namespace li3_oauth\tests\cases\extensions\storage;
-use \li3_oauth\extensions\storage\File;
+use li3_oauth\extensions\storage\File;
class FileTest extends \lithium\test\Unit {
@@ -67,7 +67,6 @@ public function testWriteReadRemove() {
$result = $this->file->read();
$this->assertEqual($expected, $result);
}
-
}
?>
View
4 tests/cases/models/ConsumerTest.php
@@ -8,7 +8,7 @@
namespace li3_oauth\tests\cases\models;
-use \li3_oauth\models\Consumer;
+use li3_oauth\models\Consumer;
class ConsumerTest extends \lithium\test\Unit {
@@ -73,7 +73,7 @@ public function testPost() {
'oauth_token_secret' => 'requestsecret'
);
Consumer::config(array('classes' => array(
- 'socket' => '\li3_oauth\tests\mocks\extensions\service\MockSocket',
+ 'socket' => '\li3_oauth\tests\mocks\extensions\service\MockSocket'
)));
$result = Consumer::post('search', array(), compact('token'));
$this->assertEqual($expected, $result);
View
8 tests/cases/models/ProviderTest.php
@@ -8,7 +8,7 @@
namespace li3_oauth\tests\cases\models;
-use \li3_oauth\models\Provider;
+use li3_oauth\models\Provider;
class ProviderTest extends \lithium\test\Unit {
@@ -16,7 +16,7 @@ public function setUp() {
Provider::config(array(
'host' => 'localhost',
'oauth_consumer_key' => 'key',
- 'oauth_consumer_secret' => 'secret',
+ 'oauth_consumer_secret' => 'secret'
));
}
@@ -64,7 +64,7 @@ public function testVerify() {
'oauth_nonce' => '4d31073c8ce205ecd3145d6cc0a3a4f6',
'oauth_signature' => 'GfCKugOKkspnq5ihgPR/9xxpf+E=',
'oauth_signature_method' => 'HMAC-SHA1', 'oauth_timestamp' => '1259606608',
- 'oauth_version' => '1.0',
+ 'oauth_version' => '1.0'
)
);
$result = Provider::verify($request);
@@ -79,7 +79,7 @@ public function testVerifyWithToken() {
'oauth_nonce' => '4d31073c8ce205ecd3145d6cc0a3a4f6',
'oauth_signature' => '10xRa+G7ql3KjDgZySmn5NqNLqQ=',
'oauth_signature_method' => 'HMAC-SHA1', 'oauth_timestamp' => '1259606608',
- 'oauth_version' => '1.0',
+ 'oauth_version' => '1.0'
),
'token' => array(
'oauth_token' => 'request_token', 'oauth_token_secret' => 'request_secret'
View
3  tests/mocks/extensions/service/MockStorage.php
@@ -19,5 +19,6 @@ public function read() {
public function write($data, $options = array()) {
$this->_data = $data;
}
+}
-}
+?>
Please sign in to comment.
Something went wrong with that request. Please try again.