From 22a2605b2333453021ff49a1ed94b16432a342da Mon Sep 17 00:00:00 2001 From: Michael Moussa Date: Fri, 20 Feb 2015 10:23:54 -0500 Subject: [PATCH] PHP 5.3 support ... eww --- tests/ConnectionTest.php | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/tests/ConnectionTest.php b/tests/ConnectionTest.php index 8388247..a8d087d 100644 --- a/tests/ConnectionTest.php +++ b/tests/ConnectionTest.php @@ -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();