|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* This file is part of the bee4/httpclient package. |
|
4
|
|
|
* For the full copyright and license information, please view the LICENSE |
|
5
|
|
|
* file that was distributed with this source code. |
|
6
|
|
|
* |
|
7
|
|
|
* @copyright Bee4 2015 |
|
8
|
|
|
* @author Stephane HULARD <[email protected]> |
|
9
|
|
|
* @package Bee4\Test\Transport |
|
10
|
|
|
*/ |
|
11
|
|
|
|
|
12
|
|
|
namespace Bee4\Test\Transport; |
|
13
|
|
|
|
|
14
|
|
|
use Bee4\Transport\Configuration\Configuration; |
|
15
|
|
|
|
|
16
|
|
|
/** |
|
17
|
|
|
* @package Bee4\Test\Transport |
|
18
|
|
|
*/ |
|
19
|
|
|
class ConfigurationTest extends \PHPUnit_Framework_TestCase |
|
20
|
|
|
{ |
|
21
|
|
|
public function testDefaults() |
|
22
|
|
|
{ |
|
23
|
|
|
$conf = new Configuration(); |
|
24
|
|
|
|
|
25
|
|
|
$this->assertArrayHasKey('connect_timeout', $conf); |
|
26
|
|
|
$this->assertArrayHasKey('timeout', $conf); |
|
27
|
|
|
$this->assertArrayHasKey('verify', $conf); |
|
28
|
|
|
$this->assertArrayHasKey('url', $conf); |
|
29
|
|
|
$this->assertArrayHasKey('body', $conf); |
|
30
|
|
|
$this->assertArrayHasKey('method', $conf); |
|
31
|
|
|
$this->assertArrayHasKey('upload', $conf); |
|
32
|
|
|
$this->assertEquals('GET', $conf->method); |
|
33
|
|
|
$this->assertEquals(null, $conf->url); |
|
34
|
|
|
$this->assertEquals(null, $conf->body); |
|
35
|
|
|
$this->assertEquals(false, $conf->upload); |
|
36
|
|
|
} |
|
37
|
|
|
|
|
38
|
|
|
public function testTimeout() |
|
39
|
|
|
{ |
|
40
|
|
|
$conf = new Configuration(); |
|
41
|
|
|
|
|
42
|
|
|
$this->assertEquals(30, $conf->timeout); |
|
43
|
|
|
$conf->timeout = 120; |
|
44
|
|
|
$this->assertEquals(120, $conf->timeout); |
|
45
|
|
|
} |
|
46
|
|
|
|
|
47
|
|
|
public function testSslVerify() |
|
48
|
|
|
{ |
|
49
|
|
|
$conf = new Configuration(); |
|
50
|
|
|
|
|
51
|
|
|
$this->assertFalse($conf->verify); |
|
52
|
|
|
$conf->verify = true; |
|
53
|
|
|
$this->assertTrue($conf->verify); |
|
54
|
|
|
} |
|
55
|
|
|
} |
|
56
|
|
|
|