Completed
Pull Request — master (#1)
by Harry
03:02
created

ConfigurationTest   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 56
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

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

5 Methods

Rating   Name   Duplication   Size   Complexity  
A testLargePort() 0 6 1
A testStringPort() 0 6 1
A testDefaultPort() 0 4 1
A testValidPort() 0 7 1
A testHost() 0 7 1
1
<?php
2
3
namespace Graze\DogStatsD\Test\Unit;
4
5
use Graze\DogStatsD\Test\TestCase;
6
7
class ConfigurationTest extends TestCase
8
{
9
    public function testHost()
10
    {
11
        $this->client->configure([
12
            'host' => '127.0.0.1'
13
        ]);
14
        $this->assertEquals('127.0.0.1', $this->client->getHost());
15
    }
16
17
    /**
18
     * Large ports should be out of range
19
     *
20
     * @expectedException \Graze\DogStatsD\Exception\ConfigurationException
21
     */
22
    public function testLargePort()
23
    {
24
        $this->client->configure(array(
25
            'port' => 65536,
26
        ));
27
    }
28
29
30
    /**
31
     * Non-integer ports are not acceptable
32
     *
33
     * @expectedException \Graze\DogStatsD\Exception\ConfigurationException
34
     */
35
    public function testStringPort()
36
    {
37
        $this->client->configure(array(
38
            'port' => 'not-integer',
39
        ));
40
    }
41
42
43
    /**
44
     * Default Port
45
     */
46
    public function testDefaultPort()
47
    {
48
        $this->assertEquals($this->client->getPort(), 8125);
49
    }
50
51
52
    /**
53
     * Valid Port
54
     */
55
    public function testValidPort()
56
    {
57
        $this->client->configure(array(
58
            'port' => 1234,
59
        ));
60
        $this->assertEquals($this->client->getPort(), 1234);
61
    }
62
}
63