|
@@ -1,30 +1,48 @@
|
|
|
-<?php
|
|
|
-
|
|
|
-
|
|
|
-use PHPUnit\Framework\TestCase;
|
|
|
-
|
|
|
-define('APP_ID', 'test');
|
|
|
-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');
|
|
|
-
|
|
|
-require_once(BASE_HELPER_PATH . '/stat_helper.php');
|
|
|
-
|
|
|
-class TestRefillStats extends TestCase
|
|
|
-{
|
|
|
- public static function setUpBeforeClass(): void
|
|
|
- {
|
|
|
- Base::run_util();
|
|
|
- }
|
|
|
-
|
|
|
- public function testLatestDay()
|
|
|
- {
|
|
|
- $refill = new statistics\stat_refill();
|
|
|
- $refill->run();
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-//docker-compose run phpcli php /var/www/html/phpunit-9.2.5.phar --filter "/(TestRefillStats::testLatestDay)( .*)?$/" --test-suffix TestRefillStats.php /var/www/html/test
|
|
|
-
|
|
|
+<?php
|
|
|
+
|
|
|
+
|
|
|
+use PHPUnit\Framework\TestCase;
|
|
|
+
|
|
|
+define('APP_ID', 'test');
|
|
|
+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');
|
|
|
+
|
|
|
+require_once(BASE_HELPER_PATH . '/stat_helper.php');
|
|
|
+
|
|
|
+class TestRefillStats extends TestCase
|
|
|
+{
|
|
|
+ public static function setUpBeforeClass(): void
|
|
|
+ {
|
|
|
+ Base::run_util();
|
|
|
+ }
|
|
|
+
|
|
|
+ public function testLatestDay()
|
|
|
+ {
|
|
|
+ $refill = new statistics\stat_refill();
|
|
|
+ $refill->run();
|
|
|
+ }
|
|
|
+
|
|
|
+ public function testReload()
|
|
|
+ {
|
|
|
+ $refill = new statistics\stat_refill();
|
|
|
+ $task_id = 8;
|
|
|
+ $mod_task = Model('task');
|
|
|
+ $item = $mod_task->where(['task_id' => $task_id])->find();
|
|
|
+ $condition = unserialize($item['params']);
|
|
|
+ $type = $condition['type'];
|
|
|
+ $time_stamp = $condition['time_stamp'];
|
|
|
+ $cid = $condition['cid'];
|
|
|
+ $order_time_type = $condition['order_time_type'];
|
|
|
+ if ($type == 'merchant') {
|
|
|
+ $refill->merchant_stat($time_stamp, $cid, $order_time_type);
|
|
|
+ } elseif ($type == 'provider') {
|
|
|
+ $refill->provider_stat($time_stamp, $cid, $order_time_type);
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+//docker-compose run phpcli php /var/www/html/phpunit-9.2.5.phar --filter "/(TestRefillStats::testLatestDay)( .*)?$/" --test-suffix TestRefillStats.php /var/www/html/test
|
|
|
+
|