HasStoresTraitTest::test_store_file_no_config()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 5
c 1
b 0
f 0
dl 0
loc 10
rs 10
cc 1
nc 1
nop 0
1
<?php
2
3
namespace Nip\Cache\Tests\CacheManager;
4
5
use Mockery\Mock;
0 ignored issues
show
Bug introduced by
The type Mockery\Mock was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
6
use Nip\Cache\CacheManager;
7
use Nip\Cache\Stores\Repository;
8
use Nip\Cache\Tests\AbstractTest;
9
10
/**
11
 * Class HasStoresTraitTest
12
 * @package Nip\Cache\Tests\CacheManager
13
 */
14
class HasStoresTraitTest extends AbstractTest
15
{
16
    public function test_store_default_no_name()
17
    {
18
        /** @var Mock|CacheManager $manager */
19
        $manager = \Mockery::mock(CacheManager::class)->shouldAllowMockingProtectedMethods()->makePartial();
0 ignored issues
show
Bug introduced by
The type Mockery was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
20
        $manager->shouldReceive('getDefaultStore')->andReturn('default_value');
0 ignored issues
show
Bug introduced by
The method shouldReceive() does not exist on Nip\Cache\CacheManager. ( Ignorable by Annotation )

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

20
        $manager->/** @scrutinizer ignore-call */ 
21
                  shouldReceive('getDefaultStore')->andReturn('default_value');

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
        $manager->shouldReceive('getStore')->with('default_value')->andReturn(true);
22
23
        self::assertTrue($manager->store(null));
24
        self::assertTrue($manager->store(0));
25
        self::assertTrue($manager->store(''));
26
    }
27
28
    public function test_store_file_no_config()
29
    {
30
        /** @var Mock|CacheManager $manager */
31
        $manager = \Mockery::mock(CacheManager::class)->shouldAllowMockingProtectedMethods()->makePartial();
32
        $manager->shouldReceive('getConfig')->andReturnUsing(function ($name, $default) {
33
            return $default;
34
        });
35
36
        $store = $manager->store();
37
        self::assertInstanceOf(Repository::class, $store);
38
    }
39
}
40