1 | <?php |
||
19 | class ConfigurationTest extends TestCase |
||
20 | { |
||
21 | public function testHost() |
||
28 | |||
29 | /** |
||
30 | * @expectedException \Graze\DogStatsD\Exception\ConfigurationException |
||
31 | * @expectedExceptionMessage Option: host is expected to be: 'string', was: 'integer' |
||
32 | */ |
||
33 | public function testHostInvalidTypeWillThrowAnException() |
||
34 | { |
||
35 | $this->client->configure([ |
||
36 | 'host' => 12434, |
||
37 | ]); |
||
38 | } |
||
39 | |||
40 | /** |
||
41 | * @expectedException \Graze\DogStatsD\Exception\ConfigurationException |
||
42 | * @expectedExceptionMessage Option: Port is invalid or is out of range |
||
43 | */ |
||
44 | public function testLargePortWillThrowAnException() |
||
50 | |||
51 | /** |
||
52 | * @expectedException \Graze\DogStatsD\Exception\ConfigurationException |
||
53 | * @expectedExceptionMessage Option: Port is invalid or is out of range |
||
54 | */ |
||
55 | public function testStringPortWillThrowAnException() |
||
61 | |||
62 | public function testValidStringPort() |
||
63 | { |
||
64 | $this->client->configure([ |
||
65 | 'port' => '1234', |
||
66 | ]); |
||
67 | $this->assertEquals(1234, $this->client->getPort()); |
||
68 | } |
||
69 | |||
70 | public function testDefaultPort() |
||
71 | { |
||
72 | $this->assertEquals(8125, $this->client->getPort()); |
||
73 | } |
||
74 | |||
75 | public function testValidPort() |
||
76 | { |
||
77 | $this->client->configure([ |
||
78 | 'port' => 1234, |
||
79 | ]); |
||
80 | $this->assertEquals(1234, $this->client->getPort()); |
||
81 | } |
||
82 | |||
83 | /** |
||
84 | * @expectedException \Graze\DogStatsD\Exception\ConfigurationException |
||
85 | * @expectedExceptionMessage Option: namespace is expected to be: 'string', was: 'integer' |
||
86 | */ |
||
87 | public function testInvalidNamespace() |
||
93 | |||
94 | /** |
||
95 | * @expectedException \Graze\DogStatsD\Exception\ConfigurationException |
||
96 | * @expectedExceptionMessage Option: dataDog is expected to be: 'boolean', was: 'string' |
||
97 | */ |
||
98 | public function testInvalidDataDogThrowAnException() |
||
104 | |||
105 | /** |
||
106 | * @expectedException \Graze\DogStatsD\Exception\ConfigurationException |
||
107 | * @expectedExceptionMessage Option: tags is expected to be: 'array', was: 'string' |
||
108 | */ |
||
109 | public function testInvalidTagsThrowsAnException() |
||
115 | |||
116 | /** |
||
117 | * @expectedException \Graze\DogStatsD\Exception\ConfigurationException |
||
118 | * @expectedExceptionMessage Option: onError 'somethingelse' is not one of: [error,exception,ignore] |
||
119 | */ |
||
120 | public function testInvalidOnErrorThrowsAnException() |
||
126 | |||
127 | public function testOnErrorConfiguration() |
||
141 | } |
||
142 |