Code Duplication    Length = 42-42 lines in 2 locations

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

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