TestRefillCommand.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <?php
  2. use PHPUnit\Framework\TestCase;
  3. define('APP_ID', 'refill_stat');
  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_ROOT_PATH . '/helper/stat_helper.php');
  9. require_once(BASE_HELPER_PATH . '/refill/ops/order_clear.php');
  10. require_once(BASE_HELPER_PATH . '/refill/ops/pdlog_clear.php');
  11. class TestRefillCommand extends TestCase
  12. {
  13. public static function setUpBeforeClass(): void
  14. {
  15. Base::run_util();
  16. }
  17. //docker-compose run -d phpcli php /var/www/html/phpunit-9.2.5.phar --filter "/(TestRefillCommand::testRefillStat)( .*)?$/" --test-suffix TestRefillCommand.php /var/www/html/test
  18. public function testRefillStat()
  19. {
  20. $dates = [
  21. '2022-05-31'
  22. ];
  23. $refill = new statistics\stat_refill();
  24. $refill->restat($dates);
  25. }
  26. public function testCurDate()
  27. {
  28. $end_date = strtotime(date('Y-m-d',time()));
  29. $start_date = $end_date - 86400;
  30. $clear = new refill\order_clear();
  31. $clear->clear($start_date,$end_date);
  32. $sDate = date('Y-m-d',$start_date);
  33. $refill = new statistics\stat_refill();
  34. $refill->restat([$sDate]);
  35. $clear = new refill\pdlog_clear();
  36. $clear->clear($start_date,$end_date);
  37. }
  38. }