forked from thephpleague/statsd
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLaravelProviderTest.php
46 lines (32 loc) · 1.37 KB
/
LaravelProviderTest.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<?php
namespace League\StatsD\Test;
use League\StatsD\Client;
class LaravelProviderTest extends LaravelTestCase
{
public function testProvider()
{
$app = $this->setupApplication();
$this->setupServiceProvider($app);
// Make sure is the right instance type
$this->assertInstanceOf(Client::class, $app['statsd']);
// Make sure configuration is sorted
$this->assertEquals('localhost', $app['statsd']->getHost());
$this->assertEquals(7890, $app['statsd']->getPort());
$this->assertEquals('test_namespace', $app['statsd']->getNamespace());
// Make sure messages are tracked properly
$app['statsd']->increment('test_metric');
$this->assertEquals('test_namespace.test_metric:1|c', $app['statsd']->getLastMessage());
}
public function testProviderDefaults()
{
$app = $this->setupApplication(false);
$this->setupServiceProvider($app);
// Make sure configuration is sorted
$this->assertEquals('127.0.0.1', $app['statsd']->getHost());
$this->assertEquals(8125, $app['statsd']->getPort(), 8015);
$this->assertEquals('', $app['statsd']->getNamespace());
// Make sure messages are tracked properly
$app['statsd']->increment('test_metric', 2);
$this->assertEquals('test_metric:2|c', $app['statsd']->getLastMessage());
}
}