account_helperTest.php 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: stanley-king
  5. * Date: 16/6/27
  6. * Time: 下午10:27
  7. */
  8. define('BASE_ROOT_PATH',str_replace('/test','',dirname(__FILE__)));
  9. require_once(BASE_ROOT_PATH . '/fooder.php');
  10. require_once(BASE_ROOT_PATH . '/helper/bonus_helper.php');
  11. require_once(BASE_ROOT_PATH . '/helper/account_helper.php');
  12. class account_helperTest extends PHPUnit_Framework_TestCase
  13. {
  14. public static function setUpBeforeClass()
  15. {
  16. Base::run_util();
  17. }
  18. public function testPayRefund()
  19. {
  20. account_helper::pay_refund(36490,500,'退款红包');
  21. }
  22. public function testModelCond()
  23. {
  24. $cur_time = time();
  25. $cond['usable_time'] = array(array('gt',$cur_time), array('elt',$cur_time + 200),'and');
  26. $cond['notify_time'] = array(array('eq',0), array('elt',$cur_time + 300),'or');
  27. $mod_bonus = Model('user_bonus');
  28. $mod_bonus->field('bonus_id,usable_time as usabletm')->where($cond)->select();
  29. }
  30. public function testCondition()
  31. {
  32. $mod_type = Model('bonus_type');
  33. // $condition = array('sender_id' => 36490, 'relayer_id' => 36490, '_op' => 'or');
  34. // $condition = array($condition,array('make_type' => 0),'_op' => 'and');
  35. //$condition = "(sender_id=36490 or relayer_id => 36490) and (make_type = 0)";
  36. $member_id = 36490;
  37. $cond = array();
  38. $cond['sender_id|repayer_id'] = array('_multi'=>true,$member_id,36491);
  39. $cond['make_type'] = 0;
  40. $mod_type->where($cond)->select();
  41. //$count = $mod_type->getTypeCount($condition);
  42. //('sender_id' = 36490 or 'relayer_id' = 36490) and ('make_type' = 0)
  43. }
  44. public static function tearDownAfterClass()
  45. {
  46. }
  47. }