account_helperTest.php 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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 bar
  13. {
  14. public function __construct()
  15. {
  16. echo __FUNCTION__ . " \n";
  17. }
  18. public function __destruct()
  19. {
  20. echo __FUNCTION__ . " \n";
  21. }
  22. }
  23. class account_helperTest extends PHPUnit_Framework_TestCase
  24. {
  25. public static function setUpBeforeClass()
  26. {
  27. Base::run_util();
  28. }
  29. public function testPayRefund()
  30. {
  31. //account_helper::pay_refund(36490,500,'退款红包');
  32. }
  33. public function testModelCond()
  34. {
  35. $cur_time = time();
  36. $cond['usable_time'] = array(array('gt',$cur_time), array('elt',$cur_time + 200),'and');
  37. $cond['notify_time'] = array(array('eq',0), array('elt',$cur_time + 300),'or');
  38. $mod_bonus = Model('user_bonus');
  39. $X= $mod_bonus->field('bonus_id,usable_time as usabletm')->where($cond)->select();
  40. }
  41. public function testCondition()
  42. {
  43. $mod_type = Model('bonus_type');
  44. // $condition = array('sender_id' => 36490, 'relayer_id' => 36490, '_op' => 'or');
  45. // $condition = array($condition,array('make_type' => 0),'_op' => 'and');
  46. //$condition = "(sender_id=36490 or relayer_id => 36490) and (make_type = 0)";
  47. $member_id = 36490;
  48. $cond = array();
  49. $cond['sender_id|repayer_id'] = array('_multi'=>true,$member_id,36491);
  50. $cond['make_type'] = 0;
  51. $mod_type->where($cond)->select();
  52. }
  53. private function xxx()
  54. {
  55. $bar = new bar();
  56. }
  57. public function testDestruct()
  58. {
  59. echo __FUNCTION__ . " begin \n";
  60. $this->xxx();
  61. $bar = new bar();
  62. echo __FUNCTION__ . " end \n";
  63. }
  64. public static function tearDownAfterClass()
  65. {
  66. }
  67. }