Code Duplication    Length = 28-28 lines in 2 locations

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

@@ 3282-3309 (lines=28) @@
3279
     *
3280
     * @expectedException \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException
3281
     */
3282
    public function testCreateUrlAliasThrowsInvalidArgumentException()
3283
    {
3284
        $location = $this->getLocationStub();
3285
        $urlAliasService = $this->getRepository()->getURLAliasService();
3286
        $urlAliasHandler = $this->getPersistenceMockHandler('Content\\UrlAlias\\Handler');
3287
3288
        $urlAliasHandler->expects(
3289
            $this->once()
3290
        )->method(
3291
            'createCustomUrlAlias'
3292
        )->with(
3293
            $this->equalTo($location->id),
3294
            $this->equalTo('path'),
3295
            $this->equalTo('forwarding'),
3296
            $this->equalTo('languageCode'),
3297
            $this->equalTo('alwaysAvailable')
3298
        )->will(
3299
            $this->throwException(new ForbiddenException('Forbidden!'))
3300
        );
3301
3302
        $urlAliasService->createUrlAlias(
3303
            $location,
3304
            'path',
3305
            'languageCode',
3306
            'forwarding',
3307
            'alwaysAvailable'
3308
        );
3309
    }
3310
3311
    /**
3312
     * Test for the createGlobalUrlAlias() method.
@@ 3423-3450 (lines=28) @@
3420
     *
3421
     * @expectedException \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException
3422
     */
3423
    public function testCreateGlobalUrlAliasThrowsInvalidArgumentExceptionPath()
3424
    {
3425
        $resource = 'module:content/search';
3426
        $urlAliasService = $this->getRepository()->getURLAliasService();
3427
        $urlAliasHandler = $this->getPersistenceMockHandler('Content\\UrlAlias\\Handler');
3428
3429
        $urlAliasHandler->expects(
3430
            $this->once()
3431
        )->method(
3432
            'createGlobalUrlAlias'
3433
        )->with(
3434
            $this->equalTo($resource),
3435
            $this->equalTo('path'),
3436
            $this->equalTo('forwarding'),
3437
            $this->equalTo('languageCode'),
3438
            $this->equalTo('alwaysAvailable')
3439
        )->will(
3440
            $this->throwException(new ForbiddenException('Forbidden!'))
3441
        );
3442
3443
        $urlAliasService->createGlobalUrlAlias(
3444
            $resource,
3445
            'path',
3446
            'languageCode',
3447
            'forwarding',
3448
            'alwaysAvailable'
3449
        );
3450
    }
3451
3452
    /**
3453
     * Test for the createGlobalUrlAlias() method.