1111
1212class StatsDTest extends TestCase
1313{
14- public function testConfigure ()
14+ public function testBuildOptions ()
1515 {
1616 if (!class_exists ('\League\StatsD\Client ' )) {
1717 $ this ->markTestSkipped ('Missing league/statsd package ' );
@@ -21,25 +21,19 @@ public function testConfigure()
2121 ->disableOriginalConstructor ()
2222 ->getMock ();
2323
24- $ statsdClient = $ this ->getMockBuilder ('\League\StatsD\Client ' )->getMock ();
25- $ statsdClient ->expects ($ this ->once ())
26- ->method ('configure ' )
27- ->with ([
24+ $ reflection = new \ReflectionClass ($ statsClient );
25+ $ methodBuildOptions = $ reflection ->getMethod ('buildOptions ' );
26+ $ methodBuildOptions ->setAccessible (true );
27+ $ this ->assertEquals (
28+ [
2829 'host ' => 'stats.local ' ,
2930 'port ' => 1234 ,
3031 'namespace ' => 'prefix.ns ' ,
3132 'timeout ' => 2.5 ,
3233 'throwConnectionExceptions ' => false ,
33- ]);
34-
35- $ reflection = new \ReflectionClass ($ statsClient );
36- $ propertyClient = $ reflection ->getProperty ('client ' );
37- $ propertyClient ->setAccessible (true );
38- $ propertyClient ->setValue ($ statsClient , $ statsdClient );
39-
40- $ methodConfigure = $ reflection ->getMethod ('configure ' );
41- $ methodConfigure ->setAccessible (true );
42- $ methodConfigure ->invoke ($ statsClient , 'statsd://stats.local:1234/prefix.ns?timeout=2.5&error=0 ' );
34+ ],
35+ $ methodBuildOptions ->invoke ($ statsClient , 'statsd://stats.local:1234/prefix.ns?timeout=2.5&error=0 ' )
36+ );
4337 }
4438
4539 public function testInstances ()
0 commit comments