Code Duplication    Length = 42-42 lines in 2 locations

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

@@ 3189-3230 (lines=42) @@
3186
    /**
3187
     * Test for the createUrlAlias() method.
3188
     */
3189
    public function testCreateUrlAlias()
3190
    {
3191
        $repositoryMock = $this->getRepositoryMock();
3192
        $mockedService = $this->getPartlyMockedURLAliasServiceService();
3193
        /** @var \PHPUnit_Framework_MockObject_MockObject $urlAliasHandlerMock */
3194
        $urlAliasHandlerMock = $this->getPersistenceMock()->urlAliasHandler();
3195
        $location = $this->getLocationStub();
3196
3197
        $repositoryMock
3198
            ->expects($this->once())
3199
            ->method('beginTransaction');
3200
        $repositoryMock
3201
            ->expects($this->once())
3202
            ->method('commit');
3203
3204
        $urlAliasHandlerMock->expects(
3205
            $this->once()
3206
        )->method(
3207
            'createCustomUrlAlias'
3208
        )->with(
3209
            $this->equalTo($location->id),
3210
            $this->equalTo('path'),
3211
            $this->equalTo('forwarding'),
3212
            $this->equalTo('languageCode'),
3213
            $this->equalTo('alwaysAvailable')
3214
        )->will(
3215
            $this->returnValue(new SPIUrlAlias())
3216
        );
3217
3218
        $urlAlias = $mockedService->createUrlAlias(
3219
            $location,
3220
            'path',
3221
            'languageCode',
3222
            'forwarding',
3223
            'alwaysAvailable'
3224
        );
3225
3226
        self::assertInstanceOf(
3227
            'eZ\\Publish\\API\\Repository\\Values\\Content\\URLAlias',
3228
            $urlAlias
3229
        );
3230
    }
3231
3232
    /**
3233
     * Test for the createUrlAlias() method.
@@ 3313-3354 (lines=42) @@
3310
    /**
3311
     * Test for the createGlobalUrlAlias() method.
3312
     */
3313
    public function testCreateGlobalUrlAlias()
3314
    {
3315
        $resource = 'module:content/search';
3316
        $repositoryMock = $this->getRepositoryMock();
3317
        $mockedService = $this->getPartlyMockedURLAliasServiceService();
3318
        /** @var \PHPUnit_Framework_MockObject_MockObject $urlAliasHandlerMock */
3319
        $urlAliasHandlerMock = $this->getPersistenceMock()->urlAliasHandler();
3320
3321
        $repositoryMock
3322
            ->expects($this->once())
3323
            ->method('beginTransaction');
3324
        $repositoryMock
3325
            ->expects($this->once())
3326
            ->method('commit');
3327
3328
        $urlAliasHandlerMock->expects(
3329
            $this->once()
3330
        )->method(
3331
            'createGlobalUrlAlias'
3332
        )->with(
3333
            $this->equalTo($resource),
3334
            $this->equalTo('path'),
3335
            $this->equalTo('forwarding'),
3336
            $this->equalTo('languageCode'),
3337
            $this->equalTo('alwaysAvailable')
3338
        )->will(
3339
            $this->returnValue(new SPIUrlAlias())
3340
        );
3341
3342
        $urlAlias = $mockedService->createGlobalUrlAlias(
3343
            $resource,
3344
            'path',
3345
            'languageCode',
3346
            'forwarding',
3347
            'alwaysAvailable'
3348
        );
3349
3350
        self::assertInstanceOf(
3351
            'eZ\\Publish\\API\\Repository\\Values\\Content\\URLAlias',
3352
            $urlAlias
3353
        );
3354
    }
3355
3356
    /**
3357
     * Test for the createGlobalUrlAlias() method.