Making oschwald's style changes and fixing tests
This commit is contained in:
parent
6f776ffac1
commit
4ec525a313
|
@ -314,7 +314,7 @@ If you are using PHP 5.3 with an autoloader besides Composer, you must load
|
|||
## Contributing ##
|
||||
|
||||
Patches and pull requests are encouraged. All code should follow the
|
||||
PSR-2 style guidelines. Please include unit tests whenever possible. You may obtain the test data for the maxmind-db folder from https://github.com/maxmind/MaxMind-DB
|
||||
PSR-2 style guidelines. Please include unit tests whenever possible. You may obtain the test data for the maxmind-db folder by running `git submodule update --init --recursive` or adding `--recursive` to your initial clone, or from https://github.com/maxmind/MaxMind-DB
|
||||
|
||||
## Versioning ##
|
||||
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
namespace GeoIp2\Model;
|
||||
|
||||
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
|
|
|
@ -64,8 +64,8 @@ class Client implements ProviderInterface
|
|||
* @param string $host Optional host parameter
|
||||
* @param object $guzzleClient Optional Guzzle client to use (to facilitate
|
||||
* unit testing).
|
||||
* @param string $timeout Total transaction timeout
|
||||
* @param string $connectTimeout Initial connection timeout
|
||||
* @param string $timeout Total transaction timeout in seconds
|
||||
* @param string $connectTimeout Initial connection timeout in seconds
|
||||
*/
|
||||
public function __construct(
|
||||
$userId,
|
||||
|
@ -189,10 +189,10 @@ class Client implements ProviderInterface
|
|||
$client = $this->guzzleClient ?
|
||||
$this->guzzleClient : new GuzzleClient();
|
||||
$options = array();
|
||||
if($this->timeout != null){
|
||||
if ($this->timeout !== null) {
|
||||
$options['timeout'] = $this->timeout;
|
||||
}
|
||||
if($this->connectTimeout != null){
|
||||
if ($this->connectTimeout !== null) {
|
||||
$options['connect_timeout'] = $this->connectTimeout;
|
||||
}
|
||||
$request = $client->get($uri, array('Accept' => 'application/json'), $options);
|
||||
|
|
|
@ -451,15 +451,17 @@ class ClientTest extends \PHPUnit_Framework_TestCase
|
|||
'request sets Accept header to GeoIP2 PHP API (Guzzle%s)'
|
||||
);
|
||||
|
||||
$curlOptions = $request->getCurlOptions();
|
||||
|
||||
$this->assertEquals(
|
||||
'27000',
|
||||
$request->getCurlOptions()[CURLOPT_TIMEOUT_MS],
|
||||
$curlOptions[CURLOPT_TIMEOUT_MS],
|
||||
'request sets Curl Option Timeout to 27 seconds'
|
||||
);
|
||||
|
||||
$this->assertEquals(
|
||||
'72000',
|
||||
$request->getCurlOptions()[CURLOPT_CONNECTTIMEOUT_MS],
|
||||
$curlOptions[CURLOPT_CONNECTTIMEOUT_MS],
|
||||
'request sets Curl Option Connect Timeout to 72 seconds'
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user