account_helperTest.php 2.1 KB

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