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

ConfigurationTest::testStringPort()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %
Metric Value
dl 0
loc 6
rs 9.4285
cc 1
eloc 3
nc 1
nop 0
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