GetAllTest   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 8
dl 0
loc 28
rs 10
c 0
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 6 1
A testGetAllReturnsEmptyArrayWhenKeyDoesNotExist() 0 3 1
A testGetAllReturnsAllValuesForSpecifiedKey() 0 7 1
1
<?php namespace Unit\Chekote\NounStore\Store;
2
3
use Unit\Chekote\Phake\Phake;
4
5
/**
6
 * @covers \Chekote\NounStore\Store::getAll()
7
 */
8
class GetAllTest extends StoreTestCase
9
{
10
    public function setUp(): void
11
    {
12
        parent::setUp();
13
14
        /* @noinspection PhpUndefinedMethodInspection */
15
        Phake::when($this->store)->getAll(Phake::anyParameters())->thenCallParent();
16
    }
17
18
    /**
19
     * Tests that Store::getAll returns an empty array the specified $key does not exist.
20
     */
21
    public function testGetAllReturnsEmptyArrayWhenKeyDoesNotExist(): void
22
    {
23
        $this->assertEquals([], $this->store->getAll('Thing'));
0 ignored issues
show
Bug introduced by
The method getAll() 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

23
        $this->assertEquals([], $this->store->/** @scrutinizer ignore-call */ getAll('Thing'));

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...
Bug introduced by
The method getAll() does not exist on Unit\Chekote\NounStore\Store\StorePhake. ( Ignorable by Annotation )

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

23
        $this->assertEquals([], $this->store->/** @scrutinizer ignore-call */ getAll('Thing'));

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...
24
    }
25
26
    /**
27
     * Tests that Store::getAll returns all values for specified key.
28
     */
29
    public function testGetAllReturnsAllValuesForSpecifiedKey(): void
30
    {
31
        $values = $this->store->getAll(self::KEY);
32
33
        $this->assertCount(2, $values);
34
        $this->assertEquals(self::$firstValue, $values[0]);
35
        $this->assertEquals(self::$secondValue, $values[1]);
36
    }
37
}
38