Code Duplication    Length = 17-23 lines in 4 locations

eZ/Publish/Core/Persistence/Cache/Tests/TransactionHandlerTest.php 3 locations

@@ 21-43 (lines=23) @@
18
    /**
19
     * @covers \eZ\Publish\Core\Persistence\Cache\TransactionHandler::beginTransaction
20
     */
21
    public function testBeginTransaction()
22
    {
23
        $this->loggerMock
24
            ->expects($this->once())
25
            ->method('logCall');
26
27
        $this->cacheMock
28
            ->expects($this->once())
29
            ->method('beginTransaction');
30
31
        $innerHandlerMock = $this->createMock(TransactionHandler::class);
32
        $this->persistenceHandlerMock
33
            ->expects($this->once())
34
            ->method('transactionHandler')
35
            ->will($this->returnValue($innerHandlerMock));
36
37
        $innerHandlerMock
38
            ->expects($this->once())
39
            ->method('beginTransaction');
40
41
        $handler = $this->persistenceCacheHandler->transactionHandler();
42
        $handler->beginTransaction();
43
    }
44
45
    /**
46
     * @covers \eZ\Publish\Core\Persistence\Cache\TransactionHandler::commit
@@ 48-70 (lines=23) @@
45
    /**
46
     * @covers \eZ\Publish\Core\Persistence\Cache\TransactionHandler::commit
47
     */
48
    public function testCommit()
49
    {
50
        $this->loggerMock
51
            ->expects($this->once())
52
            ->method('logCall');
53
54
        $this->cacheMock
55
            ->expects($this->once())
56
            ->method('commitTransaction');
57
58
        $innerHandlerMock = $this->createMock(TransactionHandler::class);
59
        $this->persistenceHandlerMock
60
            ->expects($this->once())
61
            ->method('transactionHandler')
62
            ->will($this->returnValue($innerHandlerMock));
63
64
        $innerHandlerMock
65
            ->expects($this->once())
66
            ->method('commit');
67
68
        $handler = $this->persistenceCacheHandler->transactionHandler();
69
        $handler->commit();
70
    }
71
72
    /**
73
     * @covers \eZ\Publish\Core\Persistence\Cache\TransactionHandler::rollback
@@ 75-97 (lines=23) @@
72
    /**
73
     * @covers \eZ\Publish\Core\Persistence\Cache\TransactionHandler::rollback
74
     */
75
    public function testRollback()
76
    {
77
        $this->loggerMock
78
            ->expects($this->once())
79
            ->method('logCall');
80
81
        $this->cacheMock
82
            ->expects($this->never())
83
            ->method('clear');
84
85
        $innerHandlerMock = $this->createMock(TransactionHandler::class);
86
        $this->persistenceHandlerMock
87
            ->expects($this->once())
88
            ->method('transactionHandler')
89
            ->will($this->returnValue($innerHandlerMock));
90
91
        $innerHandlerMock
92
            ->expects($this->once())
93
            ->method('rollback');
94
95
        $handler = $this->persistenceCacheHandler->transactionHandler();
96
        $handler->rollback();
97
    }
98
}
99

eZ/Publish/Core/Persistence/Cache/Tests/UrlAliasHandlerTest.php 1 location

@@ 1110-1126 (lines=17) @@
1107
    /**
1108
     * @param $locationCacheMissed
1109
     */
1110
    protected function prepareDeleteMocks($locationCacheMissed)
1111
    {
1112
        $this->loggerMock->expects($this->once())->method('logCall');
1113
1114
        $innerHandler = $this->getSPIUrlAliasHandlerMock();
1115
        $this->persistenceHandlerMock
1116
            ->expects($this->once())
1117
            ->method('urlAliasHandler')
1118
            ->will($this->returnValue($innerHandler));
1119
1120
        $innerHandler->expects($this->once())->method('locationDeleted')->with(44);
1121
1122
        $this->cacheMock
1123
            ->expects($this->once())
1124
            ->method('getItem')
1125
            ->willReturn($locationCacheMissed);
1126
    }
1127
}
1128