Completed
Push — sf_cache ( 0e8aea...6d5e03 )
by André
38:18 queued 11:23
created

providerForUnCachedMethods()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 4
nc 1
nop 0
dl 0
loc 8
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
/**
4
 * File contains Test class.
5
 *
6
 * @copyright Copyright (C) eZ Systems AS. All rights reserved.
7
 * @license For full copyright and license information view LICENSE file distributed with this source code.
8
 */
9
namespace eZ\Publish\Core\Persistence\Cache\Tests;
10
11
use eZ\Publish\SPI\Persistence\TransactionHandler;
12
13
/**
14
 * Test case for Persistence\Cache\TransactionHandler.
15
 */
16
class TransactionHandlerTest extends AbstractCacheHandlerTest
17
{
18
    public function getHandlerMethodName() : string
19
    {
20
        return 'transactionHandler';
21
    }
22
23
    public function getHandlerClassName() : string
24
    {
25
        return TransactionHandler::class;
26
    }
27
28
    public function providerForUnCachedMethods() : array
29
    {
30
        // string $method, array $arguments, array? $tags, string? $key
31
        return [
32
            ['beginTransaction', []],
33
            ['commit', []],
34
        ];
35
    }
36
37
    public function providerForCachedLoadMethods() : array
38
    {
39
        // string $method, array $arguments, string $key, mixed? $data
40
        return [
41
        ];
42
    }
43
44
    /**
45
     * @covers \eZ\Publish\Core\Persistence\Cache\TransactionHandler::rollback
46
     */
47
    public function testRollback()
48
    {
49
        $this->loggerMock
50
            ->expects($this->once())
51
            ->method('logCall');
52
53
        $this->cacheMock
54
            ->expects($this->once())
55
            ->method('clear');
56
57
        $innerHandlerMock = $this->getMock('eZ\\Publish\\SPI\\Persistence\\TransactionHandler');
58
        $this->persistenceHandlerMock
59
            ->expects($this->once())
60
            ->method('transactionHandler')
61
            ->will($this->returnValue($innerHandlerMock));
62
63
        $innerHandlerMock
64
            ->expects($this->once())
65
            ->method('rollback');
66
67
        $handler = $this->persistenceCacheHandler->transactionHandler();
68
        $handler->rollback();
69
    }
70
}
71