Completed
Push — master ( f62226...8b6b73 )
by Stéphane
10s
created

ConfigurationTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 3
c 2
b 0
f 0
lcom 1
cbo 2
dl 0
loc 37
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A testDefaults() 0 16 1
A testTimeout() 0 8 1
A testSslVerify() 0 8 1
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