TestRefillPolicy.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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_HELPER_PATH . '/refill/RefillFactory.php');
  9. require_once(BASE_HELPER_PATH . '/queue/iqueue.php');
  10. require_once(BASE_HELPER_PATH . '/queue/monitor.php');
  11. require_once(BASE_HELPER_PATH . '/refill/util.php');
  12. class TestRefillPolicy extends TestCase
  13. {
  14. public static function setUpBeforeClass(): void
  15. {
  16. Base::run_util();
  17. }
  18. private function getRatios()
  19. {
  20. $ins = Cache::getInstance('cacheredis');
  21. $content = $ins->get_org('refill_merchant_profit_ratio');
  22. $counts = json_decode($content,true);
  23. $gross = $counts['gross'];
  24. $detail = $counts['detail'];
  25. return [$gross,$detail];
  26. }
  27. public function testRatioCtl()
  28. {
  29. [$gross,$detail] = $this->getRatios();
  30. $ratio_ctl = new refill\mratio_controlex();
  31. $ratio_ctl->update($gross,$detail);
  32. $mchid = 10202;
  33. $ratio_ctl->ratio_match($mchid, 14, 4, 50, [1, 2]);
  34. }
  35. }