account_helperTest.php 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  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. require_once(BASE_ROOT_PATH . '/helper/brand_helper.php');
  14. class account_helperTest extends PHPUnit_Framework_TestCase
  15. {
  16. public static function setUpBeforeClass()
  17. {
  18. Base::run_util();
  19. }
  20. public function testInviteBonus()
  21. {
  22. account_helper::invite_bonus(36490);
  23. }
  24. public function testEvaluate()
  25. {
  26. account_helper::onEvaluate(36490);
  27. }
  28. public function testOnInvite()
  29. {
  30. account_helper::onInvite(36490,36485);
  31. }
  32. public function testGainSystem()
  33. {
  34. account_helper::gain_system(36490,4.5);
  35. }
  36. public function testGainBonus()
  37. {
  38. account_helper::gain_bonus(36490,36485,4.5);
  39. }
  40. public function testLostBonus()
  41. {
  42. account_helper::gain_bonus(36490,36485,4.5);
  43. }
  44. public function testOnRegister()
  45. {
  46. account_helper::onRegister(36490);
  47. }
  48. public function testOnRegisterBonus()
  49. {
  50. $mem_info = Model('member')->getMemberInfoByID(36490);
  51. account_helper::onRegisterBonus($mem_info,bonus_helper::create_type_sn('300516840071209490'),36485);
  52. }
  53. public function testPaysuccess_bonus()
  54. {
  55. account_helper::paysuccess_bonus(36490,500);
  56. }
  57. public function testOrderCancel()
  58. {
  59. account_helper::order_cancel('8000000000001603',36490);
  60. }
  61. public function testOrderSuccess()
  62. {
  63. account_helper::onOrderSuccess(6422);
  64. }
  65. public function testPayRefund()
  66. {
  67. //account_helper::pay_refund(36490,500,'退款红包');
  68. }
  69. public function testPaysuccess()
  70. {
  71. $pay_sn = '910510761110261481';
  72. account_helper::onPaySuccess($pay_sn);
  73. }
  74. public function testOrderSuccessSys()
  75. {
  76. $mod = Model('order');
  77. $pay_sn = '910510761110261481';
  78. $order_info = $mod->getOrderInfo(array('pay_sn' => $pay_sn));
  79. $logic_order = Logic('order');
  80. $result = $logic_order->changeOrderStateReceive($order_info,'system','系统','超期未收货系统自动完成订单');
  81. }
  82. public function testUpfile()
  83. {
  84. $file = '/Users/stanley-king/work/PHPProject/shopnc/data/upload/uploadtmp/20161215081131-53be4be9-fe01-50e7-28c0-ded900c9a0f6.jpg';
  85. $ext = exif_imagetype($file);
  86. $exif = image_type_to_mime_type($ext);
  87. $tagnmae = exif_tagname($ext);
  88. $info = new SplFileInfo($file);
  89. $type = $info->getType();
  90. $type = $info->getExtension();
  91. $size = $info->getSize();
  92. $tmp_name = $info->getFilename();
  93. }
  94. public static function tearDownAfterClass()
  95. {
  96. }
  97. }