1
|
|
|
<?php |
2
|
|
|
namespace Yiisoft\Cache\Tests\Dependency; |
3
|
|
|
|
4
|
|
|
use Yiisoft\Cache\Dependency\Dependency; |
5
|
|
|
use Yiisoft\Cache\NullCache; |
6
|
|
|
|
7
|
|
|
/** |
8
|
|
|
* Dependency (abstract) tests. |
9
|
|
|
* @group caching |
10
|
|
|
*/ |
11
|
|
|
class DependencyTest extends TestCase |
|
|
|
|
12
|
|
|
{ |
13
|
|
|
public function testResetReusableData(): void |
14
|
|
|
{ |
15
|
|
|
$value = ['dummy']; |
16
|
|
|
$dependency = new MockDependency(); |
|
|
|
|
17
|
|
|
$this->setInaccessibleProperty($dependency, 'reusableData', $value, false); |
18
|
|
|
$this->assertEquals($value, $this->getInaccessibleProperty($dependency, 'reusableData')); |
19
|
|
|
|
20
|
|
|
$dependency->resetReusableData(); |
21
|
|
|
|
22
|
|
|
$this->assertEquals([], $this->getInaccessibleProperty($dependency, 'reusableData')); |
23
|
|
|
} |
24
|
|
|
|
25
|
|
|
public function testGenerateReusableHash(): void |
26
|
|
|
{ |
27
|
|
|
$dependency = $this->getMockForAbstractClass(Dependency::class); |
28
|
|
|
$this->setInaccessibleProperty($dependency, 'data', 'dummy'); |
29
|
|
|
|
30
|
|
|
$result = $this->invokeMethod($dependency, 'generateReusableHash'); |
31
|
|
|
|
32
|
|
|
$this->assertEquals(5, strlen($this->getInaccessibleProperty($dependency, 'data'))); |
33
|
|
|
$this->assertEquals(40, strlen($result)); |
34
|
|
|
} |
35
|
|
|
|
36
|
|
|
public function testIsChanged(): void |
37
|
|
|
{ |
38
|
|
|
/* @var $dependency Dependency */ |
39
|
|
|
|
40
|
|
|
$dependency = $this->getMockForAbstractClass(Dependency::class); |
41
|
|
|
$cache = new NullCache(); |
42
|
|
|
|
43
|
|
|
$result = $dependency->isChanged($cache); |
44
|
|
|
$this->assertFalse($result); |
45
|
|
|
|
46
|
|
|
$this->setInaccessibleProperty($dependency, 'data', 'changed'); |
47
|
|
|
$result = $dependency->isChanged($cache); |
48
|
|
|
$this->assertTrue($result); |
49
|
|
|
} |
50
|
|
|
} |
51
|
|
|
|
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:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths