Code Duplication    Length = 28-28 lines in 2 locations

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

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