2
2
namespace SplitIO \Test \Suite \Sdk ;
3
3
4
4
use \stdClass ;
5
+ use ReflectionClass ;
5
6
use SplitIO \Test \Suite \Redis \ReflectiveTools ;
6
7
use SplitIO \Component \Cache \ImpressionCache ;
7
8
use SplitIO \Component \Cache \EventsCache ;
@@ -19,6 +20,7 @@ class SdkClientTest extends \PHPUnit\Framework\TestCase
19
20
{
20
21
public function testLocalClient ()
21
22
{
23
+ ReflectiveTools::resetContext ();
22
24
$ options ['splitFile ' ] = dirname (dirname (__DIR__ )).'/files/.splits ' ;
23
25
$ splitFactory = \SplitIO \Sdk::factory ('localhost ' , $ options );
24
26
$ splitSdk = $ splitFactory ->client ();
@@ -35,6 +37,7 @@ public function testLocalClient()
35
37
36
38
public function testLocalClientYAML ()
37
39
{
40
+ ReflectiveTools::resetContext ();
38
41
$ options ['splitFile ' ] = dirname (dirname (__DIR__ )).'/files/splits.yml ' ;
39
42
$ splitFactory = \SplitIO \Sdk::factory ('localhost ' , $ options );
40
43
$ splitSdk = $ splitFactory ->client ();
@@ -207,6 +210,7 @@ private function validateLastImpression(
207
210
208
211
public function testClient ()
209
212
{
213
+ ReflectiveTools::resetContext ();
210
214
//Testing version string
211
215
$ this ->assertTrue (is_string (\SplitIO \version ()));
212
216
@@ -437,6 +441,7 @@ public function testClient()
437
441
*/
438
442
public function testCustomLog ()
439
443
{
444
+ ReflectiveTools::resetContext ();
440
445
// create a log channel
441
446
$ log = $ this
442
447
->getMockBuilder ('Psr\Log\LoggerInterface ' )
@@ -472,6 +477,7 @@ public function testCustomLog()
472
477
473
478
public function testInvalidCacheAdapter ()
474
479
{
480
+ ReflectiveTools::resetContext ();
475
481
$ this ->expectException ('\SplitIO\Exception\Exception ' );
476
482
477
483
$ sdkConfig = array (
@@ -485,6 +491,7 @@ public function testInvalidCacheAdapter()
485
491
486
492
public function testCacheExceptionReturnsControl ()
487
493
{
494
+ ReflectiveTools::resetContext ();
488
495
$ log = $ this
489
496
->getMockBuilder ('Psr\Log\LoggerInterface ' )
490
497
->disableOriginalConstructor ()
@@ -523,6 +530,7 @@ public function testCacheExceptionReturnsControl()
523
530
524
531
public function testGetTreatmentsWithDistinctFeatures ()
525
532
{
533
+ ReflectiveTools::resetContext ();
526
534
//Testing version string
527
535
$ this ->assertTrue (is_string (\SplitIO \version ()));
528
536
@@ -559,13 +567,13 @@ public function testGetTreatmentsWithDistinctFeatures()
559
567
560
568
public function testGetTreatmentsWithRepeteadedFeatures ()
561
569
{
570
+ ReflectiveTools::resetContext ();
562
571
//Testing version string
563
572
$ this ->assertTrue (is_string (\SplitIO \version ()));
564
573
565
574
$ parameters = array ('scheme ' => 'redis ' , 'host ' => REDIS_HOST , 'port ' => REDIS_PORT , 'timeout ' => 881 );
566
575
$ options = array ('prefix ' => TEST_PREFIX );
567
576
568
- ReflectiveTools::resetIPAddress ();
569
577
$ sdkConfig = array (
570
578
'log ' => array ('adapter ' => 'stdout ' ),
571
579
'cache ' => array ('adapter ' => 'predis ' , 'parameters ' => $ parameters , 'options ' => $ options ),
@@ -597,13 +605,13 @@ public function testGetTreatmentsWithRepeteadedFeatures()
597
605
598
606
public function testGetTreatmentsWithRepeteadedAndNullFeatures ()
599
607
{
608
+ ReflectiveTools::resetIPAddress ();
600
609
//Testing version string
601
610
$ this ->assertTrue (is_string (\SplitIO \version ()));
602
611
603
612
$ parameters = array ('scheme ' => 'redis ' , 'host ' => REDIS_HOST , 'port ' => REDIS_PORT , 'timeout ' => 881 );
604
613
$ options = array ('prefix ' => TEST_PREFIX );
605
614
606
- ReflectiveTools::resetIPAddress ();
607
615
$ sdkConfig = array (
608
616
'log ' => array ('adapter ' => 'stdout ' ),
609
617
'cache ' => array ('adapter ' => 'predis ' , 'parameters ' => $ parameters , 'options ' => $ options ),
@@ -635,6 +643,7 @@ public function testGetTreatmentsWithRepeteadedAndNullFeatures()
635
643
636
644
public function testGetTreatmentsFetchesSplitsInOneCall ()
637
645
{
646
+ ReflectiveTools::resetIPAddress ();
638
647
// Set redis-library client mock
639
648
$ predisMock = $ this
640
649
->getMockBuilder ('\Predis\Client ' )
@@ -682,13 +691,13 @@ public function testGetTreatmentsFetchesSplitsInOneCall()
682
691
683
692
public function testMultipleInstantiationNotOverrideIP ()
684
693
{
694
+ ReflectiveTools::resetIPAddress ();
685
695
//Testing version string
686
696
$ this ->assertTrue (is_string (\SplitIO \version ()));
687
697
688
698
$ parameters = array ('scheme ' => 'redis ' , 'host ' => REDIS_HOST , 'port ' => REDIS_PORT , 'timeout ' => 881 );
689
699
$ options = array ('prefix ' => TEST_PREFIX );
690
700
691
- ReflectiveTools::resetIPAddress ();
692
701
$ sdkConfig = array (
693
702
'log ' => array ('adapter ' => 'stdout ' ),
694
703
'cache ' => array ('adapter ' => 'predis ' , 'parameters ' => $ parameters , 'options ' => $ options ),
0 commit comments