TestCardNo.php 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <?php
  2. use PHPUnit\Framework\TestCase;
  3. use refill\hongxudagy\config;
  4. define('APP_ID', 'test');
  5. define('BASE_ROOT_PATH', str_replace('/test', '', dirname(__FILE__)));
  6. require_once(BASE_ROOT_PATH . '/global.php');
  7. require_once(BASE_CORE_PATH . '/lrlz.php');
  8. require_once(BASE_ROOT_PATH . '/fooder.php');
  9. require_once(BASE_HELPER_PATH . '/mtopcard/mtopcard.php');
  10. require_once(BASE_ROOT_PATH . '/core/framework/function/http.php');
  11. class TestCardNo extends TestCase
  12. {
  13. public static function setUpBeforeClass(): void
  14. {
  15. Base::run_util();
  16. }
  17. public function testTransfer()
  18. {
  19. $none_supporter = function ($card_no) {
  20. [$validate, $card_type, $regin_no, $isTransfer, $card_state, $black] = mtopcard\valid_phone($card_no);
  21. return $isTransfer;
  22. };
  23. $x = $none_supporter('13911129867');
  24. $x = $none_supporter('13911129866');
  25. }
  26. public function testValidPhone()
  27. {
  28. $phones = ['18163987390','18918378542','18175821272','17717221667','15338020320','18017765111','13370247789',
  29. '13612062983','18108470122','18916108861','17315355854','19945713207','15338020320','17397951988','18151151490',
  30. '17369275856','18101666589','18113244616','18975487566','15376430402','13386059635','15317570849','17737167078',
  31. '18975358619','18104192319','18991174100','18006917657','19979990008','17800202658','18909241633','18913750625'];
  32. $count = count($phones);
  33. $phones = array_unique($phones);
  34. $count = count($phones);
  35. foreach ($phones as $phone) {
  36. [$validate,$card_type,$region_no,$isTransfer] = mtopcard\valid_phone($phone);
  37. Log::record("validate={$validate} card_type={$card_type} region_no={$region_no}",Log::DEBUG);
  38. }
  39. }
  40. public function testTianYanValidPhone()
  41. {
  42. [$validate,$card_type,$region_no,$isTransfer,$status,$black] = mtopcard\valid_phone('15975503200');
  43. [$validate,$card_type,$region_no,$isTransfer,$status,$black] = mtopcard\valid_phone('13911129867');
  44. Log::record("validate={$validate} card_type={$card_type} region_no={$region_no}",Log::DEBUG);
  45. }
  46. public function testRound()
  47. {
  48. $price = round(30 * 0.992, 4);
  49. $params['recharge_amount'] = number_format($price,4,'.','');
  50. }
  51. }