@@ -9,29 +9,27 @@ class KeepInCacheTest extends TestCase
99{
1010 protected $ sampleParams = ["x " , 1 ];
1111
12- public function testPreparedQueryWithParamsWithoutConfig ()
12+ public function testIsNeedSetKeepQueryInCache ()
1313 {
14- self ::assertEquals (true , YdbQuery::isNeedSetKeepQueryInCache (null , $ this ->sampleParams ));
15- }
16-
17- public function testPreparedQueryWithParamsWithConfig ()
18- {
19- self ::assertEquals (false , YdbQuery::isNeedSetKeepQueryInCache (false , $ this ->sampleParams ));
20- }
21-
22- public function testPreparedQueryWithoutParamsWithoutConfig ()
23- {
24- self ::assertEquals (false , YdbQuery::isNeedSetKeepQueryInCache (null , null ));
25- }
26-
27- public function testPreparedQueryWithoutParamsWithConfig ()
28- {
29- self ::assertEquals (false , YdbQuery::isNeedSetKeepQueryInCache (null , null ));
14+ $ tests = [
15+ ["flag " => null , "params " => null , "result " => false ],
16+ ["flag " => null , "params " => [], "result " => false ],
17+ ["flag " => null , "params " => $ this ->sampleParams , "result " => true ],
18+ ["flag " => false , "params " => null , "result " => false ],
19+ ["flag " => false , "params " => [], "result " => false ],
20+ ["flag " => false , "params " => $ this ->sampleParams , "result " => false ],
21+ ["flag " => true , "params " => null , "result " => true ],
22+ ["flag " => true , "params " => [], "result " => true ],
23+ ["flag " => true , "params " => $ this ->sampleParams , "result " => true ],
24+ ];
25+ foreach ($ tests as $ i => $ test ){
26+ self ::assertEquals ($ test ["result " ], YdbQuery::isNeedSetKeepQueryInCache ($ test ["flag " ], $ test ["params " ]));
27+ }
3028 }
3129}
3230class YdbQuery extends \YdbPlatform \Ydb \YdbQuery{
33- public static function isNeedSetKeepQueryInCache (?bool $ currentParams , ?array $ queryDeclaredParams ): bool
31+ public static function isNeedSetKeepQueryInCache (?bool $ userFlag , ?array $ queryDeclaredParams ): bool
3432 {
35- return parent ::isNeedSetKeepQueryInCache ($ currentParams , $ queryDeclaredParams );
33+ return parent ::isNeedSetKeepQueryInCache ($ userFlag , $ queryDeclaredParams );
3634 }
3735}
0 commit comments