Failed Conditions
Push — possessive_nouns ( b5335d...fee3e3 )
by Donald
01:41
created

SplitPossessionsTest::testSuccessScenario()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 3
c 1
b 0
f 0
dl 0
loc 6
rs 10
cc 1
nc 1
nop 2
1
<?php namespace Chekote\NounStore\Key;
2
3
use Chekote\Phake\Phake;
4
//use InvalidArgumentException;
0 ignored issues
show
Unused Code Comprehensibility introduced by
50% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
5
6
/**
7
 * @covers \Chekote\NounStore\Key::splitPossessions()
8
 */
9
class SplitPossessionsTest extends KeyTest
10
{
11
    public function setUp()
12
    {
13
        parent::setUp();
14
15
        /* @noinspection PhpUndefinedMethodInspection */
16
        Phake::when($this->key)->splitPossessions(Phake::anyParameters())->thenCallParent();
0 ignored issues
show
Bug introduced by
It seems like $this->key can also be of type Chekote\NounStore\Key; however, parameter $mock of Phake::when() does only seem to accept Phake_IMock, maybe add an additional type check? ( Ignorable by Annotation )

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

16
        Phake::when(/** @scrutinizer ignore-type */ $this->key)->splitPossessions(Phake::anyParameters())->thenCallParent();
Loading history...
17
    }
18
19
    /**
20
     * @dataProvider nouns
21
     */
22
    public function testSuccessScenario($key, array $parts)
23
    {
24
        /* @noinspection PhpUndefinedMethodInspection */
25
        $this->assertSame(
26
            $parts,
27
            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

27
            Phake::makeVisible($this->key)->/** @scrutinizer ignore-call */ splitPossessions($key)
Loading history...
Bug introduced by
It seems like $this->key can also be of type Chekote\NounStore\Key; however, parameter $mock of Chekote\Phake\Phake::makeVisible() does only seem to accept Phake_IMock, maybe add an additional type check? ( Ignorable by Annotation )

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

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