Failed Conditions
Pull Request — master (#49)
by Donald
02:55 queued 01:28
created

IsPossessiveTest   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 62
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 5
eloc 18
c 1
b 0
f 0
dl 0
loc 62
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A possessiveNouns() 0 7 1
A nonPossessiveNouns() 0 5 1
A testReturnsTrueForPossessiveNoun() 0 6 1
A testReturnsFalseForNonPossessiveNoun() 0 6 1
A setUp() 0 6 1
1
<?php namespace Chekote\NounStore\Key;
2
3
use Chekote\Phake\Phake;
4
5
/**
6
 * @covers \Chekote\NounStore\Key::isPossessive()
7
 */
8
class IsPossessiveTest extends KeyTest
9
{
10
    /** @var string */
11
    const KEY = 'Customer';
12
13
    public function setUp()
14
    {
15
        parent::setUp();
16
17
        /* @noinspection PhpUndefinedMethodInspection */
18
        Phake::when($this->key)->isPossessive(Phake::anyParameters())->thenCallParent();
19
    }
20
21
    /**
22
     * @dataProvider possessiveNouns
23
     */
24
    public function testReturnsTrueForPossessiveNoun($noun)
25
    {
26
        /* @noinspection PhpUndefinedMethodInspection */
27
        $this->assertTrue(
28
            Phake::makeVisible($this->key)->isPossessive($noun),
0 ignored issues
show
Bug introduced by
The method isPossessive() does not exist on Chekote\Phake\Proxies\VisibilityProxy. Since you implemented __call, consider adding a @method annotation. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

28
            Phake::makeVisible($this->key)->/** @scrutinizer ignore-call */ isPossessive($noun),
Loading history...
29
            "'$noun' should be considered a possessive noun"
30
        );
31
    }
32
33
    /**
34
     * Data provider of possessive nouns.
35
     *
36
     * @return array[]
37
     */
38
    public function possessiveNouns()
39
    {
40
        return [
41
            [self::KEY . "'s Car"],
42
            ['8th ' . self::KEY . "'s Car"],
43
            [self::KEY . "'s 2nd Car"],
44
            ["7th " . self::KEY . "'s 4th Car"],
45
        ];
46
    }
47
48
    /**
49
     * @dataProvider nonPossessiveNouns
50
     */
51
    public function testReturnsFalseForNonPossessiveNoun($noun)
52
    {
53
        /* @noinspection PhpUndefinedMethodInspection */
54
        $this->assertFalse(
55
            Phake::makeVisible($this->key)->isPossessive($noun),
56
            "'$noun' should not be considered a possessive noun"
57
        );
58
    }
59
60
    /**
61
     * Data provider of non possessive nouns.
62
     *
63
     * @return array[]
64
     */
65
    public function nonPossessiveNouns()
66
    {
67
        return [
68
            [self::KEY],
69
            ['1st ' . self::KEY],
70
        ];
71
    }
72
}
73