phonie 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/Gemfile +5 -0
- data/Gemfile.lock +10 -0
- data/LICENSE +20 -0
- data/Rakefile +13 -0
- data/Readme.rdoc +153 -0
- data/lib/phonie.rb +7 -0
- data/lib/phonie/country.rb +120 -0
- data/lib/phonie/data/phone_countries.yml +1683 -0
- data/lib/phonie/phone.rb +215 -0
- data/lib/phonie/support.rb +78 -0
- data/lib/phonie/version.rb +3 -0
- data/phonie.gemspec +18 -0
- data/test/countries/ae_test.rb +15 -0
- data/test/countries/af_test.rb +12 -0
- data/test/countries/al_test.rb +12 -0
- data/test/countries/ar_test.rb +12 -0
- data/test/countries/at_test.rb +14 -0
- data/test/countries/au_test.rb +48 -0
- data/test/countries/ba_test.rb +9 -0
- data/test/countries/bd_test.rb +17 -0
- data/test/countries/be_test.rb +120 -0
- data/test/countries/bg_test.rb +13 -0
- data/test/countries/bo_test.rb +12 -0
- data/test/countries/br_test.rb +12 -0
- data/test/countries/bt_test.rb +9 -0
- data/test/countries/by_test.rb +12 -0
- data/test/countries/bz_test.rb +12 -0
- data/test/countries/ca_test.rb +20 -0
- data/test/countries/cr_test.rb +12 -0
- data/test/countries/cy_test.rb +12 -0
- data/test/countries/cz_test.rb +12 -0
- data/test/countries/de_test.rb +18 -0
- data/test/countries/dk_test.rb +12 -0
- data/test/countries/dz_test.rb +12 -0
- data/test/countries/ec_test.rb +12 -0
- data/test/countries/ee_test.rb +12 -0
- data/test/countries/eg_test.rb +9 -0
- data/test/countries/et_test.rb +11 -0
- data/test/countries/fi_test.rb +12 -0
- data/test/countries/fr_test.rb +22 -0
- data/test/countries/gb_test.rb +262 -0
- data/test/countries/ge_test.rb +12 -0
- data/test/countries/gh_test.rb +9 -0
- data/test/countries/gr_test.rb +9 -0
- data/test/countries/gt_test.rb +12 -0
- data/test/countries/gu_test.rb +9 -0
- data/test/countries/gy_test.rb +9 -0
- data/test/countries/hr_test.rb +75 -0
- data/test/countries/hu_test.rb +12 -0
- data/test/countries/il_test.rb +12 -0
- data/test/countries/in_test.rb +45 -0
- data/test/countries/ir_test.rb +13 -0
- data/test/countries/ke_test.rb +12 -0
- data/test/countries/lk_test.rb +9 -0
- data/test/countries/ng_test.rb +9 -0
- data/test/countries/nl_test.rb +383 -0
- data/test/countries/no_test.rb +12 -0
- data/test/countries/np_test.rb +15 -0
- data/test/countries/ph_test.rb +9 -0
- data/test/countries/pk_test.rb +9 -0
- data/test/countries/pt_test.rb +129 -0
- data/test/countries/qa_test.rb +9 -0
- data/test/countries/rs_test.rb +15 -0
- data/test/countries/sa_test.rb +9 -0
- data/test/countries/se_test.rb +478 -0
- data/test/countries/si_test.rb +19 -0
- data/test/countries/sv_test.rb +12 -0
- data/test/countries/to_test.rb +12 -0
- data/test/countries/ua_test.rb +17 -0
- data/test/countries/us_test.rb +24 -0
- data/test/countries/uy_test.rb +20 -0
- data/test/countries/za_test.rb +19 -0
- data/test/countries/zw_test.rb +12 -0
- data/test/country_test.rb +27 -0
- data/test/extension_test.rb +30 -0
- data/test/phone_test.rb +137 -0
- data/test/test_helper.rb +37 -0
- data/test_usa_phones_with_extensions.csv +99 -0
- metadata +130 -0
@@ -0,0 +1,17 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../test_helper')
|
2
|
+
|
3
|
+
## Bangladesh
|
4
|
+
class BDTest < Phonie::TestCase
|
5
|
+
def test_local
|
6
|
+
parse_test('+8801715379982', '880', '171', '5379982', 'Bangladesh', true)
|
7
|
+
parse_test('+8801191573647', '880', '119', '1573647', 'Bangladesh', true)
|
8
|
+
parse_test('+88021915736', '880', '2', '1915736', 'Bangladesh', false)
|
9
|
+
end
|
10
|
+
|
11
|
+
def test_with_default_country
|
12
|
+
Phonie::Phone.default_country_code = '880'
|
13
|
+
parse_test('1715379982', '880', '171', '5379982', 'Bangladesh', true)
|
14
|
+
parse_test('1191573647', '880', '119', '1573647', 'Bangladesh', true)
|
15
|
+
parse_test('21915736', '880', '2', '1915736', 'Bangladesh', false)
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,120 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../test_helper')
|
2
|
+
|
3
|
+
## Belgium
|
4
|
+
class BETest < Phonie::TestCase
|
5
|
+
|
6
|
+
def test_mobile
|
7
|
+
parse_test('+32 4 12345678', '32', '4', '12345678', 'Belgium', true)
|
8
|
+
end
|
9
|
+
|
10
|
+
## single digit
|
11
|
+
# 02: Brussels (Bruxelles/Brussel)
|
12
|
+
def test_brussels
|
13
|
+
parse_test('+32 2 1234567', '32', '2', '1234567', 'Belgium', false)
|
14
|
+
end
|
15
|
+
# 03: Antwerpen (Antwerp), Sint-Niklaas
|
16
|
+
def test_antwerpen
|
17
|
+
parse_test('+32 3 1234567', '32', '3', '1234567')
|
18
|
+
end
|
19
|
+
# 04: Liège (Luik), Voeren (Fourons)
|
20
|
+
def test_liege
|
21
|
+
parse_test('+32 4 1234567', '32', '4', '1234567', 'Belgium', false)
|
22
|
+
end
|
23
|
+
# 09: Gent (Ghent/Gand)
|
24
|
+
def test_gent
|
25
|
+
parse_test('+32 9 1234567', '32', '9', '1234567')
|
26
|
+
end
|
27
|
+
|
28
|
+
## two digit
|
29
|
+
# 010: Wavre (Waver)
|
30
|
+
def test_wavre
|
31
|
+
parse_test('+32 10 123456', '32', '10', '123456')
|
32
|
+
end
|
33
|
+
# 011: Hasselt
|
34
|
+
def test_hasselt
|
35
|
+
parse_test('+32 11 123456', '32', '11', '123456')
|
36
|
+
end
|
37
|
+
# 012: Tongeren (Tongres)
|
38
|
+
def test_tongeren
|
39
|
+
parse_test('+32 12 123456', '32', '12', '123456')
|
40
|
+
end
|
41
|
+
# 013: Diest
|
42
|
+
def test_diest
|
43
|
+
parse_test('+32 13 123456', '32', '13', '123456')
|
44
|
+
end
|
45
|
+
# 014: Herentals, Turnhout
|
46
|
+
# 015: Mechelen (Malines)
|
47
|
+
# 016: Leuven (Louvain), Tienen (Tirlemont)
|
48
|
+
# 019: Waremme (Borgworm)
|
49
|
+
def test_waremme
|
50
|
+
parse_test('+32 19 123456', '32', '19', '123456')
|
51
|
+
end
|
52
|
+
|
53
|
+
# 050: Brugge (Bruges), Zeebrugge
|
54
|
+
def test_brugge
|
55
|
+
parse_test('+32 50 123456', '32', '50', '123456')
|
56
|
+
end
|
57
|
+
# 051: Roeselare (Roulers)
|
58
|
+
def test_roeselare
|
59
|
+
parse_test('+32 51 123456', '32', '51', '123456')
|
60
|
+
end
|
61
|
+
# 052: Dendermonde (Termonde)
|
62
|
+
# 053: Aalst (Alost)
|
63
|
+
# 054: Ninove
|
64
|
+
# 055: Ronse (Renaix)
|
65
|
+
# 056: Kortrijk (Courtrai), Comines-Warneton, Mouscron (Moeskroen)
|
66
|
+
# 057: Ieper (Ypres)
|
67
|
+
# 058: Veurne (Furnes)
|
68
|
+
# 059: Oostende (Ostend)
|
69
|
+
def test_oostende
|
70
|
+
parse_test('+32 59 123456', '32', '59', '123456')
|
71
|
+
end
|
72
|
+
|
73
|
+
# 060: Chimay
|
74
|
+
def test_chimay
|
75
|
+
parse_test('+32 60 123456', '32', '60', '123456')
|
76
|
+
end
|
77
|
+
# 061: Bastogne, Libramont-Chevigny
|
78
|
+
# 063: Arlon (Aarlen)
|
79
|
+
# 064: La Louviere
|
80
|
+
# 065: Mons (Bergen)
|
81
|
+
# 067: Nivelles (Nijvel)
|
82
|
+
def test_nivelles
|
83
|
+
parse_test('+32 67 123456', '32', '67', '123456')
|
84
|
+
end
|
85
|
+
# 068: Ath (Aat)
|
86
|
+
# 069: Tournai (Doornik)
|
87
|
+
|
88
|
+
# 070: Specialty Numbers (i.e. bus information or bank information)
|
89
|
+
def test_specialty
|
90
|
+
parse_test('+32 70 123456', '32', '70', '123456')
|
91
|
+
end
|
92
|
+
# 071: Charleroi
|
93
|
+
|
94
|
+
# 081: Namur (Namen)
|
95
|
+
def test_namur
|
96
|
+
parse_test('+32 81 123456', '32', '81', '123456')
|
97
|
+
end
|
98
|
+
# 082: Dinant
|
99
|
+
# 083: Ciney
|
100
|
+
# 084: Jemelle, Marche-en-Famenne
|
101
|
+
# 085: Huy
|
102
|
+
# 086: Durbuy
|
103
|
+
# 087: Verviers
|
104
|
+
# 089: Genk
|
105
|
+
|
106
|
+
# 0800: toll free service
|
107
|
+
def test_toll_free
|
108
|
+
parse_test('+32 800 12345', '32', '800', '12345')
|
109
|
+
end
|
110
|
+
|
111
|
+
# 090x: Premium numbers (0900, 0901, 0902, 0903, 0904, 0905, 0906, 0907, 0908, 0909)
|
112
|
+
def test_premium_900
|
113
|
+
parse_test('+32 900 12345', '32', '900', '12345')
|
114
|
+
end
|
115
|
+
|
116
|
+
def test_premium_901
|
117
|
+
parse_test('+32 901 12345', '32', '901', '12345')
|
118
|
+
end
|
119
|
+
|
120
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../test_helper')
|
2
|
+
|
3
|
+
## Bulgaria
|
4
|
+
class BGTest < Phonie::TestCase
|
5
|
+
def test_local
|
6
|
+
parse_test('+35921234567', '359', "2", '1234567', 'Bulgaria', false)
|
7
|
+
end
|
8
|
+
|
9
|
+
def test_mobile
|
10
|
+
parse_test('359871234567', '359', '87', '1234567', 'Bulgaria', true)
|
11
|
+
parse_test('35943123456', '359', '43', '123456', 'Bulgaria', true)
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../test_helper')
|
2
|
+
|
3
|
+
## Bolivia
|
4
|
+
class BOTest < Phonie::TestCase
|
5
|
+
def test_local
|
6
|
+
parse_test('+59131234567', '591', "3", '1234567', 'Bolivia', false)
|
7
|
+
end
|
8
|
+
|
9
|
+
def test_mobile
|
10
|
+
parse_test('+59171234567', '591', '7', '1234567', 'Bolivia', true)
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../test_helper')
|
2
|
+
|
3
|
+
## Brazil
|
4
|
+
class BRTest < Phonie::TestCase
|
5
|
+
def test_local
|
6
|
+
parse_test('+559112345678', '55', "91", '12345678', 'Brazil', false)
|
7
|
+
end
|
8
|
+
|
9
|
+
def test_mobile
|
10
|
+
parse_test('551161234567', '55', '11', '61234567', 'Brazil', true)
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,9 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../test_helper')
|
2
|
+
|
3
|
+
## Bhutan
|
4
|
+
class BTTest < Phonie::TestCase
|
5
|
+
def test_local
|
6
|
+
parse_test('9757220768', '975', '7', '220768', "Bhutan", false)
|
7
|
+
parse_test('+97517610328', '975', '17', '610328', "Bhutan", true)
|
8
|
+
end
|
9
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../test_helper')
|
2
|
+
|
3
|
+
## Belarus
|
4
|
+
class BYTest < Phonie::TestCase
|
5
|
+
def test_local
|
6
|
+
parse_test('+375225123456', '375', '225', '123456', 'Belarus', false)
|
7
|
+
end
|
8
|
+
|
9
|
+
def test_mobile
|
10
|
+
parse_test('+375291234567', '375', '29', '1234567', 'Belarus', true)
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../test_helper')
|
2
|
+
|
3
|
+
## Belize
|
4
|
+
class BZTest < Phonie::TestCase
|
5
|
+
def test_local
|
6
|
+
parse_test('+5012123456', '501', "2", '123456', 'Belize', false)
|
7
|
+
end
|
8
|
+
|
9
|
+
def test_mobile
|
10
|
+
parse_test('5016123456', '501', '6', '123456', 'Belize', true)
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../test_helper')
|
2
|
+
|
3
|
+
## Canada
|
4
|
+
class CATest < Phonie::TestCase
|
5
|
+
|
6
|
+
def test_local
|
7
|
+
parse_test('+1 416 856 3348', '1', '416', '8563348', 'Canada')
|
8
|
+
end
|
9
|
+
|
10
|
+
def test_long_with_default_country_code
|
11
|
+
Phonie::Phone.default_country_code = '1'
|
12
|
+
parse_test('9059735100', '1', '905', '9735100', 'Canada')
|
13
|
+
end
|
14
|
+
|
15
|
+
def test_short_with_default_country_code_and_area_code
|
16
|
+
Phonie::Phone.default_country_code = '1'
|
17
|
+
Phonie::Phone.default_area_code = '416'
|
18
|
+
parse_test('9735100', '1', '416', '9735100', 'Canada')
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../test_helper')
|
2
|
+
|
3
|
+
## Costa Rica
|
4
|
+
class CRTest < Phonie::TestCase
|
5
|
+
def test_local
|
6
|
+
parse_test('+50621234567', '506', '2', '1234567', 'Costa Rica', false)
|
7
|
+
end
|
8
|
+
|
9
|
+
def test_mobile
|
10
|
+
parse_test('50681234567', '506', '8', '1234567', 'Costa Rica', true)
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../test_helper')
|
2
|
+
|
3
|
+
## Cyprus
|
4
|
+
class CYTest < Phonie::TestCase
|
5
|
+
def test_local
|
6
|
+
parse_test('+35723123456', '357', '23', '123456', 'Cyprus', false)
|
7
|
+
end
|
8
|
+
|
9
|
+
def test_mobile
|
10
|
+
parse_test('+35799123456', '357', '99', '123456', 'Cyprus', true)
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../test_helper')
|
2
|
+
|
3
|
+
## Czech Republic
|
4
|
+
class CZTest < Phonie::TestCase
|
5
|
+
def test_local
|
6
|
+
parse_test('+420381234567', '420', '38', '1234567', 'Czech Republic', false)
|
7
|
+
end
|
8
|
+
|
9
|
+
def test_mobile
|
10
|
+
parse_test('+420712345678', '420', '7', '12345678', 'Czech Republic', true)
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../test_helper')
|
2
|
+
|
3
|
+
## Germany
|
4
|
+
class DETest < Phonie::TestCase
|
5
|
+
|
6
|
+
def test_local
|
7
|
+
parse_test('+49 714 1605832', '49', '714', '1605832', "Germany", false)
|
8
|
+
end
|
9
|
+
|
10
|
+
def test_mobile
|
11
|
+
parse_test('+49 162 3499558', '49', '162', '3499558', "Germany", true)
|
12
|
+
end
|
13
|
+
|
14
|
+
def test_country_side
|
15
|
+
parse_test('+49 (0)6120 59511-23', '49', '6120', '5951123', "Germany", false)
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../test_helper')
|
2
|
+
|
3
|
+
## Denmark
|
4
|
+
class DKTest < Phonie::TestCase
|
5
|
+
def test_local
|
6
|
+
parse_test('+4512345678', '45', "12", '345678', 'Denmark', false)
|
7
|
+
end
|
8
|
+
|
9
|
+
def test_mobile
|
10
|
+
parse_test('+4540123456', '45', '40', '123456', 'Denmark', true)
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../test_helper')
|
2
|
+
|
3
|
+
## Algeria
|
4
|
+
class DZTest < Phonie::TestCase
|
5
|
+
def test_local
|
6
|
+
parse_test('+21329123456', '213', "29", '123456', 'Algeria', false)
|
7
|
+
end
|
8
|
+
|
9
|
+
def test_mobile
|
10
|
+
parse_test('+213551234567', '213', '55', '1234567', 'Algeria', true)
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../test_helper')
|
2
|
+
|
3
|
+
## Ecuador
|
4
|
+
class ECTest < Phonie::TestCase
|
5
|
+
def test_local
|
6
|
+
parse_test('+59321234567', '593', '2', '1234567', 'Ecuador', false)
|
7
|
+
end
|
8
|
+
|
9
|
+
def test_mobile
|
10
|
+
parse_test('+59391234567', '593', '9', '1234567', 'Ecuador', true)
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../test_helper')
|
2
|
+
|
3
|
+
## Estonia
|
4
|
+
class EETest < Phonie::TestCase
|
5
|
+
def test_local
|
6
|
+
parse_test('+3722123456', '372', '2', '123456', 'Estonia', false)
|
7
|
+
end
|
8
|
+
|
9
|
+
def test_mobile
|
10
|
+
parse_test('+37251234567', '372', '5', '1234567', 'Estonia', true)
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,9 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../test_helper')
|
2
|
+
|
3
|
+
## Egypt
|
4
|
+
class EGTest < Phonie::TestCase
|
5
|
+
def test_local
|
6
|
+
parse_test('20931234567', '20', '93', '1234567', 'Egypt', false)
|
7
|
+
parse_test('201016244087', '20', '1', '016244087', 'Egypt', true)
|
8
|
+
end
|
9
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../test_helper')
|
2
|
+
|
3
|
+
class ETTest < Phonie::TestCase
|
4
|
+
def test_local
|
5
|
+
parse_test('251111234567', '251', '11', '1234567', 'Ethiopia', false)
|
6
|
+
end
|
7
|
+
|
8
|
+
def test_mobile
|
9
|
+
parse_test('+251911234567', '251', '91', '1234567', 'Ethiopia', true)
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../test_helper')
|
2
|
+
|
3
|
+
## Finland
|
4
|
+
class FITest < Phonie::TestCase
|
5
|
+
def test_local
|
6
|
+
parse_test('+358181234567', '358', '18', '1234567', 'Finland', false)
|
7
|
+
end
|
8
|
+
|
9
|
+
def test_mobile
|
10
|
+
parse_test('+358471234567', '358', '4', '71234567', 'Finland', true)
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../test_helper')
|
2
|
+
|
3
|
+
## France
|
4
|
+
class FRTest < Phonie::TestCase
|
5
|
+
|
6
|
+
def test_local
|
7
|
+
parse_test('+33 4 75 06 07 07', '33', '4', '75060707', "France", false)
|
8
|
+
end
|
9
|
+
|
10
|
+
def test_mobile
|
11
|
+
parse_test('+33 6 11 22 33 44', '33', '6', '11223344', "France", true)
|
12
|
+
end
|
13
|
+
|
14
|
+
def test_mobile_07
|
15
|
+
parse_test('+33 7 11 22 33 44', '33', '7', '11223344', "France", true)
|
16
|
+
end
|
17
|
+
|
18
|
+
def test_voip
|
19
|
+
parse_test('+33 9 11 22 33 44', '33', '9', '11223344', "France", false)
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
@@ -0,0 +1,262 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../test_helper')
|
2
|
+
|
3
|
+
# http://stakeholders.ofcom.org.uk/telecoms/numbering/guidance-tele-no/numbers-for-drama
|
4
|
+
#
|
5
|
+
# Geographic Area Geographic Area Code Telephone Number Range
|
6
|
+
# (1000 numbers in each range)
|
7
|
+
# Leeds 0113 496 0000 to 496 0999
|
8
|
+
# Sheffield 0114 496 0000 to 496 0999
|
9
|
+
# Nottingham 0115 496 0000 to 496 0999
|
10
|
+
# Leicester 0116 496 0000 to 496 0999
|
11
|
+
# Bristol 0117 496 0000 to 496 0999
|
12
|
+
# Reading 0118 496 0000 to 496 0999
|
13
|
+
# Birmingham 0121 496 0000 to 496 0999
|
14
|
+
# Edinburgh 0131 496 0000 to 496 0999
|
15
|
+
# Glasgow 0141 496 0000 to 496 0999
|
16
|
+
# Liverpool 0151 496 0000 to 496 0999
|
17
|
+
# Manchester 0161 496 0000 to 496 0999
|
18
|
+
# London 020 7946 0000 to 7946 0999
|
19
|
+
# Tyneside/Durham
|
20
|
+
#/Sunderland 0191 498 0000 to 498 0999
|
21
|
+
# Northern Ireland 028 9018 0000 to 9018 0999
|
22
|
+
# Cardiff 029 2018 0000 to 2018 0999
|
23
|
+
# No area 01632 960000 to 960999
|
24
|
+
#
|
25
|
+
# Other Telephone Numbers
|
26
|
+
#
|
27
|
+
# Telephone Number Type Telephone Number Range
|
28
|
+
# (1000 numbers in each range)
|
29
|
+
# Mobile 07700 900000 to 900999
|
30
|
+
# Freephone 08081 570000 to 570999
|
31
|
+
# Premium Rate Services 0909 8790000 to 8790999
|
32
|
+
# UK Wide 03069 990000 to 990999
|
33
|
+
|
34
|
+
class GBTest < Phonie::TestCase
|
35
|
+
|
36
|
+
## SHORT CODES
|
37
|
+
# London 020 7946 0000 to 7946 0999
|
38
|
+
def test_london
|
39
|
+
parse_test('+44 20 7946 0123', '44', '20', '79460123')
|
40
|
+
end
|
41
|
+
|
42
|
+
# Northern Ireland 028 9018 0000 to 9018 0999
|
43
|
+
def test_northern_ireland
|
44
|
+
parse_test('+44 28 9018 0123', '44', '28', '90180123')
|
45
|
+
end
|
46
|
+
|
47
|
+
# Cardiff 029 2018 0000 to 2018 0999
|
48
|
+
def test_cardiff
|
49
|
+
parse_test('+44 29 2018 0123', '44', '29', '20180123')
|
50
|
+
end
|
51
|
+
|
52
|
+
# Leeds 0113 496 0000 to 496 0999
|
53
|
+
def test_leeds
|
54
|
+
parse_test('+44 113 496 0123', '44', '113', '4960123')
|
55
|
+
end
|
56
|
+
|
57
|
+
# Sheffield 0114 496 0000 to 496 0999
|
58
|
+
def test_sheffield
|
59
|
+
parse_test('+44 114 496 0123', '44', '114', '4960123')
|
60
|
+
end
|
61
|
+
|
62
|
+
# Nottingham 0115 496 0000 to 496 0999
|
63
|
+
def test_nottingham
|
64
|
+
parse_test('+44 115 496 0123', '44', '115', '4960123')
|
65
|
+
end
|
66
|
+
|
67
|
+
# Leicester 0116 496 0000 to 496 0999
|
68
|
+
def test_leicester
|
69
|
+
parse_test('+44 116 496 0123', '44', '116', '4960123')
|
70
|
+
end
|
71
|
+
|
72
|
+
# Bristol 0117 496 0000 to 496 0999
|
73
|
+
def test_bristol
|
74
|
+
parse_test('+44 117 496 0123', '44', '117', '4960123')
|
75
|
+
end
|
76
|
+
|
77
|
+
# Reading 0118 496 0000 to 496 0999
|
78
|
+
def test_reading
|
79
|
+
parse_test('+44 118 496 0123', '44', '118', '4960123')
|
80
|
+
end
|
81
|
+
|
82
|
+
# Birmingham 0121 496 0000 to 496 0999
|
83
|
+
def test_birmingham
|
84
|
+
parse_test('+44 121 496 0123', '44', '121', '4960123')
|
85
|
+
end
|
86
|
+
|
87
|
+
# Edinburgh 0131 496 0000 to 496 0999
|
88
|
+
def test_edinburgh
|
89
|
+
parse_test('+44 131 496 0123', '44', '131', '4960123')
|
90
|
+
end
|
91
|
+
|
92
|
+
# Glasgow 0141 496 0000 to 496 0999
|
93
|
+
def test_glasgow
|
94
|
+
parse_test('+44 141 496 0123', '44', '141', '4960123')
|
95
|
+
end
|
96
|
+
|
97
|
+
# Liverpool 0151 496 0000 to 496 0999
|
98
|
+
def test_liverpool
|
99
|
+
parse_test('+44 151 496 0123', '44', '151', '4960123')
|
100
|
+
end
|
101
|
+
|
102
|
+
# Manchester 0161 496 0000 to 496 0999
|
103
|
+
def test_manchester
|
104
|
+
parse_test('+44 161 496 0123', '44', '161', '4960123')
|
105
|
+
end
|
106
|
+
|
107
|
+
# Tyneside/Durham
|
108
|
+
#/Sunderland 0191 498 0000 to 498 0999
|
109
|
+
def test_tyneside
|
110
|
+
parse_test('+44 191 496 0123', '44', '191', '4960123')
|
111
|
+
end
|
112
|
+
|
113
|
+
## LONG CODES
|
114
|
+
|
115
|
+
# 01202 — Bournemouth (BO)
|
116
|
+
def test_bournemouth
|
117
|
+
parse_test('+44 1202 96 0123', '44', '1202', '960123')
|
118
|
+
end
|
119
|
+
|
120
|
+
# 01326 — Falmouth (FA)
|
121
|
+
def test_falmouth
|
122
|
+
parse_test('+44 1326 96 0123', '44', '1326', '960123')
|
123
|
+
end
|
124
|
+
|
125
|
+
# 01420 — Alton (HA)
|
126
|
+
def test_alton
|
127
|
+
parse_test('+44 1420 96 0123', '44', '1420', '960123')
|
128
|
+
end
|
129
|
+
|
130
|
+
# 01598 — Lynton (LY)
|
131
|
+
def test_lynton
|
132
|
+
parse_test('+44 1598 96 0123', '44', '1598', '960123')
|
133
|
+
end
|
134
|
+
|
135
|
+
# 01637 — Newquay (NE)
|
136
|
+
def test_newquay
|
137
|
+
parse_test('+44 1637 96 0123', '44', '1637', '960123')
|
138
|
+
end
|
139
|
+
|
140
|
+
# 01700 — Rothesay (RO)
|
141
|
+
def test_rothesay
|
142
|
+
parse_test('+44 1700 96 0123', '44', '1700', '960123')
|
143
|
+
end
|
144
|
+
|
145
|
+
# 01951 — Colonsay
|
146
|
+
def test_colonsay
|
147
|
+
parse_test('+44 1951 96 0123', '44', '1951', '960123')
|
148
|
+
end
|
149
|
+
|
150
|
+
# No area 01632 960000 to 960999
|
151
|
+
def test_no_area
|
152
|
+
parse_test('+44 1632 96 0123', '44', '1632', '960123')
|
153
|
+
end
|
154
|
+
|
155
|
+
# Personal numbering 070 xxxx xxxx
|
156
|
+
def test_personal_numbering
|
157
|
+
parse_test('+44 70 00001234', '44', '70', '00001234')
|
158
|
+
end
|
159
|
+
|
160
|
+
# Mobile 07700 900000 to 900999
|
161
|
+
def test_mobile
|
162
|
+
parse_test('+44 7700 900345', '44', '7700', '900345', "United Kingdom", true)
|
163
|
+
end
|
164
|
+
|
165
|
+
def test_mobile_2
|
166
|
+
parse_test('+44 7778 900345', '44', '7778', '900345')
|
167
|
+
end
|
168
|
+
|
169
|
+
# Freephone 08081 570000 to 570999
|
170
|
+
def test_freephone
|
171
|
+
parse_test('+44 808 1570123', '44', '808', '1570123', "United Kingdom", false)
|
172
|
+
end
|
173
|
+
|
174
|
+
# Premium Rate Services 0909 8790000 to 8790999
|
175
|
+
def test_premium_service_1
|
176
|
+
parse_test('+44 909 8790999', '44', '909', '8790999')
|
177
|
+
end
|
178
|
+
|
179
|
+
def test_premium_service_2
|
180
|
+
parse_test('+44 910 8790123', '44', '910', '8790123')
|
181
|
+
end
|
182
|
+
|
183
|
+
# UK Wide 03069 990000 to 990999
|
184
|
+
def test_wide
|
185
|
+
parse_test('+44 306 9990123', '44', '306', '9990123')
|
186
|
+
end
|
187
|
+
|
188
|
+
def test_wide_2
|
189
|
+
parse_test('+44 339 9990123', '44', '339', '9990123')
|
190
|
+
end
|
191
|
+
|
192
|
+
# Tests for additional number ranges not previously mentioned
|
193
|
+
|
194
|
+
def test_four_plus_five_1
|
195
|
+
parse_test('+44 1204 62532', '44', '1204', '62532')
|
196
|
+
end
|
197
|
+
|
198
|
+
def test_four_plus_five_2
|
199
|
+
parse_test('+44 1946 62888', '44', '1946', '62888')
|
200
|
+
end
|
201
|
+
|
202
|
+
def test_five_plus_five_1
|
203
|
+
parse_test('+44 15396 48788', '44', '15396', '48788')
|
204
|
+
end
|
205
|
+
|
206
|
+
def test_five_plus_five_2
|
207
|
+
parse_test('+44 16973 88555', '44', '16973', '88555')
|
208
|
+
end
|
209
|
+
|
210
|
+
def test_five_plus_five_3
|
211
|
+
parse_test('+44 16977 44888', '44', '16977', '44888')
|
212
|
+
end
|
213
|
+
|
214
|
+
def test_five_plus_five_4
|
215
|
+
parse_test('+44 19467 22444', '44', '19467', '22444')
|
216
|
+
end
|
217
|
+
|
218
|
+
def test_five_plus_four_1
|
219
|
+
parse_test('+44 16977 3555', '44', '16977', '3555')
|
220
|
+
end
|
221
|
+
|
222
|
+
def test_four_plus_six_1
|
223
|
+
parse_test('+44 1539 248756', '44', '1539', '248756')
|
224
|
+
end
|
225
|
+
|
226
|
+
def test_four_plus_six_2
|
227
|
+
parse_test('+44 1697 222555', '44', '1697', '222555')
|
228
|
+
end
|
229
|
+
|
230
|
+
def test_four_plus_six_3
|
231
|
+
parse_test('+44 1946 555777', '44', '1946', '555777')
|
232
|
+
end
|
233
|
+
|
234
|
+
def test_three_plus_six_1
|
235
|
+
parse_test('+44 500 777888', '44', '500', '777888')
|
236
|
+
end
|
237
|
+
|
238
|
+
def test_three_plus_six_2
|
239
|
+
parse_test('+44 800 555777', '44', '800', '555777')
|
240
|
+
end
|
241
|
+
|
242
|
+
def test_three_plus_seven_1
|
243
|
+
parse_test('+44 800 3337788', '44', '800', '3337788')
|
244
|
+
end
|
245
|
+
|
246
|
+
def test_voip
|
247
|
+
parse_test('+44 56 4477 5533', '44', '56', '44775533')
|
248
|
+
end
|
249
|
+
|
250
|
+
def test_corporate
|
251
|
+
parse_test('+44 55 7567 1113', '44', '55', '75671113')
|
252
|
+
end
|
253
|
+
|
254
|
+
def test_business_rate
|
255
|
+
parse_test('+44 843 5389123', '44', '843', '5389123')
|
256
|
+
end
|
257
|
+
|
258
|
+
def test_premium
|
259
|
+
parse_test('+44 873 1570123', '44', '873', '1570123')
|
260
|
+
end
|
261
|
+
|
262
|
+
end
|