Code Duplication    Length = 23-24 lines in 2 locations

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

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