Completed
Push — ezp-30639-deprecated-view-acti... ( 6b3a78...0a459a )
by
unknown
16:22
created

ProxyCacheWarmerTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
dl 0
loc 29
rs 10
c 0
b 0
f 0
wmc 3
lcom 1
cbo 2

3 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 5 1
A testIsOptional() 0 4 1
A testWarmUp() 0 9 1
1
<?php
2
3
/**
4
 * @copyright Copyright (C) eZ Systems AS. All rights reserved.
5
 * @license For full copyright and license information view LICENSE file distributed with this source code.
6
 */
7
declare(strict_types=1);
8
9
namespace eZ\Bundle\EzPublishCoreBundle\Tests\Cache\Warmer;
10
11
use eZ\Bundle\EzPublishCoreBundle\Cache\Warmer\ProxyCacheWarmer;
12
use eZ\Publish\Core\Repository\ProxyFactory\ProxyGeneratorInterface;
13
use PHPUnit\Framework\TestCase;
14
15
final class ProxyCacheWarmerTest extends TestCase
16
{
17
    /** @var \eZ\Publish\Core\Repository\ProxyFactory\ProxyGeneratorInterface|\PHPUnit\Framework\MockObject\MockObject */
18
    private $proxyGenerator;
19
20
    /** @var \eZ\Bundle\EzPublishCoreBundle\Cache\Warmer\ProxyCacheWarmer */
21
    private $proxyCacheWarmer;
22
23
    protected function setUp(): void
24
    {
25
        $this->proxyGenerator = $this->createMock(ProxyGeneratorInterface::class);
26
        $this->proxyCacheWarmer = new ProxyCacheWarmer($this->proxyGenerator);
27
    }
28
29
    public function testIsOptional(): void
30
    {
31
        $this->assertFalse($this->proxyCacheWarmer->isOptional());
32
    }
33
34
    public function testWarmUp(): void
35
    {
36
        $this->proxyGenerator
37
            ->expects($this->once())
38
            ->method('warmUp')
39
            ->with(ProxyCacheWarmer::PROXY_CLASSES);
40
41
        $this->proxyCacheWarmer->warmUp('/cache/dir');
42
    }
43
}
44