Passed
Branch 2.0 (d24509)
by Donald
02:04
created

ResetTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
dl 0
loc 19
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 6 1
A testResetSetsNounsToEmptyArray() 0 9 1
1
<?php namespace Chekote\NounStore\Store;
2
3
use Chekote\Phake\Phake;
4
5
/**
6
 * @covers \Chekote\NounStore\Store::reset()
7
 */
8
class ResetTest extends StoreTest
9
{
10
    public function setUp()
11
    {
12
        parent::setUp();
13
14
        /* @noinspection PhpUndefinedMethodInspection */
15
        Phake::when($this->store)->reset()->thenCallParent();
0 ignored issues
show
Bug introduced by
It seems like $this->store can also be of type Chekote\NounStore\Store; 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

15
        Phake::when(/** @scrutinizer ignore-type */ $this->store)->reset()->thenCallParent();
Loading history...
16
    }
17
18
    public function testResetSetsNounsToEmptyArray()
19
    {
20
        $this->store->reset();
0 ignored issues
show
Bug introduced by
The method reset() does not exist on Phake_IMock. ( Ignorable by Annotation )

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

20
        $this->store->/** @scrutinizer ignore-call */ 
21
                      reset();

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
21
22
        $store = Phake::makeVisible($this->store);
0 ignored issues
show
Bug introduced by
It seems like $this->store can also be of type Chekote\NounStore\Store; 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

22
        $store = Phake::makeVisible(/** @scrutinizer ignore-type */ $this->store);
Loading history...
23
        /* @noinspection PhpUndefinedFieldInspection */
24
        {
25
            $this->assertEquals('array', gettype($store->nouns));
0 ignored issues
show
Bug Best Practice introduced by
The property nouns does not exist on Chekote\Phake\Proxies\VisibilityProxy. Since you implemented __get, consider adding a @property annotation.
Loading history...
26
            $this->assertCount(0, $store->nouns);
27
        }
28
    }
29
}
30