From 9489dfcb959702502266d05fcc520569c00375b5 Mon Sep 17 00:00:00 2001 From: Matias Melograno Date: Wed, 18 Jan 2023 16:48:36 -0300 Subject: [PATCH 1/2] replaced setMethods and doc --- .../Component/Cache/ImpressionCache.php | 1 - src/SplitIO/Component/Cache/SplitCache.php | 4 ++-- .../Component/Cache/SplitCacheInterface.php | 2 +- .../Cache/Storage/Adapter/PRedis.php | 1 - .../Storage/Adapter/SafeRedisWrapper.php | 3 --- src/SplitIO/Component/Common/Context.php | 4 ++-- .../Initialization/LoggerFactory.php | 4 ++-- src/SplitIO/Component/Log/Logger.php | 1 - src/SplitIO/Engine.php | 1 - src/SplitIO/Engine/Hash/HashFactory.php | 2 +- src/SplitIO/Engine/Splitter.php | 8 ++++---- .../Grammar/Condition/Matcher/Dependency.php | 1 - .../Grammar/Condition/Matcher/Segment.php | 1 - src/SplitIO/Grammar/Split.php | 2 +- src/SplitIO/Sdk.php | 5 +---- src/SplitIO/Sdk/Factory/SplitFactory.php | 3 --- .../Sdk/Manager/LocalhostSplitManager.php | 5 +++++ src/SplitIO/Sdk/Manager/SplitManager.php | 3 +-- src/SplitIO/Sdk/Validator/InputValidator.php | 2 -- src/SplitIO/Split.php | 2 +- src/SplitIO/functions.php | 2 -- tests/Suite/Adapter/RedisAdapterTest.php | 7 ++----- tests/Suite/Attributes/SdkAttributesTest.php | 5 ----- .../Suite/Component/KeysStaticMethodsTest.php | 3 --- tests/Suite/Component/TrafficTypeTests.php | 8 +++++--- .../DynamicConfigurations/EvaluatorTest.php | 1 - tests/Suite/Engine/SplitterTest.php | 4 ---- .../InputValidation/FactoryTrackerTest.php | 4 ++-- .../GetTreatmentValidationTest.php | 4 ++-- .../GetTreatmentsValidationTest.php | 4 ++-- .../InputValidation/ManagerValidationTest.php | 4 ++-- .../InputValidation/TrackValidationTest.php | 4 ++-- tests/Suite/Matchers/MatchersTest.php | 6 +----- tests/Suite/Redis/CacheInterfacesTest.php | 1 - tests/Suite/Redis/ReflectiveTools.php | 8 ++++---- tests/Suite/Redis/SafeRedisWrapperTest.php | 7 +++++-- tests/Suite/Sdk/ImpressionWrapperTest.php | 2 -- tests/Suite/Sdk/SdkClientTest.php | 20 ++++++++----------- tests/Suite/Sdk/SdkReadOnlyTest.php | 11 ++-------- .../TrafficAllocationTest.php | 1 - 40 files changed, 58 insertions(+), 103 deletions(-) diff --git a/src/SplitIO/Component/Cache/ImpressionCache.php b/src/SplitIO/Component/Cache/ImpressionCache.php index c15caf38..ff088a92 100644 --- a/src/SplitIO/Component/Cache/ImpressionCache.php +++ b/src/SplitIO/Component/Cache/ImpressionCache.php @@ -2,7 +2,6 @@ namespace SplitIO\Component\Cache; use SplitIO\Component\Common\Context; -use SplitIO\Component\Cache\KeyFactory; use SplitIO\Sdk\QueueMetadataMessage; use SplitIO\Component\Cache\Pool; diff --git a/src/SplitIO/Component/Cache/SplitCache.php b/src/SplitIO/Component/Cache/SplitCache.php index 80226115..8196c502 100644 --- a/src/SplitIO/Component/Cache/SplitCache.php +++ b/src/SplitIO/Component/Cache/SplitCache.php @@ -44,7 +44,7 @@ private static function getSplitNameFromCacheKey($key) } /** - * @return long + * @return int */ public function getChangeNumber() { @@ -64,7 +64,7 @@ public function getSplit($splitName) /** * @param array $splitNames - * @return string JSON representation + * @return array */ public function getSplits($splitNames) { diff --git a/src/SplitIO/Component/Cache/SplitCacheInterface.php b/src/SplitIO/Component/Cache/SplitCacheInterface.php index 1321466a..a667e48c 100644 --- a/src/SplitIO/Component/Cache/SplitCacheInterface.php +++ b/src/SplitIO/Component/Cache/SplitCacheInterface.php @@ -4,7 +4,7 @@ interface SplitCacheInterface { /** - * @return long + * @return int */ public function getChangeNumber(); diff --git a/src/SplitIO/Component/Cache/Storage/Adapter/PRedis.php b/src/SplitIO/Component/Cache/Storage/Adapter/PRedis.php index 3504ee81..af4204ab 100644 --- a/src/SplitIO/Component/Cache/Storage/Adapter/PRedis.php +++ b/src/SplitIO/Component/Cache/Storage/Adapter/PRedis.php @@ -2,7 +2,6 @@ namespace SplitIO\Component\Cache\Storage\Adapter; use SplitIO\Component\Cache\Storage\Exception\AdapterException; -use SplitIO\Component\Cache\Item; use SplitIO\Component\Utils as SplitIOUtils; use SplitIO\Component\Common\Context; diff --git a/src/SplitIO/Component/Cache/Storage/Adapter/SafeRedisWrapper.php b/src/SplitIO/Component/Cache/Storage/Adapter/SafeRedisWrapper.php index 43484898..5f26405e 100644 --- a/src/SplitIO/Component/Cache/Storage/Adapter/SafeRedisWrapper.php +++ b/src/SplitIO/Component/Cache/Storage/Adapter/SafeRedisWrapper.php @@ -1,9 +1,6 @@ getMockBuilder('\SplitIO\Component\Log\Logger') ->disableOriginalConstructor() - ->setMethods(array('warning', 'debug', 'error', 'info', 'critical', 'emergency', - 'alert', 'notice', 'write', 'log')) + ->onlyMethods(array('warning', 'debug', 'error', 'info', 'critical', 'emergency', + 'alert', 'notice', 'log')) ->getMock(); ReflectiveTools::overrideLogger($logger); diff --git a/tests/Suite/Attributes/SdkAttributesTest.php b/tests/Suite/Attributes/SdkAttributesTest.php index 4eb75c92..1ce2af0f 100644 --- a/tests/Suite/Attributes/SdkAttributesTest.php +++ b/tests/Suite/Attributes/SdkAttributesTest.php @@ -1,11 +1,6 @@ getMockBuilder('\SplitIO\Component\Log\Logger') ->disableOriginalConstructor() - ->setMethods(array('warning', 'debug', 'error', 'info', 'critical', 'emergency', + ->onlyMethods(array('warning', 'debug', 'error', 'info', 'critical', 'emergency', 'alert', 'notice', 'write', 'log')) ->getMock(); @@ -42,10 +42,12 @@ public function testTrafficTypeWarning() $this->assertEquals($keyTrafficType, 'SPLITIO.trafficType.abc'); - $redisClient = ReflectiveTools::clientFromCachePool(Context::getCache()); + $factory = \SplitIO\Sdk::factory('asdqwe123456', $sdkConfig); + $redisClient = ReflectiveTools::clientFromFactory($factory); + $cachePool = ReflectiveTools::cacheFromFactory($factory); $redisClient->del($keyTrafficType); - $splitCache = new SplitCache(); + $splitCache = new SplitCache($cachePool); $this->assertEquals($splitCache->trafficTypeExists("abc"), false); diff --git a/tests/Suite/DynamicConfigurations/EvaluatorTest.php b/tests/Suite/DynamicConfigurations/EvaluatorTest.php index 4face6ad..b57db811 100644 --- a/tests/Suite/DynamicConfigurations/EvaluatorTest.php +++ b/tests/Suite/DynamicConfigurations/EvaluatorTest.php @@ -4,7 +4,6 @@ use SplitIO\Test\Suite\Redis\ReflectiveTools; use SplitIO\Component\Cache\SplitCache; use SplitIO\Component\Cache\SegmentCache; -use SplitIO\Grammar\Split; use SplitIO\Sdk\Evaluator; class EvaluatorTest extends \PHPUnit\Framework\TestCase diff --git a/tests/Suite/Engine/SplitterTest.php b/tests/Suite/Engine/SplitterTest.php index 86f370b4..4c0eb506 100644 --- a/tests/Suite/Engine/SplitterTest.php +++ b/tests/Suite/Engine/SplitterTest.php @@ -2,13 +2,9 @@ namespace SplitIO\Test\Suite\Engine; use SplitIO\Component\Initialization\LoggerFactory; -use SplitIO\Component\Common\ServiceProvider; -use SplitIO\Component\Log\LogLevelEnum; use SplitIO\Engine\Splitter; use SplitIO\Grammar\Condition\Partition; use SplitIO\Engine\Hash\HashAlgorithmEnum; -use SplitIO\Grammar\Split; -use SplitIO\Engine; use SplitIO\Component\Common\Context; class SplitterTest extends \PHPUnit\Framework\TestCase diff --git a/tests/Suite/InputValidation/FactoryTrackerTest.php b/tests/Suite/InputValidation/FactoryTrackerTest.php index 1f29109a..deeeee92 100644 --- a/tests/Suite/InputValidation/FactoryTrackerTest.php +++ b/tests/Suite/InputValidation/FactoryTrackerTest.php @@ -11,8 +11,8 @@ private function getMockedLogger() $logger = $this ->getMockBuilder('\SplitIO\Component\Log\Logger') ->disableOriginalConstructor() - ->setMethods(array('warning', 'debug', 'error', 'info', 'critical', 'emergency', - 'alert', 'notice', 'write', 'log')) + ->onlyMethods(array('warning', 'debug', 'error', 'info', 'critical', 'emergency', + 'alert', 'notice', 'log')) ->getMock(); ReflectiveTools::overrideLogger($logger); diff --git a/tests/Suite/InputValidation/GetTreatmentValidationTest.php b/tests/Suite/InputValidation/GetTreatmentValidationTest.php index d2ce149b..436983ea 100644 --- a/tests/Suite/InputValidation/GetTreatmentValidationTest.php +++ b/tests/Suite/InputValidation/GetTreatmentValidationTest.php @@ -32,8 +32,8 @@ private function getMockedLogger() $logger = $this ->getMockBuilder('\SplitIO\Component\Log\Logger') ->disableOriginalConstructor() - ->setMethods(array('warning', 'debug', 'error', 'info', 'critical', 'emergency', - 'alert', 'notice', 'write', 'log')) + ->onlyMethods(array('warning', 'debug', 'error', 'info', 'critical', 'emergency', + 'alert', 'notice', 'log')) ->getMock(); ReflectiveTools::overrideLogger($logger); diff --git a/tests/Suite/InputValidation/GetTreatmentsValidationTest.php b/tests/Suite/InputValidation/GetTreatmentsValidationTest.php index 899e83af..98db5941 100644 --- a/tests/Suite/InputValidation/GetTreatmentsValidationTest.php +++ b/tests/Suite/InputValidation/GetTreatmentsValidationTest.php @@ -32,8 +32,8 @@ private function getMockedLogger() $logger = $this ->getMockBuilder('\SplitIO\Component\Log\Logger') ->disableOriginalConstructor() - ->setMethods(array('warning', 'debug', 'error', 'info', 'critical', 'emergency', - 'alert', 'notice', 'write', 'log')) + ->onlyMethods(array('warning', 'debug', 'error', 'info', 'critical', 'emergency', + 'alert', 'notice', 'log')) ->getMock(); ReflectiveTools::overrideLogger($logger); diff --git a/tests/Suite/InputValidation/ManagerValidationTest.php b/tests/Suite/InputValidation/ManagerValidationTest.php index d2fd833f..8e7cf568 100644 --- a/tests/Suite/InputValidation/ManagerValidationTest.php +++ b/tests/Suite/InputValidation/ManagerValidationTest.php @@ -29,8 +29,8 @@ private function getMockedLogger() $logger = $this ->getMockBuilder('\SplitIO\Component\Log\Logger') ->disableOriginalConstructor() - ->setMethods(array('warning', 'debug', 'error', 'info', 'critical', 'emergency', - 'alert', 'notice', 'write', 'log')) + ->onlyMethods(array('warning', 'debug', 'error', 'info', 'critical', 'emergency', + 'alert', 'notice', 'log')) ->getMock(); ReflectiveTools::overrideLogger($logger); diff --git a/tests/Suite/InputValidation/TrackValidationTest.php b/tests/Suite/InputValidation/TrackValidationTest.php index 3b1ea1f4..c11ebef9 100644 --- a/tests/Suite/InputValidation/TrackValidationTest.php +++ b/tests/Suite/InputValidation/TrackValidationTest.php @@ -32,8 +32,8 @@ private function getMockedLogger() $logger = $this ->getMockBuilder('\SplitIO\Component\Log\Logger') ->disableOriginalConstructor() - ->setMethods(array('warning', 'debug', 'error', 'info', 'critical', 'emergency', - 'alert', 'notice', 'write', 'log')) + ->onlyMethods(array('warning', 'debug', 'error', 'info', 'critical', 'emergency', + 'alert', 'notice', 'log')) ->getMock(); ReflectiveTools::overrideLogger($logger); diff --git a/tests/Suite/Matchers/MatchersTest.php b/tests/Suite/Matchers/MatchersTest.php index 0d8a50e0..83ba9568 100644 --- a/tests/Suite/Matchers/MatchersTest.php +++ b/tests/Suite/Matchers/MatchersTest.php @@ -1,12 +1,8 @@ getMockBuilder('\SplitIO\Sdk\Evaluator') ->disableOriginalConstructor() - ->setMethods(array('evaluateFeature')) + ->onlyMethods(array('evaluateFeature')) ->getMock(); $evaluator->method('evaluateFeature')->willReturn(array('treatment' => 'on')); diff --git a/tests/Suite/Redis/CacheInterfacesTest.php b/tests/Suite/Redis/CacheInterfacesTest.php index 16971c01..8e94bb65 100644 --- a/tests/Suite/Redis/CacheInterfacesTest.php +++ b/tests/Suite/Redis/CacheInterfacesTest.php @@ -6,7 +6,6 @@ use SplitIO\Component\Cache\SegmentCache; use SplitIO\Component\Cache\SplitCache; use SplitIO\Component\Common\Context; -use SplitIO\Component\Cache\BlockUntilReadyCache; use SplitIO\Component\Log\Handler\Stdout; use SplitIO\Component\Log\Logger; use SplitIO\Component\Log\LogLevelEnum; diff --git a/tests/Suite/Redis/ReflectiveTools.php b/tests/Suite/Redis/ReflectiveTools.php index 91d9e0d8..f7080370 100644 --- a/tests/Suite/Redis/ReflectiveTools.php +++ b/tests/Suite/Redis/ReflectiveTools.php @@ -59,7 +59,7 @@ public static function clientFromCachePool(\SplitIO\Component\Cache\Pool $cacheP public static function overrideLogger($logger) { $di = Context::getInstance(); - $reflection = new \ReflectionClass('SplitIO\Component\Common\Context'); + $reflection = new ReflectionClass('SplitIO\Component\Common\Context'); $property = $reflection->getProperty('logger'); $property->setAccessible(true); $property->setValue($di, $logger); @@ -68,7 +68,7 @@ public static function overrideLogger($logger) public static function resetIPAddress() { $di = Context::getInstance(); - $reflection = new \ReflectionClass('SplitIO\Component\Common\Context'); + $reflection = new ReflectionClass('SplitIO\Component\Common\Context'); $property = $reflection->getProperty('ipAddress'); $property->setAccessible(true); $property->setValue($di, ""); @@ -77,7 +77,7 @@ public static function resetIPAddress() public static function overrideTracker() { $di = Context::getInstance(); - $reflection = new \ReflectionClass('SplitIO\Component\Common\Context'); + $reflection = new ReflectionClass('SplitIO\Component\Common\Context'); $property = $reflection->getProperty('factoryTracker'); $property->setAccessible(true); $property->setValue($di, array()); @@ -86,7 +86,7 @@ public static function overrideTracker() public static function resetContext() { $context = Context::getInstance(); - $reflection = new \ReflectionClass($context); + $reflection = new ReflectionClass($context); $instance = $reflection->getProperty('instance'); $instance->setAccessible(true); $instance->setValue(null, null); diff --git a/tests/Suite/Redis/SafeRedisWrapperTest.php b/tests/Suite/Redis/SafeRedisWrapperTest.php index 473a7aa6..320f2999 100644 --- a/tests/Suite/Redis/SafeRedisWrapperTest.php +++ b/tests/Suite/Redis/SafeRedisWrapperTest.php @@ -12,17 +12,20 @@ class SafeRedisWrapperTest extends \PHPUnit\Framework\TestCase public function testAllMethodsException() { // Set redis-library client mock - $cachePoolMethods = array('get', 'mget', 'rpush', 'keys', 'sismember', 'expire', 'getOptions'); + $cachePoolMethods = array('get', 'mget', 'rpush', 'keys', 'sismember', 'expire'); $predisMock = $this ->getMockBuilder('\Predis\Client') ->disableOriginalConstructor() - ->setMethods($cachePoolMethods) + ->addMethods($cachePoolMethods) + ->onlyMethods(array('getOptions')) ->getMock(); foreach ($cachePoolMethods as $method) { $predisMock->method($method) ->will($this->throwException(new \Exception())); } + $predisMock->method('getOptions') + ->will($this->throwException(new \Exception())); $predisMock->method('getOptions') ->willReturn(array()); diff --git a/tests/Suite/Sdk/ImpressionWrapperTest.php b/tests/Suite/Sdk/ImpressionWrapperTest.php index e2e79e19..c4e636fb 100644 --- a/tests/Suite/Sdk/ImpressionWrapperTest.php +++ b/tests/Suite/Sdk/ImpressionWrapperTest.php @@ -3,11 +3,9 @@ use SplitIO\Sdk\ImpressionListenerWrapper; use SplitIO\Sdk\Impressions\Impression; -use SplitIO\Component\Cache\SplitCache; use SplitIO\Grammar\Condition\Partition\TreatmentEnum; use SplitIO\Test\Suite\Sdk\Helpers\ListenerClient; use SplitIO\Test\Suite\Sdk\Helpers\ListenerClientWithException; -use SplitIO\Test\Suite\Sdk\Helpers\ListenerClientWrong; use SplitIO\Test\Suite\Redis\ReflectiveTools; use SplitIO\Test\Utils; diff --git a/tests/Suite/Sdk/SdkClientTest.php b/tests/Suite/Sdk/SdkClientTest.php index 9bcca6f7..62850c19 100644 --- a/tests/Suite/Sdk/SdkClientTest.php +++ b/tests/Suite/Sdk/SdkClientTest.php @@ -6,7 +6,6 @@ use SplitIO\Test\Suite\Redis\ReflectiveTools; use SplitIO\Component\Cache\ImpressionCache; use SplitIO\Component\Cache\EventsCache; -use SplitIO\Component\Cache\Storage\Adapter; use SplitIO\Component\Cache\Storage\Adapter\PRedis; use SplitIO\Component\Cache\Pool; use SplitIO\Component\Cache\SegmentCache; @@ -436,9 +435,6 @@ public function testClient() $this->assertEquals('{"size":15,"test":20}', $configs['on']); } - /** - * @depends testClient - */ public function testCustomLog() { ReflectiveTools::resetContext(); @@ -446,8 +442,8 @@ public function testCustomLog() $log = $this ->getMockBuilder('Psr\Log\LoggerInterface') ->disableOriginalConstructor() - ->setMethods(array('warning', 'debug', 'error', 'info', 'critical', 'emergency', - 'alert', 'notice', 'write', 'log')) + ->onlyMethods(array('warning', 'debug', 'error', 'info', 'critical', 'emergency', + 'alert', 'notice', 'log')) ->getMock(); $parameters = array('scheme' => 'redis', 'host' => REDIS_HOST, 'port' => REDIS_PORT, 'timeout' => 881); @@ -495,8 +491,8 @@ public function testCacheExceptionReturnsControl() $log = $this ->getMockBuilder('Psr\Log\LoggerInterface') ->disableOriginalConstructor() - ->setMethods(array('warning', 'debug', 'error', 'info', 'critical', 'emergency', - 'alert', 'notice', 'write', 'log')) + ->onlyMethods(array('warning', 'debug', 'error', 'info', 'critical', 'emergency', + 'alert', 'notice', 'log')) ->getMock(); $parameters = array('scheme' => 'redis', 'host' => REDIS_HOST, 'port' => REDIS_PORT, 'timeout' => 881); @@ -516,7 +512,7 @@ public function testCacheExceptionReturnsControl() $cachePool = $this ->getMockBuilder('\SplitIO\Component\Cache\Pool') ->disableOriginalConstructor() - ->setMethods($cachePoolMethods) + ->onlyMethods($cachePoolMethods) ->getMock(); foreach ($cachePoolMethods as $method) { @@ -648,19 +644,19 @@ public function testGetTreatmentsFetchesSplitsInOneCall() $predisMock = $this ->getMockBuilder('\Predis\Client') ->disableOriginalConstructor() - ->setMethods(array('get', 'mget', 'rpush', 'incr')) + ->addMethods(array('get', 'mget', 'rpush', 'incr')) ->getMock(); // Create an adapter and inject mock via reflection $adapter = new PRedis(array('parameters' => array())); - $adapterReflection = new \ReflectionClass($adapter); + $adapterReflection = new ReflectionClass($adapter); $clientProperty = $adapterReflection->getProperty('client'); $clientProperty->setAccessible(true); $clientProperty->setValue($adapter, $predisMock); // Create a pool and inject the adapter via reflection $pool = new Pool(array('adapter' => array('name' => 'predis', 'options' => array('parameters' => array())))); - $poolReflection = new \ReflectionClass($pool); + $poolReflection = new ReflectionClass($pool); $adapterProperty = $poolReflection->getProperty('adapter'); $adapterProperty->setAccessible(true); $adapterProperty->setValue($pool, $adapter); diff --git a/tests/Suite/Sdk/SdkReadOnlyTest.php b/tests/Suite/Sdk/SdkReadOnlyTest.php index 3c78f2b3..6c438488 100644 --- a/tests/Suite/Sdk/SdkReadOnlyTest.php +++ b/tests/Suite/Sdk/SdkReadOnlyTest.php @@ -2,15 +2,8 @@ namespace SplitIO\Test\Suite\Sdk; -use SplitIO\Component\Cache\SplitCache; -use SplitIO\Component\Cache\ImpressionCache; use SplitIO\Component\Cache\Storage\Adapter\PRedis; use SplitIO\Component\Common\Context; -use SplitIO\Test\Suite\Redis\PRedisReadOnlyMock; -use SplitIO\Grammar\Condition\Partition\TreatmentEnum; -use SplitIO\Sdk\Impressions\Impression; -use SplitIO\Sdk\QueueMetadataMessage; -use SplitIO\Test\Suite\Redis\ReflectiveTools; use SplitIO\Test\Utils; @@ -39,8 +32,8 @@ public function testClient() $logger = $this ->getMockBuilder('\SplitIO\Component\Log\Logger') ->disableOriginalConstructor() - ->setMethods(array('warning', 'debug', 'error', 'info', 'critical', 'emergency', - 'alert', 'notice', 'write', 'log')) + ->onlyMethods(array('warning', 'debug', 'error', 'info', 'critical', 'emergency', + 'alert', 'notice', 'log')) ->getMock(); $logger->expects($this->any()) diff --git a/tests/Suite/TrafficAllocation/TrafficAllocationTest.php b/tests/Suite/TrafficAllocation/TrafficAllocationTest.php index ec2ccd95..9aaac8c3 100644 --- a/tests/Suite/TrafficAllocation/TrafficAllocationTest.php +++ b/tests/Suite/TrafficAllocation/TrafficAllocationTest.php @@ -2,7 +2,6 @@ namespace SplitIO\Test\Suite\TrafficAllocation; use SplitIO\Component\Initialization\LoggerFactory; -use SplitIO\Component\Common\ServiceProvider; use SplitIO\Grammar\Split; use SplitIO\Component\Common\Context; From cd81457d6a51860f860ab34965e752fa3764ef82 Mon Sep 17 00:00:00 2001 From: Matias Melograno Date: Wed, 18 Jan 2023 16:50:20 -0300 Subject: [PATCH 2/2] fixed factory for tests --- tests/Suite/Component/TrafficTypeTests.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tests/Suite/Component/TrafficTypeTests.php b/tests/Suite/Component/TrafficTypeTests.php index 67aeacd5..701e3e5d 100644 --- a/tests/Suite/Component/TrafficTypeTests.php +++ b/tests/Suite/Component/TrafficTypeTests.php @@ -42,9 +42,8 @@ public function testTrafficTypeWarning() $this->assertEquals($keyTrafficType, 'SPLITIO.trafficType.abc'); - $factory = \SplitIO\Sdk::factory('asdqwe123456', $sdkConfig); - $redisClient = ReflectiveTools::clientFromFactory($factory); - $cachePool = ReflectiveTools::cacheFromFactory($factory); + $redisClient = ReflectiveTools::clientFromFactory($splitFactory); + $cachePool = ReflectiveTools::cacheFromFactory($splitFactory); $redisClient->del($keyTrafficType); $splitCache = new SplitCache($cachePool);