Passed
Pull Request — master (#30)
by Alexander
02:06
created

AnyDependecyTest.php$1 ➔ test()   A

Complexity

Conditions 1

Size

Total Lines 26

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
c 0
b 0
f 0
dl 0
loc 26
rs 9.504
1
<?php
2
namespace Yiisoft\CacheOld\Tests\Dependency;
3
4
use Yiisoft\CacheOld\Dependency\AnyDependency;
0 ignored issues
show
Bug introduced by
The type Yiisoft\CacheOld\Dependency\AnyDependency 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...
5
use Yiisoft\CacheOld\Dependency\CallbackDependency;
0 ignored issues
show
Bug introduced by
The type Yiisoft\CacheOld\Dependency\CallbackDependency 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
7
class AnyDependecyTest extends DependencyTestCase
8
{
9
    public function test(): void
10
    {
11
        $data1 = new class {
12
            public $data = 1;
13
        };
14
15
        $data2 = new class {
16
            public $data = 2;
17
        };
18
19
        $dependency1 = new CallbackDependency(static function () use ($data1) {
20
            return $data1->data;
21
        });
22
23
        $dependency2 = new CallbackDependency(static function () use ($data2) {
24
            return $data2->data;
25
        });
26
27
        $anyDependency = new AnyDependency([$dependency1, $dependency2]);
28
        $anyDependency->evaluateDependency($this->getCache());
29
30
        $this->assertDependencyNotChanged($anyDependency);
31
32
        $data2->data = 42;
33
34
        $this->assertDependencyChanged($anyDependency);
35
    }
36
}
37