Passed
Pull Request — master (#23)
by Peter
06:51 queued 04:09
created

NameTest::isFemale()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 0
1
<?php
2
3
namespace Pixelpeter\Genderize\Test;
4
5
use Pixelpeter\Genderize\Models\Name;
6
7
class NameTest extends \PHPUnit\Framework\TestCase
8
{
9
    /**
10
     * @var \Pixelpeter\Genderize\Models\Name
11
     */
12
    protected $name;
13
14
    /**
15
     * Set up
16
     */
17
    protected function setUp(): void
18
    {
19
        $data = (object) [
20
            'gender' => 'male',
21
            'name' => 'John',
22
            'probability' => 0.98,
23
            'count' => 1234,
24
        ];
25
26
        $this->name = new Name($data);
27
    }
28
29
    /**
30
     * Check data is set correctly
31
     *
32
     * @test
33
     */
34
    public function data_is_set_correctly()
35
    {
36
        $this->assertSame('male', $this->name->gender);
37
        $this->assertSame('John', $this->name->name);
38
        $this->assertSame(0.98, $this->name->probability);
39
        $this->assertSame(1234, $this->name->count);
40
    }
41
42
    /**
43
     * Check default properties are added correctly
44
     *
45
     * @test
46
     */
47
    public function defaults_added_correctly()
48
    {
49
        $data = (object) [];
50
51
        $name = new Name($data);
52
53
        $this->assertNull($name->gender);
54
        $this->assertNull($name->name);
55
        $this->assertNull($name->probability);
56
        $this->assertNull($name->count);
57
    }
58
59
    /**
60
     * Check isMale() is working
61
     *
62
     * @test
63
     */
64
    public function is_male()
65
    {
66
        $this->assertTrue($this->name->isMale());
67
    }
68
69
    /**
70
     *Check isNotMail() is working
71
     *
72
     * @test
73
     */
74
    public function is_not_male()
75
    {
76
        $this->assertFalse($this->name->isNotMale());
77
    }
78
79
    /**
80
     * Check isFemale() is working
81
     *
82
     * @test
83
     */
84
    public function is_female()
85
    {
86
        $this->assertFalse($this->name->isFemale());
87
    }
88
89
    /**
90
     * Check isNotFemail() is working
91
     *
92
     * @test
93
     */
94
    public function is_not_female()
95
    {
96
        $this->assertTrue($this->name->isNotFemale());
97
    }
98
}
99