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

NamespaceTest::testNamespaceIncrement()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 7

Duplication

Lines 10
Ratio 100 %
Metric Value
dl 10
loc 10
rs 9.4285
cc 1
eloc 7
nc 1
nop 0
1
<?php
2
3
namespace Graze\DogStatsD\Test\Unit;
4
5
use Graze\DogStatsD\Client;
6
use Graze\DogStatsD\Test\TestCase;
7
8
class NamespaceTest extends TestCase
9
{
10
    public function testNamespace()
11
    {
12
        $this->client->configure(array(
13
            'host' => '127.0.0.1',
14
            'port' => 8125,
15
            'namespace' => 'test_namespace'
16
        ));
17
        $this->assertEquals('test_namespace', $this->client->getNamespace());
18
    }
19
20 View Code Duplication
    public function testNamespaceIncrement()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
21
    {
22
        $this->client->configure(array(
23
            'host' => '127.0.0.1',
24
            'port' => 8125,
25
            'namespace' => 'test_namespace'
26
        ));
27
        $this->client->increment('test_metric');
28
        $this->assertEquals('test_namespace.test_metric:1|c', $this->client->getLastMessage());
29
    }
30
31
    public function testNamespaceEvent()
32
    {
33
        $this->client->configure(array(
34
            'host' => '127.0.0.1',
35
            'port' => 8125,
36
            'namespace' => 'test_namespace'
37
        ));
38
        $this->client->event('some_title', 'textAndThings');
39
        $this->assertEquals('_e{10,13}:test_namespace.some_title|textAndThings', $this->client->getLastMessage());
40
    }
41
42 View Code Duplication
    public function testNamespaceSimpleService()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
43
    {
44
        $this->client->configure(array(
45
            'host' => '127.0.0.1',
46
            'port' => 8125,
47
            'namespace' => 'test_namespace'
48
        ));
49
        $this->client->serviceCheck('service.api', Client::STATUS_OK);
50
        $this->assertEquals('_sc|test_namespace.service.api|0', $this->client->getLastMessage());
51
    }
52
}
53