Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Merge pull request #1 from mehlah/master

QA fixes
  • Loading branch information...
commit 03255a1b0ce58239b10f7bfababb9f82dcd3437c 2 parents bd553ed + 9d5c3bf
GWoo authored
4  config/routes.php
... ...
@@ -1,13 +1,15 @@
1 1
 <?php
2 2
 
3  
-use \lithium\net\http\Router;
  3
+use lithium\net\http\Router;
4 4
 
5 5
 Router::connect('/oauth', array(
6 6
 	'library' => 'li3_oauth', 'controller' => 'li3_oauth.server', 'action' => 'account'
7 7
 ));
  8
+
8 9
 Router::connect('/oauth/client/{:action}/{:args}', array(
9 10
 	'library' => 'li3_oauth', 'controller' => 'li3_oauth.client', 'action' => 'index'
10 11
 ));
  12
+
11 13
 Router::connect('/oauth/{:action}/{:args}', array(
12 14
 	'library' => 'li3_oauth', 'controller' => 'li3_oauth.server', 'action' => 'index'
13 15
 ));
4  controllers/ClientController.php
@@ -8,8 +8,8 @@
8 8
 
9 9
 namespace li3_oauth\controllers;
10 10
 
11  
-use \li3_oauth\models\Consumer;
12  
-use \lithium\storage\Session;
  11
+use li3_oauth\models\Consumer;
  12
+use lithium\storage\Session;
13 13
 
