Code Duplication    Length = 28-28 lines in 2 locations

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

@@ 3264-3291 (lines=28) @@
3261
     *
3262
     * @expectedException \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException
3263
     */
3264
    public function testCreateUrlAliasThrowsInvalidArgumentException()
3265
    {
3266
        $location = $this->getLocationStub();
3267
        $urlAliasService = $this->getRepository()->getURLAliasService();
3268
        $urlAliasHandler = $this->getPersistenceMockHandler('Content\\UrlAlias\\Handler');
3269
3270
        $urlAliasHandler->expects(
3271
            $this->once()
3272
        )->method(
3273
            'createCustomUrlAlias'
3274
        )->with(
3275
            $this->equalTo($location->id),
3276
            $this->equalTo('path'),
3277
            $this->equalTo('forwarding'),
3278
            $this->equalTo('languageCode'),
3279
            $this->equalTo('alwaysAvailable')
3280
        )->will(
3281
            $this->throwException(new ForbiddenException('Forbidden!'))
3282
        );
3283
3284
        $urlAliasService->createUrlAlias(
3285
            $location,
3286
            'path',
3287
            'languageCode',
3288
            'forwarding',
3289
            'alwaysAvailable'
3290
        );
3291
    }
3292
3293
    /**
3294
     * Test for the createGlobalUrlAlias() method.
@@ 3402-3429 (lines=28) @@
3399
     *
3400
     * @expectedException \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException
3401
     */
3402
    public function testCreateGlobalUrlAliasThrowsInvalidArgumentExceptionPath()
3403
    {
3404
        $resource = 'module:content/search';
3405
        $urlAliasService = $this->getRepository()->getURLAliasService();
3406
        $urlAliasHandler = $this->getPersistenceMockHandler('Content\\UrlAlias\\Handler');
3407
3408
        $urlAliasHandler->expects(
3409
            $this->once()
3410
        )->method(
3411
            'createGlobalUrlAlias'
3412
        )->with(
3413
            $this->equalTo($resource),
3414
            $this->equalTo('path'),
3415
            $this->equalTo('forwarding'),
3416
            $this->equalTo('languageCode'),
3417
            $this->equalTo('alwaysAvailable')
3418
        )->will(
3419
            $this->throwException(new ForbiddenException('Forbidden!'))
3420
        );
3421
3422
        $urlAliasService->createGlobalUrlAlias(
3423
            $resource,
3424
            'path',
3425
            'languageCode',
3426
            'forwarding',
3427
            'alwaysAvailable'
3428
        );
3429
    }
3430
3431
    /**
3432
     * Test for the createGlobalUrlAlias() method.