TestCardNo.php 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?php
  2. use PHPUnit\Framework\TestCase;
  3. define('APP_ID', 'test');
  4. define('BASE_ROOT_PATH', str_replace('/test', '', dirname(__FILE__)));
  5. require_once(BASE_ROOT_PATH . '/global.php');
  6. require_once(BASE_CORE_PATH . '/lrlz.php');
  7. require_once(BASE_ROOT_PATH . '/fooder.php');
  8. require_once(BASE_HELPER_PATH . '/mtopcard/mtopcard.php');
  9. require_once(BASE_ROOT_PATH . '/core/framework/function/http.php');
  10. class TestCardNo extends TestCase
  11. {
  12. public static function setUpBeforeClass(): void
  13. {
  14. Base::run_util();
  15. }
  16. public function testValidPhone()
  17. {
  18. $phones = ['18163987390','18918378542','18175821272','17717221667','15338020320','18017765111','13370247789',
  19. '13612062983','18108470122','18916108861','17315355854','19945713207','15338020320','17397951988','18151151490',
  20. '17369275856','18101666589','18113244616','18975487566','15376430402','13386059635','15317570849','17737167078',
  21. '18975358619','18104192319','18991174100','18006917657','19979990008','17800202658','18909241633','18913750625'];
  22. $count = count($phones);
  23. $phones = array_unique($phones);
  24. $count = count($phones);
  25. foreach ($phones as $phone) {
  26. [$validate,$card_type,$region_no] = mtopcard\valid_phone($phone);
  27. Log::record("validate={$validate} card_type={$card_type} region_no={$region_no}",Log::DEBUG);
  28. }
  29. }
  30. public function testTianYanValidPhone()
  31. {
  32. $phone = 18500608333;
  33. mtopcard\tian_yan_valid_phone($phone);
  34. }
  35. }