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

HttpConfigurationTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testDefaults() 0 8 1
A testAllowRedirect() 0 13 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\HttpConfiguration;
15
16
/**
17
 * @package Bee4\Test\Transport
18
 */
19
class HttpConfigurationTest extends \PHPUnit_Framework_TestCase
20
{
21
    public function testDefaults()
22
    {
23
        $conf = new HttpConfiguration();
24
25
        $this->assertArrayHasKey('allow_redirects', $conf);
26
        $this->assertArrayHasKey('user_agent', $conf);
27
        $this->assertArrayHasKey('accept_encoding', $conf);
28
    }
29
30
    public function testAllowRedirect()
31
    {
32
        $conf = new HttpConfiguration(['allow_redirects' => false]);
33
        $this->assertFalse($conf->redirectsAllowed());
34
35
        $this->assertNull($conf->allowRedirectsMax());
36
        $conf->allowRedirectsMax(1);
37
        $this->assertTrue($conf->redirectsAllowed());
38
        $this->assertEquals(1,$conf->allowRedirectsMax());
39
        $this->assertTrue($conf->allowRedirectsReferer());
40
        $conf->allowRedirectsReferer(false);
41
        $this->assertFalse($conf->allowRedirectsReferer());
42
    }
43
}
44