|
@@ -1,4 +1,6 @@
|
|
|
-<?php
|
|
|
+<?php declare(strict_types=1);
|
|
|
+
|
|
|
+use PHPUnit\Framework\TestCase;
|
|
|
|
|
|
/**
|
|
|
* Created by PhpStorm.
|
|
@@ -9,21 +11,49 @@
|
|
|
|
|
|
define('BASE_ROOT_PATH',str_replace('/test','',dirname(__FILE__)));
|
|
|
|
|
|
+require_once(BASE_ROOT_PATH . '/global.php');
|
|
|
+require_once(BASE_CORE_PATH . '/lrlz.php');
|
|
|
require_once(BASE_ROOT_PATH . '/fooder.php');
|
|
|
|
|
|
|
|
|
-class testQueue extends PHPUnit_Framework_TestCase
|
|
|
+class testQueue extends TestCase
|
|
|
{
|
|
|
- public static function setUpBeforeClass()
|
|
|
+ public static function setUpBeforeClass() :void
|
|
|
{
|
|
|
Base::run_util();
|
|
|
}
|
|
|
|
|
|
+ public function testQueueSrv()
|
|
|
+ {
|
|
|
+ if (ob_get_level()) ob_end_clean();
|
|
|
+ $model_queue = Model('queue',BASE_PATH);
|
|
|
+
|
|
|
+ $worker = new QueueServer();
|
|
|
+ while (true)
|
|
|
+ {
|
|
|
+ $list_key = $worker->scan();
|
|
|
+ if (!empty($list_key) && is_array($list_key))
|
|
|
+ {
|
|
|
+ foreach ($list_key as $key) {
|
|
|
+ $content = $worker->pop($list_key, 0);
|
|
|
+ if (empty($content)) continue;
|
|
|
+ $method = key($content);
|
|
|
+ $arg = current($content);
|
|
|
+// $model_queue->$method($arg);
|
|
|
+ echo date('Y-m-d H:i:s',time()).' '.$method."\n";
|
|
|
+ flush();
|
|
|
+ ob_flush();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ sleep(1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
public function testPush()
|
|
|
{
|
|
|
//{"action":"sendreq","params":null}
|
|
|
$x['action'] = 'sendreq';
|
|
|
- $x['params'] = array('speed' => 30);
|
|
|
+ $x['params'] = ['speed' => 30];
|
|
|
|
|
|
$y = json_encode($x);
|
|
|
|
|
@@ -43,7 +73,7 @@ class testQueue extends PHPUnit_Framework_TestCase
|
|
|
|
|
|
}
|
|
|
|
|
|
- public static function tearDownAfterClass()
|
|
|
+ public static function tearDownAfterClass():void
|
|
|
{
|
|
|
}
|
|
|
}
|