Passed
Push — main ( a1448d...532f1f )
by Peter
03:51
created

FlushCacheTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 13
dl 0
loc 26
rs 10
c 1
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testExecuteFlushesCache() 0 10 1
A setUp() 0 7 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace AbterPhp\Framework\Console\Commands\Template;
6
7
use AbterPhp\Framework\Template\CacheManager;
8
use Opulence\Console\Responses\IResponse;
9
use PHPUnit\Framework\MockObject\MockObject;
10
use PHPUnit\Framework\TestCase;
11
12
class FlushCacheTest extends TestCase
13
{
14
    private FlushCache $sut;
15
16
    /** @var CacheManager|MockObject */
17
    private $cacheManagerMock;
18
19
    public function setUp(): void
20
    {
21
        $this->cacheManagerMock = $this->getMockBuilder(CacheManager::class)
22
            ->disableOriginalConstructor()
23
            ->getMock();
24
25
        $this->sut = new FlushCache($this->cacheManagerMock);
26
    }
27
28
    public function testExecuteFlushesCache()
29
    {
30
        $responseMock = $this->getMockBuilder(IResponse::class)
31
            ->disableOriginalConstructor()
32
            ->getMock();
33
34
        $this->cacheManagerMock->expects($this->atLeastOnce())->method('flush');
35
        $responseMock->expects($this->atLeastOnce())->method('writeln');
36
37
        $this->sut->execute($responseMock);
38
    }
39
}
40