mirror of
https://github.com/guzzle/guzzle.git
synced 2025-02-24 01:53:58 +01:00
[Tests] Add coverage to Guzzle\Guzzle
This commit is contained in:
parent
330bf7b22a
commit
99264d1ad6
@ -34,7 +34,6 @@ class Guzzle
|
||||
*/
|
||||
public static function getDefaultUserAgent()
|
||||
{
|
||||
// @codeCoverageIgnoreStart
|
||||
if (!self::$userAgent) {
|
||||
$version = self::getCurlInfo();
|
||||
self::$userAgent = sprintf('Guzzle/%s (Language=PHP/%s; curl=%s; Host=%s)',
|
||||
@ -44,8 +43,7 @@ class Guzzle
|
||||
$version['host']
|
||||
);
|
||||
}
|
||||
// @codeCoverageIgnoreEnd
|
||||
|
||||
|
||||
return self::$userAgent;
|
||||
}
|
||||
|
||||
@ -69,14 +67,12 @@ class Guzzle
|
||||
*/
|
||||
public static function getCurlInfo($type = null)
|
||||
{
|
||||
// @codeCoverageIgnoreStart
|
||||
if (!self::$curl) {
|
||||
self::$curl = curl_version();
|
||||
// Check if CURLOPT_FOLLOWLOCATION is available
|
||||
self::$curl['follow_location'] = !ini_get('open_basedir');
|
||||
}
|
||||
// @codeCoverageIgnoreEnd
|
||||
|
||||
|
||||
if (!$type) {
|
||||
return self::$curl;
|
||||
} else if (isset(self::$curl[$type])) {
|
||||
|
@ -19,11 +19,10 @@ class GuzzleTest extends GuzzleTestCase
|
||||
*/
|
||||
public function testGetDefaultUserAgent()
|
||||
{
|
||||
Guzzle::reset();
|
||||
$version = curl_version();
|
||||
$agent = sprintf('Guzzle/%s (Language=PHP/%s; curl=%s; Host=%s)', Guzzle::VERSION, \PHP_VERSION, $version['version'], $version['host']);
|
||||
|
||||
$this->assertEquals($agent, Guzzle::getDefaultUserAgent());
|
||||
|
||||
// Get it from cache this time
|
||||
$this->assertEquals($agent, Guzzle::getDefaultUserAgent());
|
||||
}
|
||||
@ -34,7 +33,6 @@ class GuzzleTest extends GuzzleTestCase
|
||||
public function testGetHttpDate()
|
||||
{
|
||||
$fmt = 'D, d M Y H:i:s \G\M\T';
|
||||
|
||||
$this->assertEquals(gmdate($fmt), Guzzle::getHttpDate('now'));
|
||||
$this->assertEquals(gmdate($fmt), Guzzle::getHttpDate(strtotime('now')));
|
||||
$this->assertEquals(gmdate($fmt, strtotime('+1 day')), Guzzle::getHttpDate('+1 day'));
|
||||
@ -76,10 +74,13 @@ class GuzzleTest extends GuzzleTestCase
|
||||
*/
|
||||
public function testCachesCurlInfo()
|
||||
{
|
||||
Guzzle::reset();
|
||||
$c = curl_version();
|
||||
$this->assertInternalType('array', Guzzle::getCurlInfo());
|
||||
$info = Guzzle::getCurlInfo();
|
||||
$this->assertInternalType('array', $info);
|
||||
$this->assertEquals(false, Guzzle::getCurlInfo('ewfewfewfe'));
|
||||
$this->assertEquals($c['version'], Guzzle::getCurlInfo('version'));
|
||||
$this->assertSame(Guzzle::getCurlInfo(), $info);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user