22namespace SplitIO \Test \Suite \Sdk ;
33
44use \stdClass ;
5+ use ReflectionClass ;
56use SplitIO \Test \Suite \Redis \ReflectiveTools ;
67use SplitIO \Component \Cache \ImpressionCache ;
78use SplitIO \Component \Cache \EventsCache ;
@@ -19,6 +20,7 @@ class SdkClientTest extends \PHPUnit\Framework\TestCase
1920{
2021 public function testLocalClient ()
2122 {
23+ ReflectiveTools::resetContext ();
2224 $ options ['splitFile ' ] = dirname (dirname (__DIR__ )).'/files/.splits ' ;
2325 $ splitFactory = \SplitIO \Sdk::factory ('localhost ' , $ options );
2426 $ splitSdk = $ splitFactory ->client ();
@@ -35,6 +37,7 @@ public function testLocalClient()
3537
3638 public function testLocalClientYAML ()
3739 {
40+ ReflectiveTools::resetContext ();
3841 $ options ['splitFile ' ] = dirname (dirname (__DIR__ )).'/files/splits.yml ' ;
3942 $ splitFactory = \SplitIO \Sdk::factory ('localhost ' , $ options );
4043 $ splitSdk = $ splitFactory ->client ();
@@ -207,6 +210,7 @@ private function validateLastImpression(
207210
208211 public function testClient ()
209212 {
213+ ReflectiveTools::resetContext ();
210214 //Testing version string
211215 $ this ->assertTrue (is_string (\SplitIO \version ()));
212216
@@ -437,6 +441,7 @@ public function testClient()
437441 */
438442 public function testCustomLog ()
439443 {
444+ ReflectiveTools::resetContext ();
440445 // create a log channel
441446 $ log = $ this
442447 ->getMockBuilder ('Psr\Log\LoggerInterface ' )
@@ -472,6 +477,7 @@ public function testCustomLog()
472477
473478 public function testInvalidCacheAdapter ()
474479 {
480+ ReflectiveTools::resetContext ();
475481 $ this ->expectException ('\SplitIO\Exception\Exception ' );
476482
477483 $ sdkConfig = array (
@@ -485,6 +491,7 @@ public function testInvalidCacheAdapter()
485491
486492 public function testCacheExceptionReturnsControl ()
487493 {
494+ ReflectiveTools::resetContext ();
488495 $ log = $ this
489496 ->getMockBuilder ('Psr\Log\LoggerInterface ' )
490497 ->disableOriginalConstructor ()
@@ -523,6 +530,7 @@ public function testCacheExceptionReturnsControl()
523530
524531 public function testGetTreatmentsWithDistinctFeatures ()
525532 {
533+ ReflectiveTools::resetContext ();
526534 //Testing version string
527535 $ this ->assertTrue (is_string (\SplitIO \version ()));
528536
@@ -559,13 +567,13 @@ public function testGetTreatmentsWithDistinctFeatures()
559567
560568 public function testGetTreatmentsWithRepeteadedFeatures ()
561569 {
570+ ReflectiveTools::resetContext ();
562571 //Testing version string
563572 $ this ->assertTrue (is_string (\SplitIO \version ()));
564573
565574 $ parameters = array ('scheme ' => 'redis ' , 'host ' => REDIS_HOST , 'port ' => REDIS_PORT , 'timeout ' => 881 );
566575 $ options = array ('prefix ' => TEST_PREFIX );
567576
568- ReflectiveTools::resetIPAddress ();
569577 $ sdkConfig = array (
570578 'log ' => array ('adapter ' => 'stdout ' ),
571579 'cache ' => array ('adapter ' => 'predis ' , 'parameters ' => $ parameters , 'options ' => $ options ),
@@ -597,13 +605,13 @@ public function testGetTreatmentsWithRepeteadedFeatures()
597605
598606 public function testGetTreatmentsWithRepeteadedAndNullFeatures ()
599607 {
608+ ReflectiveTools::resetIPAddress ();
600609 //Testing version string
601610 $ this ->assertTrue (is_string (\SplitIO \version ()));
602611
603612 $ parameters = array ('scheme ' => 'redis ' , 'host ' => REDIS_HOST , 'port ' => REDIS_PORT , 'timeout ' => 881 );
604613 $ options = array ('prefix ' => TEST_PREFIX );
605614
606- ReflectiveTools::resetIPAddress ();
607615 $ sdkConfig = array (
608616 'log ' => array ('adapter ' => 'stdout ' ),
609617 'cache ' => array ('adapter ' => 'predis ' , 'parameters ' => $ parameters , 'options ' => $ options ),
@@ -635,6 +643,7 @@ public function testGetTreatmentsWithRepeteadedAndNullFeatures()
635643
636644 public function testGetTreatmentsFetchesSplitsInOneCall ()
637645 {
646+ ReflectiveTools::resetIPAddress ();
638647 // Set redis-library client mock
639648 $ predisMock = $ this
640649 ->getMockBuilder ('\Predis\Client ' )
@@ -682,13 +691,13 @@ public function testGetTreatmentsFetchesSplitsInOneCall()
682691
683692 public function testMultipleInstantiationNotOverrideIP ()
684693 {
694+ ReflectiveTools::resetIPAddress ();
685695 //Testing version string
686696 $ this ->assertTrue (is_string (\SplitIO \version ()));
687697
688698 $ parameters = array ('scheme ' => 'redis ' , 'host ' => REDIS_HOST , 'port ' => REDIS_PORT , 'timeout ' => 881 );
689699 $ options = array ('prefix ' => TEST_PREFIX );
690700
691- ReflectiveTools::resetIPAddress ();
692701 $ sdkConfig = array (
693702 'log ' => array ('adapter ' => 'stdout ' ),
694703 'cache ' => array ('adapter ' => 'predis ' , 'parameters ' => $ parameters , 'options ' => $ options ),
0 commit comments