Skip to content

Commit 5376eee

Browse files
author
Ian Barber
committed
Lint bash tests
cc @silvolu
1 parent 5333b00 commit 5376eee

25 files changed

Lines changed: 903 additions & 579 deletions

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ file or class name and description of purpose be included on the
186186
same "printed page" as the copyright notice for easier
187187
identification within third-party archives.
188188

189-
Copyright 2013 Google Inc.
189+
Copyright [yyyy] [name of copyright owner]
190190

191191
Licensed under the Apache License, Version 2.0 (the "License");
192192
you may not use this file except in compliance with the License.

tests/AllTests.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,10 @@
3131
require_once 'plus/PlusTest.php';
3232
require_once 'youtube/YouTubeTest.php';
3333

34-
class AllTests {
35-
public static function suite() {
34+
class AllTests
35+
{
36+
public static function suite()
37+
{
3638
$suite = new PHPUnit_Framework_TestSuite();
3739
$suite->setName('All Google API PHP Client tests');
3840
$suite->addTestSuite(YouTubeTests::suite());

tests/BaseTest.php

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@
1717
require_once 'bootstrap.php';
1818
require_once 'Google/Client.php';
1919

20-
class BaseTest extends PHPUnit_Framework_TestCase {
20+
class BaseTest extends PHPUnit_Framework_TestCase
21+
{
2122
const KEY = "";
2223
private $token;
2324
private $memcacheHost;
@@ -26,36 +27,38 @@ class BaseTest extends PHPUnit_Framework_TestCase {
2627
public function __construct()
2728
{
2829
parent::__construct();
29-
// Fill in a token JSON here and you can test the oauth token
30+
// Fill in a token JSON here and you can test the oauth token
3031
// requiring functions.
3132
// $this->token = '';
3233

3334
$this->memcacheHost = getenv('MEMCACHE_HOST') ? getenv('MEMCACHE_HOST') : null;
3435
$this->memcachePort = getenv('MEMCACHE_PORT') ? getenv('MEMCACHE_PORT') : null;
3536
}
3637

37-
public function getClient() {
38-
$client = new Google_Client();
39-
$client->setDeveloperKey(self::KEY);
40-
if (strlen($this->token)) {
41-
$client->setAccessToken($this->token);
42-
}
43-
if (strlen($this->memcacheHost)) {
44-
$client->setClassConfig('Google_Cache_Memcache', 'host', $this->memcacheHost);
45-
$client->setClassConfig('Google_Cache_Memcache', 'port', $this->memcachePort);
46-
}
47-
return $client;
38+
public function getClient()
39+
{
40+
$client = new Google_Client();
41+
$client->setDeveloperKey(self::KEY);
42+
if (strlen($this->token)) {
43+
$client->setAccessToken($this->token);
44+
}
45+
if (strlen($this->memcacheHost)) {
46+
$client->setClassConfig('Google_Cache_Memcache', 'host', $this->memcacheHost);
47+
$client->setClassConfig('Google_Cache_Memcache', 'port', $this->memcachePort);
48+
}
49+
return $client;
4850
}
4951

5052
public function testClientConstructor()
5153
{
5254
$this->assertInstanceOf('Google_Client', $this->getClient());
5355
}
5456

55-
public function testIncludes() {
57+
public function testIncludes()
58+
{
5659
$prefix = dirname(dirname(__FILE__)) . '/src/';
5760
$path = dirname(dirname(__FILE__)) . '/src/Google/Service';
58-
foreach(glob($path . "/*.php") as $file) {
61+
foreach (glob($path . "/*.php") as $file) {
5962
// Munge prefix so we don't double require.
6063
$this->assertEquals(1, require_once(str_replace($prefix, '', $file)));
6164
}
@@ -69,5 +72,4 @@ public function checkToken()
6972
}
7073
return true;
7174
}
72-
7375
}

tests/OAuthHelper.php

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,23 +15,22 @@
1515
* limitations under the License.
1616
*/
1717
include_once 'bootstrap.php';
18-
require_once realpath(dirname(__FILE__) . '/../autoload.php');
18+
require_once 'Google/Client.php';
1919

2020
$client = new Google_Client();
21-
$client->setScopes(array(
22-
"https://www.googleapis.com/auth/plus.me",
23-
"https://www.googleapis.com/auth/urlshortener",
24-
"https://www.googleapis.com/auth/tasks",
25-
"https://www.googleapis.com/auth/adsense",
26-
"https://www.googleapis.com/auth/youtube"
27-
));
21+
$client->setScopes(
22+
array(
23+
"https://www.googleapis.com/auth/plus.me",
24+
"https://www.googleapis.com/auth/urlshortener",
25+
"https://www.googleapis.com/auth/tasks",
26+
"https://www.googleapis.com/auth/adsense",
27+
"https://www.googleapis.com/auth/youtube"
28+
)
29+
);
2830
$client->setRedirectUri("urn:ietf:wg:oauth:2.0:oob");
2931
// Visit https://code.google.com/apis/console to
3032
// generate your oauth2_client_id, oauth2_client_secret, and to
3133
// register your oauth2_redirect_uri.
32-
$client->setClientId("");
33-
$client->setClientSecret("");
34-
3534

3635
$authUrl = $client->createAuthUrl();
3736

0 commit comments

Comments
 (0)