Code Duplication    Length = 23-24 lines in 2 locations

eZ/Publish/Core/Repository/Tests/Service/Mock/UrlAliasTest.php 2 locations

@@ 198-220 (lines=23) @@
195
    /**
196
     * Test for the removeAliases() method.
197
     */
198
    public function testRemoveAliases()
199
    {
200
        $aliasList = array(new UrlAlias(array('isCustom' => true)));
201
        $spiAliasList = array(new SPIUrlAlias(array('isCustom' => true)));
202
        $repositoryMock = $this->getRepositoryMock();
203
        $mockedService = $this->getPartlyMockedURLAliasServiceService();
204
        /** @var \PHPUnit_Framework_MockObject_MockObject $urlAliasHandlerMock */
205
        $urlAliasHandlerMock = $this->getPersistenceMock()->urlAliasHandler();
206
207
        $repositoryMock
208
            ->expects($this->once())
209
            ->method('beginTransaction');
210
        $repositoryMock
211
            ->expects($this->once())
212
            ->method('commit');
213
214
        $urlAliasHandlerMock
215
            ->expects($this->once())
216
            ->method('removeURLAliases')
217
            ->with($spiAliasList);
218
219
        $mockedService->removeAliases($aliasList);
220
    }
221
222
    /**
223
     * Test for the removeAliases() method.
@@ 228-251 (lines=24) @@
225
     * @expectedException \Exception
226
     * @expectedExceptionMessage Handler threw an exception
227
     */
228
    public function testRemoveAliasesWithRollback()
229
    {
230
        $aliasList = array(new UrlAlias(array('isCustom' => true)));
231
        $spiAliasList = array(new SPIUrlAlias(array('isCustom' => true)));
232
        $repositoryMock = $this->getRepositoryMock();
233
        $mockedService = $this->getPartlyMockedURLAliasServiceService();
234
        /** @var \PHPUnit_Framework_MockObject_MockObject $urlAliasHandlerMock */
235
        $urlAliasHandlerMock = $this->getPersistenceMock()->urlAliasHandler();
236
237
        $repositoryMock
238
            ->expects($this->once())
239
            ->method('beginTransaction');
240
        $repositoryMock
241
            ->expects($this->once())
242
            ->method('rollback');
243
244
        $urlAliasHandlerMock
245
            ->expects($this->once())
246
            ->method('removeURLAliases')
247
            ->with($spiAliasList)
248
            ->will($this->throwException(new Exception('Handler threw an exception')));
249
250
        $mockedService->removeAliases($aliasList);
251
    }
252
253
    public function providerForTestListAutogeneratedLocationAliasesPath()
254
    {