-
-
Notifications
You must be signed in to change notification settings - Fork 32
/
Copy pathIdentityCardTest.php
58 lines (46 loc) · 1.15 KB
/
IdentityCardTest.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<?php
use Ofcold\IdentityCard\IdentityCard;
class IdentityCardTest extends PHPUnit\Framework\TestCase
{
protected $idCard;
public function setUp()
{
$this->idCard = IdentityCard::make('142701198003124054');
}
public function testMakeIdentityCardInstance()
{
$this->assertEquals(IdentityCard::class, get_class($this->idCard));
}
public function testMakeFalse()
{
$this->assertEquals(false, !is_a($this->idCard, IdentityCard::class));
}
public function testCheck()
{
$this->assertEquals(true, IdentityCard::validate('142701198003124054'));
}
public function testArea()
{
$this->assertEquals('山西省 运城地区 运城市', $this->idCard->getArea());
}
public function testGender()
{
$this->assertEquals('男', $this->idCard->getGender());
}
public function testBirthday()
{
$this->assertEquals('1980-03-12', $this->idCard->getBirthday());
}
public function testAge()
{
$this->assertEquals('39', $this->idCard->getAge());
}
public function testConstellation()
{
$this->assertEquals('双鱼座', $this->idCard->getConstellation());
}
public function testToJson()
{
$this->assertJson($this->idCard->toJson());
}
}