Code Duplication    Length = 28-28 lines in 2 locations

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

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