Failed Conditions
Pull Request — master (#49)
by Donald
03:22 queued 01:40
created

SplitPossessionsTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 3
eloc 14
c 2
b 0
f 0
dl 0
loc 42
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 6 1
A nouns() 0 9 1
A testSuccessScenario() 0 9 1
1
<?php namespace Chekote\NounStore\Key;
2
3
use Chekote\Phake\Phake;
4
5
/**
6
 * @covers \Chekote\NounStore\Key::splitPossessions()
7
 */
8
class SplitPossessionsTest 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)->splitPossessions(Phake::anyParameters())->thenCallParent();
19
    }
20
21
    /**
22
     * @dataProvider nouns
23
     */
24
    public function testSuccessScenario($key, array $parts)
25
    {
26
        /**
27
         * @noinspection PhpUndefinedMethodInspection
28
         * @scrutinizer  ignore-call
29
         */
30
        $this->assertSame(
31
            $parts,
32
            Phake::makeVisible($this->key)->splitPossessions($key)
0 ignored issues
show
Bug introduced by
The method splitPossessions() 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

32
            Phake::makeVisible($this->key)->/** @scrutinizer ignore-call */ splitPossessions($key)
Loading history...
33
        );
34
    }
35
36
    /**
37
     * Data provider of possessive nouns and their component nouns.
38
     *
39
     * @return array[]
40
     */
41
    public function nouns()
42
    {
43
        return [
44
            [self::KEY,                                 [self::KEY                             ]],
45
            [self::KEY . "'s Car",                      [self::KEY,          'Car'             ]],
46
            ['8th ' . self::KEY . "'s Car",             ['8th ' . self::KEY, 'Car'             ]],
47
            [self::KEY . "'s 2nd Car",                  [self::KEY,          '2nd Car'         ]],
48
            ['7th ' . self::KEY . "'s 4th Car",         ['7th ' . self::KEY, '4th Car'         ]],
49
            ['7th ' . self::KEY . "'s 4th Car's Wheel", ['7th ' . self::KEY, '4th Car', 'Wheel']],
50
        ];
51
    }
52
}
53