Completed
Pull Request — master (#11)
by Eugene
45:13
created

AzineGenderGuesserTest::testGuess()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 15

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 15
rs 9.7666
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace Azine\HybridAuthBundle\Tests\Services;
4
5
use Azine\HybridAuthBundle\Services\AzineGenderGuesser;
6
use Azine\HybridAuthBundle\Tests\AzineTestCase;
7
8
class AzineGenderGuesserTest extends AzineTestCase
9
{
10
    public function testGuess()
11
    {
12
        $guesser = new AzineGenderGuesser();
13
        $result = $guesser->guess('Patrick');
0 ignored issues
show
Documentation introduced by
'Patrick' is of type string, but the function expects a object<string>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
14
        $this->assertSame('m', $result['gender']);
15
        $result = $guesser->guess('Tom');
0 ignored issues
show
Documentation introduced by
'Tom' is of type string, but the function expects a object<string>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
16
        $this->assertSame('m', $result['gender']);
17
18
        $result = $guesser->guess('Sonja');
0 ignored issues
show
Documentation introduced by
'Sonja' is of type string, but the function expects a object<string>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
19
        $this->assertSame('f', $result['gender']);
20
        $result = $guesser->guess('Petra');
0 ignored issues
show
Documentation introduced by
'Petra' is of type string, but the function expects a object<string>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
21
        $this->assertSame('f', $result['gender']);
22
23
        $this->assertNull($guesser->guess(null));
0 ignored issues
show
Documentation introduced by
null is of type null, but the function expects a object<string>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
24
    }
25
26
    public function testGender()
27
    {
28
        $guesser = new AzineGenderGuesser();
29
        $this->assertSame('m', $guesser->gender('Patrick'));
0 ignored issues
show
Documentation introduced by
'Patrick' is of type string, but the function expects a object<string>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
30
        $this->assertSame('m', $guesser->gender('Tom'));
0 ignored issues
show
Documentation introduced by
'Tom' is of type string, but the function expects a object<string>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
31
        $this->assertSame('f', $guesser->gender('Sonja'));
0 ignored issues
show
Documentation introduced by
'Sonja' is of type string, but the function expects a object<string>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
32
        $this->assertSame('f', $guesser->gender('Petra'));
0 ignored issues
show
Documentation introduced by
'Petra' is of type string, but the function expects a object<string>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
33
        $this->assertSame('', $guesser->gender('ertwerqwrfas'));
0 ignored issues
show
Documentation introduced by
'ertwerqwrfas' is of type string, but the function expects a object<string>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
34
    }
35
36
    public function testGuesserWithOptions()
37
    {
38
        $females = array('lkjlkjlkj' => 1);
39
        $males = array('oiuoiuoui' => 1);
40
        $matchList = array('one_only',
41
                            'either_weight',
42
                            'one_only_metaphone',
43
                            'either_weight_metaphone',
44
                            'v2_rules',
45
                            'v1_rules', );
46
47
        // use with extra names supplied via constructor
48
        $guesser = new AzineGenderGuesser($females, $males, true, $matchList);
49
50
        $result = $guesser->guess('oiuoiuoui');
0 ignored issues
show
Documentation introduced by
'oiuoiuoui' is of type string, but the function expects a object<string>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
51
        $this->assertSame('m', $result['gender']);
52
        $result = $guesser->guess('Patrick');
0 ignored issues
show
Documentation introduced by
'Patrick' is of type string, but the function expects a object<string>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
53
        $this->assertSame('m', $result['gender']);
54
        $result = $guesser->guess('Tom');
0 ignored issues
show
Documentation introduced by
'Tom' is of type string, but the function expects a object<string>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
55
        $this->assertSame('m', $result['gender']);
56
57
        $result = $guesser->guess('lkjlkjlkj');
0 ignored issues
show
Documentation introduced by
'lkjlkjlkj' is of type string, but the function expects a object<string>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
58
        $this->assertSame('f', $result['gender']);
59
        $result = $guesser->guess('Sonja');
0 ignored issues
show
Documentation introduced by
'Sonja' is of type string, but the function expects a object<string>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
60
        $this->assertSame('f', $result['gender']);
61
        $result = $guesser->guess('Petra');
0 ignored issues
show
Documentation introduced by
'Petra' is of type string, but the function expects a object<string>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
62
        $this->assertSame('f', $result['gender']);
63
64
        // use only names supplied via constructor
65
        $guesser = new AzineGenderGuesser($females, $males, false, array('one_only'));
66
67
        $result = $guesser->guess('oiuoiuoui');
0 ignored issues
show
Documentation introduced by
'oiuoiuoui' is of type string, but the function expects a object<string>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
68
        $this->assertSame('m', $result['gender']);
69
70
        $result = $guesser->guess('Patrick');
0 ignored issues
show
Documentation introduced by
'Patrick' is of type string, but the function expects a object<string>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
71
        $this->assertNull($result);
72
        $result = $guesser->guess('Tom');
0 ignored issues
show
Documentation introduced by
'Tom' is of type string, but the function expects a object<string>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
73
        $this->assertNull($result);
74
75
        $result = $guesser->guess('lkjlkjlkj');
0 ignored issues
show
Documentation introduced by
'lkjlkjlkj' is of type string, but the function expects a object<string>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
76
        $this->assertSame('f', $result['gender']);
77
78
        $result = $guesser->guess('Sonja');
0 ignored issues
show
Documentation introduced by
'Sonja' is of type string, but the function expects a object<string>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
79
        $this->assertNull($result);
80
        $result = $guesser->guess('Petra');
0 ignored issues
show
Documentation introduced by
'Petra' is of type string, but the function expects a object<string>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
81
        $this->assertNull($result);
82
    }
83
84
    public function testGuesserWithEitherWeight()
85
    {
86
        $females = array();
87
        $males = array();
88
        $matchList = array('either_weight');
89
90
        // use with extra names supplied via constructor
91
        $guesser = new AzineGenderGuesser($females, $males, false, $matchList);
92
93
        $result = $guesser->guess('Randy');
0 ignored issues
show
Documentation introduced by
'Randy' is of type string, but the function expects a object<string>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
94
        $this->assertSame('m', $result['gender']);
95
    }
96
97
    public function testGuesserWithRules1()
98
    {
99
        $females = array();
100
        $males = array();
101
        $matchList = array('v1_rules');
102
103
        // use with extra names supplied via constructor
104
        $guesser = new AzineGenderGuesser($females, $males, false, $matchList);
105
106
        $result = $guesser->guess('Randy');
0 ignored issues
show
Documentation introduced by
'Randy' is of type string, but the function expects a object<string>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
107
        $this->assertSame('m', $result['gender']);
108
109
        $result = $guesser->guess('Lois');
0 ignored issues
show
Documentation introduced by
'Lois' is of type string, but the function expects a object<string>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
110
        $this->assertSame('f', $result['gender']);
111
    }
112
113
    public function testGuesserWithRules2()
114
    {
115
        $females = array();
116
        $males = array();
117
        $matchList = array('v2_rules');
118
119
        // use with extra names supplied via constructor
120
        $guesser = new AzineGenderGuesser($females, $males, false, $matchList);
121
122
        $result = $guesser->guess('John');
0 ignored issues
show
Documentation introduced by
'John' is of type string, but the function expects a object<string>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
123
        $this->assertSame('m', $result['gender']);
124
        $result = $guesser->guess('Anfernee');
0 ignored issues
show
Documentation introduced by
'Anfernee' is of type string, but the function expects a object<string>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
125
        $this->assertSame('m', $result['gender']);
126
127
        $result = $guesser->guess('Trish');
0 ignored issues
show
Documentation introduced by
'Trish' is of type string, but the function expects a object<string>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
128
        $this->assertSame('f', $result['gender']);
129
        $result = $guesser->guess('Ellie');
0 ignored issues
show
Documentation introduced by
'Ellie' is of type string, but the function expects a object<string>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
130
        $this->assertSame('f', $result['gender']);
131
    }
132
133 View Code Duplication
    public function testGuesserWithMetaPhone()
134
    {
135
        $females = array();
136
        $males = array();
137
        $matchList = array('one_only_metaphone');
138
139
        // use with extra names supplied via constructor
140
        $guesser = new AzineGenderGuesser($females, $males, true, $matchList);
141
142
        $result = $guesser->guess('Patric');
0 ignored issues
show
Documentation introduced by
'Patric' is of type string, but the function expects a object<string>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
143
        $this->assertSame('m', $result['gender']);
144
        $result = $guesser->guess('Tomàs');
0 ignored issues
show
Documentation introduced by
'Tomàs' is of type string, but the function expects a object<string>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
145
        $this->assertSame('m', $result['gender']);
146
147
        $result = $guesser->guess('Sonja');
0 ignored issues
show
Documentation introduced by
'Sonja' is of type string, but the function expects a object<string>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
148
        $this->assertSame('f', $result['gender']);
149
    }
150
151 View Code Duplication
    public function testGuesserWithMetaPhone2()
152
    {
153
        $females = array();
154
        $males = array();
155
        $matchList = array('either_weight_metaphone');
156
157
        // use with extra names supplied via constructor
158
        $guesser = new AzineGenderGuesser($females, $males, true, $matchList);
159
160
        $result = $guesser->guess('Patric');
0 ignored issues
show
Documentation introduced by
'Patric' is of type string, but the function expects a object<string>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
161
        $this->assertSame('m', $result['gender']);
162
        $result = $guesser->guess('Tomàs');
0 ignored issues
show
Documentation introduced by
'Tomàs' is of type string, but the function expects a object<string>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
163
        $this->assertSame('m', $result['gender']);
164
165
        $result = $guesser->guess('Sonja');
0 ignored issues
show
Documentation introduced by
'Sonja' is of type string, but the function expects a object<string>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
166
        $this->assertSame('f', $result['gender']);
167
    }
168
}
169