TestRefillStats.php 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <?php
  2. use PHPUnit\Framework\TestCase;
  3. define('APP_ID', 'test');
  4. define('BASE_ROOT_PATH', str_replace('/test', '', dirname(__FILE__)));
  5. require_once(BASE_ROOT_PATH . '/global.php');
  6. require_once(BASE_CORE_PATH . '/lrlz.php');
  7. require_once(BASE_ROOT_PATH . '/fooder.php');
  8. require_once(BASE_HELPER_PATH . '/stat_helper.php');
  9. use refill\gdsinopec;
  10. class TestRefillStats extends TestCase
  11. {
  12. public static function setUpBeforeClass(): void
  13. {
  14. Base::run_util();
  15. }
  16. public function testLatestDay()
  17. {
  18. $refill = new statistics\stat_refill();
  19. $refill->run();
  20. }
  21. public function testReload()
  22. {
  23. $refill = new statistics\stat_refill();
  24. $task_id = 8;
  25. $mod_task = Model('task');
  26. $item = $mod_task->where(['task_id' => $task_id])->find();
  27. $condition = unserialize($item['params']);
  28. $type = $condition['type'];
  29. $time_stamp = $condition['time_stamp'];
  30. $cid = $condition['cid'];
  31. $order_time_type = $condition['order_time_type'];
  32. if ($type == 'merchant') {
  33. $refill->merchant_stat($time_stamp, $cid, $order_time_type);
  34. } elseif ($type == 'provider') {
  35. $refill->provider_stat($time_stamp, $cid, $order_time_type);
  36. }
  37. }
  38. public function testToken()
  39. {
  40. require_once(BASE_HELPER_RAPI_PATH . "/gdsinopec/config.php");
  41. $token_req = refill\gdsinopec\config::token();
  42. }
  43. }
  44. //docker-compose run phpcli php /var/www/html/phpunit-9.2.5.phar --filter "/(TestRefillStats::testLatestDay)( .*)?$/" --test-suffix TestRefillStats.php /var/www/html/test