14 14
 class ClientController extends \lithium\action\Controller {
15 15
 
5  controllers/ServerController.php
@@ -8,8 +8,7 @@
8 8
 
9 9
 namespace li3_oauth\controllers;
10 10
 
11  
-use \li3_oauth\models\Provider;
12  
-use \lithium\storage\Session;
  11
+use li3_oauth\models\Provider;
13 12
 
14 13
 class ServerController extends \lithium\action\Controller {
15 14
 
@@ -35,7 +34,7 @@ public function request_token() {
35 34
 		}
36 35
 
37 36
 		$isValid = Provider::verify(array(
38  
-			'params' => $this->request->data, 'url' => 'request_token',
  37
+			'params' => $this->request->data, 'url' => 'request_token'
39 38
 		) + (array) $consumer);
40 39
 
41 40
 		if ($isValid) {
6  controllers/TweetController.php
@@ -2,8 +2,8 @@
2 2
 
3 3
 namespace li3_oauth\controllers;
4 4
 
5  
-use \li3_oauth\models\Consumer;
6  
-use \lithium\storage\Session;
  5
+use li3_oauth\models\Consumer;
  6
+use lithium\storage\Session;
7 7
 
8 8
 class TweetController extends \lithium\action\Controller {
9 9
 
@@ -12,7 +12,7 @@ protected function _init() {
12 12
 		Consumer::config(array(
13 13
 			'host' => 'twitter.com',
14 14
 			'oauth_consumer_key' => '',
15  
-			'oauth_consumer_secret' => '',
  15
+			'oauth_consumer_secret' => ''
16 16
 		));
17 17
 	}
18 18
 
4  extensions/service/Oauth.php
@@ -26,7 +26,7 @@ class Oauth extends \lithium\net\http\Service {
26 26
 		'media'    => '\lithium\net\http\Media',
27 27
 		'request'  => '\lithium\net\http\Request',
28 28
 		'response' => '\lithium\net\http\Response',
29  
-		'socket'   => '\lithium\net\socket\Context',
  29
+		'socket'   => '\lithium\net\socket\Context'
30 30
 	);
31 31
 
32 32
 	/**
@@ -151,7 +151,7 @@ public function sign($options = array()) {
151 151
 			'oauth_signature_method' => 'HMAC-SHA1',
152 152
 			'oauth_consumer_secret' => $this->_config['oauth_consumer_secret'],
153 153
 			'params' => array(), 'data' => array(),
154  
-			'token' => array('oauth_token' => null, 'oauth_token_secret' => null),
  154
+			'token' => array('oauth_token' => null, 'oauth_token_secret' => null)
155 155
 		);
156 156
 		$options += $defaults;
157 157
 		$params = $this->_params((array) $options['params'] + (array) $options['token']);
3  extensions/storage/File.php
@@ -26,7 +26,7 @@ protected function _init() {
26 26
 			return;
27 27
 		}
28 28
 		if ($this->_file[0] !== '/') {
29  
-			$this->_file = LITHIUM_APP_PATH . '/resources/oauth/'. $this->_file;
  29
+			$this->_file = LITHIUM_APP_PATH . '/resources/oauth/' . $this->_file;
30 30
 		}
31 31
 	}
32 32
 
@@ -79,4 +79,5 @@ public function remove($key) {
79 79
 		return file_put_contents($this->_file, $data);
80 80
 	}
81 81
 }
  82
+
82 83
 ?>
6  models/Provider.php
@@ -8,7 +8,7 @@
8 8
 
9 9
 namespace li3_oauth\models;
10 10
 
11  
-use \li3_oauth\extensions\service\Oauth;
  11
+use li3_oauth\extensions\service\Oauth;
12 12
 
13 13
 class Provider extends \lithium\core\StaticObject {
14 14
 
@@ -59,7 +59,7 @@ public static function config($config) {
59 59
 	public static function create($type, $key = null, $secret = null) {
60 60
 		$key = $key ?: sha1(mt_rand());
61 61
 		$secret = $secret ?: sha1(mt_rand());
62  
-		switch($type) {
  62
+		switch ($type) {
63 63
 			case 'token':
64 64
 				return (object) array(
65 65
 					'oauth_token' => $key, 'oauth_token_secret' => $secret
@@ -77,7 +77,7 @@ public static function create($type, $key = null, $secret = null) {
77 77
 	/**
78 78
 	 * undocumented function
79 79
 	 *
80  
-	 * @param string $query
  80
+	 * @param string $request
81 81
 	 * @return void
82 82
 	 */
83 83
 	public static function verify($request) {
18  tests/cases/extensions/service/OauthTest.php
@@ -8,13 +8,13 @@
8 8
 
9 9
 namespace li3_oauth\tests\cases\extensions\service;
10 10
 
11  
-use \li3_oauth\tests\mocks\extensions\service\MockOauth;
  11
+use li3_oauth\tests\mocks\extensions\service\MockOauth;
12 12
 
13 13
 class OauthTest extends \lithium\test\Unit {
14 14
 
15 15
 	protected $_testConfig = array(
16 16
 		'classes' => array(
17  
-			'socket' => '\li3_oauth\tests\mocks\extensions\service\MockSocket',
  17
+			'socket' => '\li3_oauth\tests\mocks\extensions\service\MockSocket'
18 18
 		),
19 19
 		'persistent' => false,
20 20
 		'protocol' => 'http',
@@ -107,8 +107,8 @@ public function testSign() {
107 107
 			'params' => array(
108 108
 				'oauth_consumer_key' => 'key',
109 109
 				'oauth_nonce' => '4d31073c8ce205ecd3145d6cc0a3a4f6',
110  
-				'oauth_timestamp' => '1259606608',
111  
-			),
  110
+				'oauth_timestamp' => '1259606608'
  111
+			)
112 112
 		);
113 113
 		$params = $oauth->sign($params);
114 114
 
@@ -122,8 +122,8 @@ public function testSign() {
122 122
 			'params' => array(
123 123
 				'oauth_consumer_key' => 'key',
124 124
 				'oauth_nonce' => '4d31073c8ce205ecd3145d6cc0a3a4f6',
125  
-				'oauth_timestamp' => '1259606608',
126  
-			),
  125
+				'oauth_timestamp' => '1259606608'
  126
+			)
127 127
 		);
128 128
 		$params = $oauth->sign($params);
129 129
 
@@ -134,7 +134,7 @@ public function testSign() {
134 134
 
135 135
 	public function testSignAgain() {
136 136
 		$this->_testConfig += array(
137  
-			'request' => 'libraries/oauth_php/example/request_token.php',
  137
+			'request' => 'libraries/oauth_php/example/request_token.php'
138 138
 		);
139 139
 		$oauth = new MockOauth($this->_testConfig);
140 140
 		$params =  array(
@@ -143,8 +143,8 @@ public function testSignAgain() {
143 143
 			'params' => array(
144 144
 				'oauth_consumer_key' => 'key',
145 145
 				'oauth_nonce' => 'eaa196ab3a032e7b2e55d2b3ea21a13d99f1175e',
146  
-				'oauth_timestamp' => '1276360894',
147  
-			),
  146
+				'oauth_timestamp' => '1276360894'
  147
+			)
148 148
 		);
149 149
 		$params = $oauth->sign($params);
150 150
 
3  tests/cases/extensions/storage/FileTest.php
@@ -8,7 +8,7 @@
8 8
 
9 9
 namespace li3_oauth\tests\cases\extensions\storage;
10 10
 
11  
-use \li3_oauth\extensions\storage\File;
  11
+use li3_oauth\extensions\storage\File;
12 12
 
13 13
 class FileTest extends \lithium\test\Unit {
14 14
 
@@ -67,7 +67,6 @@ public function testWriteReadRemove() {
67 67
 		$result = $this->file->read();
68 68
 		$this->assertEqual($expected, $result);
69 69
 	}
70  
-
71 70
 }
72 71
 
73 72
 ?>
4  tests/cases/models/ConsumerTest.php
@@ -8,7 +8,7 @@
8 8
 
9 9
 namespace li3_oauth\tests\cases\models;
10 10
 
11  
-use \li3_oauth\models\Consumer;
  11
+use li3_oauth\models\Consumer;
12 12
 
13 13
 class ConsumerTest extends \lithium\test\Unit {
14 14
 
@@ -73,7 +73,7 @@ public function testPost() {
73 73
 			'oauth_token_secret' => 'requestsecret'
74 74
 		);
75 75
 		Consumer::config(array('classes' => array(
76  
-			'socket' => '\li3_oauth\tests\mocks\extensions\service\MockSocket',
  76
+			'socket' => '\li3_oauth\tests\mocks\extensions\service\MockSocket'
77 77
 		)));
78 78
 		$result = Consumer::post('search', array(), compact('token'));
79 79
 		$this->assertEqual($expected, $result);
8  tests/cases/models/ProviderTest.php
@@ -8,7 +8,7 @@
8 8
 
9 9
 namespace li3_oauth\tests\cases\models;
10 10
 
11  
-use \li3_oauth\models\Provider;
  11
+use li3_oauth\models\Provider;
12 12
 
13 13
 class ProviderTest extends \lithium\test\Unit {
14 14
 
@@ -16,7 +16,7 @@ public function setUp() {
16 16
 		Provider::config(array(
17 17
 			'host' => 'localhost',
18 18
 			'oauth_consumer_key' => 'key',
19  
-			'oauth_consumer_secret' => 'secret',
  19
+			'oauth_consumer_secret' => 'secret'
20 20
 		));
21 21
 	}
22 22
 
@@ -64,7 +64,7 @@ public function testVerify() {
64 64
 				'oauth_nonce' => '4d31073c8ce205ecd3145d6cc0a3a4f6',
65 65
 				'oauth_signature' => 'GfCKugOKkspnq5ihgPR/9xxpf+E=',
66 66
 				'oauth_signature_method' => 'HMAC-SHA1', 'oauth_timestamp' => '1259606608',
67  
-				'oauth_version' => '1.0',
  67
+				'oauth_version' => '1.0'
68 68
 			)
69 69
 		);
70 70
 		$result = Provider::verify($request);
@@ -79,7 +79,7 @@ public function testVerifyWithToken() {
79 79
 				'oauth_nonce' => '4d31073c8ce205ecd3145d6cc0a3a4f6',
80 80
 				'oauth_signature' => '10xRa+G7ql3KjDgZySmn5NqNLqQ=',
81 81
 				'oauth_signature_method' => 'HMAC-SHA1', 'oauth_timestamp' => '1259606608',
82  
-				'oauth_version' => '1.0',
  82
+				'oauth_version' => '1.0'
83 83
 			),
84 84
 			'token' => array(
85 85
 				'oauth_token' => 'request_token', 'oauth_token_secret' => 'request_secret'
3  tests/mocks/extensions/service/MockStorage.php
@@ -19,5 +19,6 @@ public function read() {
19 19
 	public function write($data, $options = array()) {
20 20
 		$this->_data = $data;
21 21
 	}
  22
+}
22 23
 
23  
-}
  24
+?>

0 notes on commit 03255a1

Please sign in to comment.
Something went wrong with that request. Please try again.