Skip to content

Commit

Permalink
Update zh-CN cell phone formats (#934)
Browse files Browse the repository at this point in the history
  • Loading branch information
liluo authored and stympy committed Jul 10, 2017
1 parent b5b1aca commit f7133f4
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 1 deletion.
23 changes: 22 additions & 1 deletion lib/locales/zh-CN.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,25 @@ zh-CN:
phone_number:
formats: ['###-########', '####-########', '###########']
cell_phone:
formats: ['1##########']
formats:
- '13#########'
- '145########'
- '147########'
- '150########'
- '151########'
- '152########'
- '153########'
- '155########'
- '156########'
- '157########'
- '158########'
- '159########'
- '170########'
- '171########'
- '172########'
- '173########'
- '175########'
- '176########'
- '177########'
- '178########'
- '18#########'
17 changes: 17 additions & 0 deletions test/test_zh_cn_locale.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
require File.expand_path(File.dirname(__FILE__) + '/test_helper.rb')

class TestZhCnLocale < Test::Unit::TestCase
def setup
Faker::Config.locale = 'zh-CN'
end

def teardown
Faker::Config.locale = nil
end

def test_validity_of_phone_method_output
cn_cell_phone_validation_regex = /^1(3[0-9]|4[57]|5[0-35-9]|7[0-35-8]|8[0-9])\d{8}$/
assert_match(cn_cell_phone_validation_regex, Faker::PhoneNumber.cell_phone)
end

end

0 comments on commit f7133f4

Please sign in to comment.