stanley-king 3 лет назад
Родитель
Сommit
2747eaae45
2 измененных файлов с 10 добавлено и 2 удалено
  1. 2 2
      helper/refill/util.php
  2. 8 0
      test/TestRedis.php

+ 2 - 2
helper/refill/util.php

@@ -213,8 +213,8 @@ class util
     public static function push_add($params)
     {
         try {
-            queue\DispatcherClient::instance()->push('add', $params);
-            return true;
+            $ret = queue\DispatcherClient::instance()->push('add', $params);
+            return $ret !== false;
         } catch (Exception $ex) {
             return false;
         }

+ 8 - 0
test/TestRedis.php

@@ -13,6 +13,8 @@ require_once(BASE_HELPER_PATH . '/refill/RefillFactory.php');
 require_once(BASE_HELPER_PATH . '/refill/policy/rlock.php');
 require_once(BASE_HELPER_PATH . '/refill/policy/rstorage.php');
 
+use refill;
+
 
 function sub_callback($redis, $chan, $msg)
 {
@@ -293,6 +295,12 @@ class TestRedis extends TestCase
 
     }
 
+    public function testPushQueue()
+    {
+        $ret = refill\util::push_add(['xxxx']);
+
+    }
+
     ////docker-compose run phpcli php /var/www/html/phpunit-9.2.5.phar --filter "/(TestRedis::testCancel)( .*)?$/" --test-suffix TestRedis.php /var/www/html/test
     ////docker-compose run phpcli php /var/www/html/phpunit-9.2.5.phar --filter "/(TestRedis::testCancelPayed)( .*)?$/" --test-suffix TestRedis.php /var/www/html/test
     public static function tearDownAfterClass() : void