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

FlushCacheTest::setUp()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 4
nc 1
nop 0
dl 0
loc 7
rs 10
c 1
b 0
f 0
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