ExceptionTest   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 13
dl 0
loc 21
rs 10
c 0
b 0
f 0
wmc 4

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testConnectionException() 0 8 2
A testConfigurationException() 0 8 2
1
<?php
2
/**
3
 * This file is part of graze/dog-statsd
4
 *
5
 * Copyright (c) 2016 Nature Delivered Ltd. <https://www.graze.com>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 *
10
 * @license https://github.com/graze/dog-statsd/blob/master/LICENSE.md
11
 * @link    https://github.com/graze/dog-statsd
12
 */
13
14
namespace Graze\DogStatsD\Test\Unit;
15
16
use Graze\DogStatsD\Client;
17
use Graze\DogStatsD\Exception\ConfigurationException;
18
use Graze\DogStatsD\Exception\ConnectionException;
19
use Graze\DogStatsD\Test\TestCase;
20
21
class ExceptionTest extends TestCase
22
{
23
    public function testConnectionException()
24
    {
25
        try {
26
            throw new ConnectionException('instance', 'Could not connect');
27
        } catch (ConnectionException $e) {
28
            $this->assertEquals('instance', $e->getInstance());
29
            $this->assertEquals('Could not connect', $e->getMessage());
30
            return;
31
        }
32
    }
33
34
    public function testConfigurationException()
35
    {
36
        try {
37
            throw new ConfigurationException('instance', 'Configuration error');
38
        } catch (ConfigurationException $e) {
39
            $this->assertEquals('instance', $e->getInstance());
40
            $this->assertEquals('Configuration error', $e->getMessage());
41
            return;
42
        }
43
    }
44
}
45