1 | <?php |
||
7 | class ConnectionTest extends TestCase |
||
8 | { |
||
9 | /** |
||
10 | * Non-integer ports are not acceptable |
||
11 | * |
||
12 | * @expectedException \Graze\DogStatsD\Exception\ConnectionException |
||
13 | */ |
||
14 | public function testInvalidHost() |
||
21 | |||
22 | public function testTimeoutSettingIsUsedWhenCreatingSocketIfProvided() |
||
30 | |||
31 | public function testCanBeConfiguredNotToThrowConnectionExceptions() |
||
32 | { |
||
33 | $this->client->configure(array( |
||
34 | 'host' => 'hostdoesnotexiststalleverlol.stupidtld', |
||
35 | 'throwExceptions' => false, |
||
36 | )); |
||
37 | $handlerInvoked = false; |
||
38 | |||
39 | $testCase = $this; |
||
40 | |||
41 | set_error_handler( |
||
42 | function ($errno, $errstr, $errfile, $errline, $errcontext) use ($testCase, &$handlerInvoked) { |
||
43 | $handlerInvoked = true; |
||
44 | |||
45 | $testCase->assertSame(E_USER_WARNING, $errno); |
||
46 | $testCase->assertSame( |
||
47 | 'StatsD server connection failed (udp://hostdoesnotexiststalleverlol.stupidtld:8125)', |
||
48 | $errstr |
||
49 | ); |
||
50 | $testCase->assertSame(realpath(__DIR__ . '/../../src/Client.php'), $errfile); |
||
51 | }, |
||
52 | E_USER_WARNING |
||
53 | ); |
||
54 | |||
55 | $this->client->increment('test'); |
||
56 | restore_error_handler(); |
||
57 | |||
58 | $this->assertTrue($handlerInvoked); |
||
59 | } |
||
60 | |||
61 | public function testTimeoutDefaultsToPhpIniDefaultSocketTimeout() |
||
65 | } |
||
66 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.