TestRefillPolicy.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. use PHPUnit\Framework\TestCase;
  3. use refill\mratio_controlex;
  4. define('APP_ID', 'refill_stat');
  5. define('BASE_ROOT_PATH', str_replace('/test', '', dirname(__FILE__)));
  6. require_once(BASE_ROOT_PATH . '/global.php');
  7. require_once(BASE_CORE_PATH . '/lrlz.php');
  8. require_once(BASE_ROOT_PATH . '/fooder.php');
  9. require_once(BASE_HELPER_PATH . '/refill/RefillFactory.php');
  10. require_once(BASE_HELPER_PATH . '/queue/iqueue.php');
  11. require_once(BASE_HELPER_PATH . '/queue/monitor.php');
  12. require_once(BASE_HELPER_PATH . '/refill/util.php');
  13. class TestRefillPolicy extends TestCase
  14. {
  15. public static function setUpBeforeClass(): void
  16. {
  17. Base::run_util();
  18. }
  19. private function getRatios()
  20. {
  21. $ins = Cache::getInstance('cacheredis');
  22. $content = $ins->get_org('refill_merchant_profit_ratio');
  23. $counts = json_decode($content,true);
  24. $gross = $counts['gross'];
  25. $detail = $counts['detail'];
  26. return [$gross,$detail];
  27. }
  28. public function testRatioCtl()
  29. {
  30. [$gross,$detail] = $this->getRatios();
  31. $ratio_ctl = new refill\mratio_controlex();
  32. $ratio_ctl->update($gross,$detail);
  33. $mchid = 10202;
  34. $ratio_ctl->ratio_match($mchid, 14, 4, 50, [1, 2]);
  35. }
  36. }