Skip to content
This repository was archived by the owner on Feb 25, 2021. It is now read-only.

Commit 331d07e

Browse files
committed
1 parent 45f3009 commit 331d07e

File tree

2 files changed

+15
-6
lines changed

2 files changed

+15
-6
lines changed

src/InfluxDB/Client.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class Client
4444
protected $password = '';
4545

4646
/**
47-
* @var int
47+
* @var float
4848
*/
4949
protected $timeout = 0;
5050

@@ -118,7 +118,7 @@ public function __construct(
118118
$this->port = (int) $port;
119119
$this->username = (string) $username;
120120
$this->password = (string) $password;
121-
$this->timeout = (int) $timeout;
121+
$this->timeout = (float) $timeout;
122122
$this->verifySSL = (bool) $verifySSL;
123123

124124
if ($ssl) {
@@ -317,7 +317,7 @@ public function getBaseURI()
317317
}
318318

319319
/**
320-
* @return int
320+
* @return float
321321
*/
322322
public function getTimeout()
323323
{

tests/unit/ClientTest.php

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,14 @@ public function testFactoryMethod()
142142

143143
}
144144

145+
public function testTimeoutIsFloat()
146+
{
147+
$client = $this->getClient('test', 'test', false, 0.5);
148+
149+
$this->assertEquals(0.5, $client->getTimeout());
150+
}
151+
152+
145153
/**
146154
* @param string $responseFile
147155
* @param array $result
@@ -162,12 +170,13 @@ protected function doTestResponse($responseFile, array $result, $method)
162170
* @param string $username
163171
* @param string $password
164172
* @param bool|false $ssl
173+
* @param int $timeout
165174
*
166175
* @return Client
167176
*/
168-
protected function getClient($username = '', $password = '', $ssl = false)
177+
protected function getClient($username = '', $password = '', $ssl = false, $timeout = 0)
169178
{
170-
return new Client('localhost', 8086, $username, $password, $ssl);
179+
return new Client('localhost', 8086, $username, $password, $ssl, false, $timeout);
171180
}
172181

173-
}
182+
}

0 commit comments

Comments
 (0)