@@ -15,13 +15,15 @@ public function testIsValid()
1515 $ idValidator = new IdValidator ();
1616 $ this ->assertEquals (true , $ idValidator ->isValid ('440308199901101512 ' ));
1717 $ this ->assertEquals (false , $ idValidator ->isValid ('440308199901101513 ' ));
18+ $ this ->assertEquals (true , $ idValidator ->isValid ('610104620927690 ' ));
19+ $ this ->assertEquals (false , $ idValidator ->isValid ('610104620932690 ' ));
1820 }
1921
2022 public function testFakeId ()
2123 {
2224 $ idValidator = new IdValidator ();
2325 $ this ->assertEquals (true , $ idValidator ->isValid ($ idValidator ->fakeId ()));
24- $ this ->assertEquals (true , $ idValidator ->isValid ($ idValidator ->fakeId (true )));
26+ $ this ->assertEquals (true , $ idValidator ->isValid ($ idValidator ->fakeId (false )));
2527 }
2628
2729 public function testGetInfo ()
@@ -33,8 +35,20 @@ public function testGetInfo()
3335 'birthdayCode ' => '1999-01-10 ' ,
3436 'sex ' => 1 ,
3537 'length ' => 18 ,
36- 'checkBit ' => '2 ' , ],
38+ 'checkBit ' => '2 ' ],
3739 $ idValidator ->getInfo ('440308199901101512 ' ));
3840 $ this ->assertEquals (false , $ idValidator ->isValid ('440308199901101513 ' ));
41+
42+ $ idValidator = new IdValidator ();
43+ $ this ->assertEquals ([
44+ 'addressCode ' => '610104 ' ,
45+ 'address ' => '陕西省西安市莲湖区 ' ,
46+ 'birthdayCode ' => '1962-09-27 ' ,
47+ 'sex ' => 0 ,
48+ 'length ' => 15 ,
49+ 'checkBit ' => '' ],
50+ $ idValidator ->getInfo ('610104620927690 ' ));
51+ $ this ->assertEquals (false , $ idValidator ->isValid ('610104620932690 ' ));
52+
3953 }
4054}
0 commit comments