Code Duplication    Length = 23-24 lines in 2 locations

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

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