Skip to content

Commit 3f5306f

Browse files
committed
Merge pull request googleapis#192 from ianbarber/master
Small test tidy ups
2 parents d29ea49 + b2c7a83 commit 3f5306f

File tree

3 files changed

+24
-5
lines changed

3 files changed

+24
-5
lines changed

src/Google/Client.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,9 @@ function_exists('date_default_timezone_set')) {
103103

104104
if ($config->getIoClass() == Google_Config::USE_AUTO_IO_SELECTION) {
105105
if (function_exists('curl_version') && function_exists('curl_exec')) {
106-
$config->setIoClass("Google_Io_Curl");
106+
$config->setIoClass("Google_IO_Curl");
107107
} else {
108-
$config->setIoClass("Google_Io_Stream");
108+
$config->setIoClass("Google_IO_Stream");
109109
}
110110
}
111111

tests/general/ApiOAuth2Test.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ public function testValidateIdToken()
169169
* Test for revoking token when none is opened
170170
*/
171171
public function testRevokeWhenNoTokenExists() {
172-
$client = $this->getClient();
173-
$client->revokeToken();
172+
$client = new Google_Client();
173+
$this->assertFalse($client->revokeToken());
174174
}
175175
}

tests/general/IoTest.php

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,9 @@ class IoTest extends BaseTest
2828

2929
public function testExecutorSelection()
3030
{
31+
$default = function_exists('curl_version') ? 'Google_IO_Curl' : 'Google_IO_Stream';
3132
$client = $this->getClient();
32-
$this->assertInstanceOf('Google_IO_Curl', $client->getIo());
33+
$this->assertInstanceOf($default, $client->getIo());
3334
$config = new Google_Config();
3435
$config->setIoClass('Google_IO_Stream');
3536
$client = new Google_Client($config);
@@ -80,32 +81,47 @@ public function testStreamInvalidRequest()
8081

8182
public function testCurlSetTimeout()
8283
{
84+
if (!function_exists('curl_version')) {
85+
$this->markTestSkipped('cURL not present');
86+
}
8387
$io = new Google_IO_Curl($this->getClient());
8488
$this->timeoutChecker($io);
8589
}
8690

8791
public function testCurlParseHttpResponseBody()
8892
{
93+
if (!function_exists('curl_version')) {
94+
$this->markTestSkipped('cURL not present');
95+
}
8996
$io = new Google_IO_Curl($this->getClient());
9097
$this->responseChecker($io);
9198
}
9299

93100
public function testCurlProcessEntityRequest()
94101
{
102+
if (!function_exists('curl_version')) {
103+
$this->markTestSkipped('cURL not present');
104+
}
95105
$client = $this->getClient();
96106
$io = new Google_IO_Curl($client);
97107
$this->processEntityRequest($io, $client);
98108
}
99109

100110
public function testCurlCacheHit()
101111
{
112+
if (!function_exists('curl_version')) {
113+
$this->markTestSkipped('cURL not present');
114+
}
102115
$client = $this->getClient();
103116
$io = new Google_IO_Curl($client);
104117
$this->cacheHit($io, $client);
105118
}
106119

107120
public function testCurlAuthCache()
108121
{
122+
if (!function_exists('curl_version')) {
123+
$this->markTestSkipped('cURL not present');
124+
}
109125
$client = $this->getClient();
110126
$io = new Google_IO_Curl($client);
111127
$this->authCache($io, $client);
@@ -116,6 +132,9 @@ public function testCurlAuthCache()
116132
*/
117133
public function testCurlInvalidRequest()
118134
{
135+
if (!function_exists('curl_version')) {
136+
$this->markTestSkipped('cURL not present');
137+
}
119138
$io = new Google_IO_Curl($this->getClient());
120139
$this->invalidRequest($io);
121140
}

0 commit comments

Comments
 (0)