| @@ 85-103 (lines=19) @@ | ||
| 82 | /** |
|
| 83 | * @covers \eZ\Publish\Core\Persistence\Legacy\TransactionHandler::commit |
|
| 84 | */ |
|
| 85 | public function testCommitException() |
|
| 86 | { |
|
| 87 | $this->expectException(\RuntimeException::class); |
|
| 88 | $this->expectExceptionMessage('test'); |
|
| 89 | ||
| 90 | $handler = $this->getTransactionHandler(); |
|
| 91 | $this->getDatabaseHandlerMock() |
|
| 92 | ->expects($this->once()) |
|
| 93 | ->method('commit') |
|
| 94 | ->will($this->throwException(new Exception('test'))); |
|
| 95 | $this->getContentTypeHandlerMock() |
|
| 96 | ->expects($this->never()) |
|
| 97 | ->method($this->anything()); |
|
| 98 | $this->getLanguageHandlerMock() |
|
| 99 | ->expects($this->never()) |
|
| 100 | ->method($this->anything()); |
|
| 101 | ||
| 102 | $handler->commit(); |
|
| 103 | } |
|
| 104 | ||
| 105 | /** |
|
| 106 | * @covers \eZ\Publish\Core\Persistence\Legacy\TransactionHandler::rollback |
|
| @@ 127-145 (lines=19) @@ | ||
| 124 | /** |
|
| 125 | * @covers \eZ\Publish\Core\Persistence\Legacy\TransactionHandler::rollback |
|
| 126 | */ |
|
| 127 | public function testRollbackException() |
|
| 128 | { |
|
| 129 | $this->expectException(\RuntimeException::class); |
|
| 130 | $this->expectExceptionMessage('test'); |
|
| 131 | ||
| 132 | $handler = $this->getTransactionHandler(); |
|
| 133 | $this->getDatabaseHandlerMock() |
|
| 134 | ->expects($this->once()) |
|
| 135 | ->method('rollback') |
|
| 136 | ->will($this->throwException(new Exception('test'))); |
|
| 137 | $this->getContentTypeHandlerMock() |
|
| 138 | ->expects($this->never()) |
|
| 139 | ->method($this->anything()); |
|
| 140 | $this->getLanguageHandlerMock() |
|
| 141 | ->expects($this->never()) |
|
| 142 | ->method($this->anything()); |
|
| 143 | ||
| 144 | $handler->rollback(); |
|
| 145 | } |
|
| 146 | ||
| 147 | /** |
|
| 148 | * Returns a mock object for the Content Gateway. |
|