Skip to content

Commit

Permalink
PHP 5.3 support
Browse files Browse the repository at this point in the history
... eww
  • Loading branch information
michaelmoussa committed Mar 19, 2015
1 parent 776c40e commit 22a2605
Showing 1 changed file with 15 additions and 10 deletions.
25 changes: 15 additions & 10 deletions tests/ConnectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,21 @@ public function testCanBeConfiguredNotToThrowConnectionExceptions()
));
$handlerInvoked = false;

set_error_handler(function ($errno, $errstr, $errfile, $errline, $errcontext) use (&$handlerInvoked) {
$handlerInvoked = true;

$this->assertSame(E_USER_WARNING, $errno);
$this->assertSame(
'StatsD server connection failed (udp://hostdoesnotexiststalleverlol.stupidtld:8125)',
$errstr
);
$this->assertSame(realpath(__DIR__ . '/../src/Client.php'), $errfile);
}, E_USER_WARNING);
$testCase = $this;

set_error_handler(
function ($errno, $errstr, $errfile, $errline, $errcontext) use ($testCase, &$handlerInvoked) {
$handlerInvoked = true;

$testCase->assertSame(E_USER_WARNING, $errno);
$testCase->assertSame(
'StatsD server connection failed (udp://hostdoesnotexiststalleverlol.stupidtld:8125)',
$errstr
);
$testCase->assertSame(realpath(__DIR__ . '/../src/Client.php'), $errfile);
},
E_USER_WARNING
);

$this->client->increment('test');
restore_error_handler();
Expand Down

0 comments on commit 22a2605

Please sign in to comment.