Completed
Pull Request — new-version (#111)
by Tom
02:24
created

GenderTypeTest::testGenderTypeOtherFunction()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 0
dl 0
loc 6
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
namespace JeroenDesloovere\VCard\Property\Parameter;
4
5
use PHPUnit\Framework\TestCase;
6
7
/**
8
 * How to execute all tests: `vendor/bin/phpunit tests`
9
 */
10
final class GenderTypeTest extends TestCase
11
{
12
    public function testGenderTypeEmpty(): void
13
    {
14
        $genderType = new GenderType('');
15
16
        $this->assertTrue($genderType->isEmpty());
17
        $this->assertEquals('', $genderType->__toString());
18
    }
19
20
    public function testGenderTypeMale(): void
21
    {
22
        $genderType = new GenderType('M');
23
24
        $this->assertTrue($genderType->isMale());
25
        $this->assertEquals('M', $genderType->__toString());
26
    }
27
28
    public function testGenderTypeFemale(): void
29
    {
30
        $genderType = new GenderType('F');
31
32
        $this->assertTrue($genderType->isFemale());
33
        $this->assertEquals('F', $genderType->__toString());
34
    }
35
36
    public function testGenderTypeOther(): void
37
    {
38
        $genderType = new GenderType('O');
39
40
        $this->assertTrue($genderType->isOther());
41
        $this->assertEquals('O', $genderType->__toString());
42
    }
43
44
    public function testGenderTypeNone(): void
45
    {
46
        $genderType = new GenderType('N');
47
48
        $this->assertTrue($genderType->isNone());
49
        $this->assertEquals('N', $genderType->__toString());
50
    }
51
52
    public function testGenderTypeUnknown(): void
53
    {
54
        $genderType = new GenderType('U');
55
56
        $this->assertTrue($genderType->isUnknown());
57
        $this->assertEquals('U', $genderType->__toString());
58
    }
59
60
    /**
61
     * @expectedException \JeroenDesloovere\VCard\Exception\PropertyParameterException
62
     * @expectedExceptionMessage The given value 'False Gender' is not allowed. Possible values are: '', 'M', 'F', 'O', 'N', 'U'
63
     */
64
    public function testGenderTypeFalseGender(): void
65
    {
66
        new GenderType('False Gender');
67
    }
68
69
    public function testGenderTypeEmptyFunction(): void
70
    {
71
        $genderType = GenderType::empty();
72
73
        $this->assertTrue($genderType->isEmpty());
74
        $this->assertEquals('', $genderType->__toString());
75
    }
76
77
    public function testGenderTypeMaleFunction(): void
78
    {
79
        $genderType = GenderType::male();
80
81
        $this->assertTrue($genderType->isMale());
82
        $this->assertEquals('M', $genderType->__toString());
83
    }
84
85
    public function testGenderTypeFemaleFunction(): void
86
    {
87
        $genderType = GenderType::female();
88
89
        $this->assertTrue($genderType->isFemale());
90
        $this->assertEquals('F', $genderType->__toString());
91
    }
92
93
    public function testGenderTypeOtherFunction(): void
94
    {
95
        $genderType = GenderType::other();
96
97
        $this->assertTrue($genderType->isOther());
98
        $this->assertEquals('O', $genderType->__toString());
99
    }
100
101
    public function testGenderTypeNoneFunction(): void
102
    {
103
        $genderType = GenderType::none();
104
105
        $this->assertTrue($genderType->isNone());
106
        $this->assertEquals('N', $genderType->__toString());
107
    }
108
109
    public function testGenderTypeUnknownFunction(): void
110
    {
111
        $genderType = GenderType::unknown();
112
113
        $this->assertTrue($genderType->isUnknown());
114
        $this->assertEquals('U', $genderType->__toString());
115
    }
116
}
117