Passed
Branch scrutinizer_new_php_analysis (b739aa)
by Donald
01:58
created

StoreTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 7 1
A tearDown() 0 4 1
1
<?php namespace Chekote\NounStore\Store;
2
3
use Chekote\NounStore\Key;
4
use Chekote\NounStore\Store;
5
use Chekote\Phake\Phake;
6
use PHPUnit\Framework\TestCase;
7
8
abstract class StoreTest extends TestCase
9
{
10
    /** @var Key|\Phake_IMock */
11
    protected $key;
12
13
    /** @var Store|\Phake_IMock */
14
    protected $store;
15
16
    const KEY = 'Some Key';
17
    const FIRST_VALUE = 'The First Value';
18
    const SECOND_VALUE = 'The Second Value';
19
20
    const MOST_RECENT_VALUE = self::SECOND_VALUE;
21
22
    /**
23
     * Sets up the environment before each test.
24
     */
25
    public function setUp()
26
    {
27
        $this->key = Phake::strictMock(Key::class);
28
        $this->store = Phake::strictMockWithConstructor(Store::class, $this->key);
0 ignored issues
show
Bug introduced by
$this->key of type Phake_IMock is incompatible with the type array expected by parameter $args of Chekote\Phake\Phake::strictMockWithConstructor(). ( Ignorable by Annotation )

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

28
        $this->store = Phake::strictMockWithConstructor(Store::class, /** @scrutinizer ignore-type */ $this->key);
Loading history...
29
30
        /* @noinspection PhpUndefinedFieldInspection */
31
        Phake::makeVisible($this->store)->nouns = [self::KEY => [self::FIRST_VALUE, self::SECOND_VALUE]];
0 ignored issues
show
Bug Best Practice introduced by
The property nouns does not exist on Chekote\Phake\Proxies\VisibilityProxy. Since you implemented __set, consider adding a @property annotation.
Loading history...
32
    }
33
34
    /**
35
     * Tears down the environment after each test.
36
     */
37
    public function tearDown()
38
    {
39
        $this->key = null;
40
        $this->store = null;
41
    }
42
}
43