Code Duplication    Length = 39-39 lines in 2 locations

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

@@ 3175-3213 (lines=39) @@
3172
    /**
3173
     * Test for the createUrlAlias() method.
3174
     */
3175
    public function testCreateUrlAlias()
3176
    {
3177
        $repositoryMock = $this->getRepositoryMock();
3178
        $mockedService = $this->getPartlyMockedURLAliasServiceService();
3179
        /** @var \PHPUnit_Framework_MockObject_MockObject $urlAliasHandlerMock */
3180
        $urlAliasHandlerMock = $this->getPersistenceMock()->urlAliasHandler();
3181
        $location = $this->getLocationStub();
3182
3183
        $repositoryMock
3184
            ->expects($this->once())
3185
            ->method('beginTransaction');
3186
        $repositoryMock
3187
            ->expects($this->once())
3188
            ->method('commit');
3189
3190
        $urlAliasHandlerMock->expects(
3191
            $this->once()
3192
        )->method(
3193
            'createCustomUrlAlias'
3194
        )->with(
3195
            $this->equalTo($location->id),
3196
            $this->equalTo('path'),
3197
            $this->equalTo('forwarding'),
3198
            $this->equalTo('languageCode'),
3199
            $this->equalTo('alwaysAvailable')
3200
        )->will(
3201
            $this->returnValue(new SPIUrlAlias())
3202
        );
3203
3204
        $urlAlias = $mockedService->createUrlAlias(
3205
            $location,
3206
            'path',
3207
            'languageCode',
3208
            'forwarding',
3209
            'alwaysAvailable'
3210
        );
3211
3212
        self::assertInstanceOf(URLAlias::class, $urlAlias);
3213
    }
3214
3215
    /**
3216
     * Test for the createUrlAlias() method.
@@ 3296-3334 (lines=39) @@
3293
    /**
3294
     * Test for the createGlobalUrlAlias() method.
3295
     */
3296
    public function testCreateGlobalUrlAlias()
3297
    {
3298
        $resource = 'module:content/search';
3299
        $repositoryMock = $this->getRepositoryMock();
3300
        $mockedService = $this->getPartlyMockedURLAliasServiceService();
3301
        /** @var \PHPUnit_Framework_MockObject_MockObject $urlAliasHandlerMock */
3302
        $urlAliasHandlerMock = $this->getPersistenceMock()->urlAliasHandler();
3303
3304
        $repositoryMock
3305
            ->expects($this->once())
3306
            ->method('beginTransaction');
3307
        $repositoryMock
3308
            ->expects($this->once())
3309
            ->method('commit');
3310
3311
        $urlAliasHandlerMock->expects(
3312
            $this->once()
3313
        )->method(
3314
            'createGlobalUrlAlias'
3315
        )->with(
3316
            $this->equalTo($resource),
3317
            $this->equalTo('path'),
3318
            $this->equalTo('forwarding'),
3319
            $this->equalTo('languageCode'),
3320
            $this->equalTo('alwaysAvailable')
3321
        )->will(
3322
            $this->returnValue(new SPIUrlAlias())
3323
        );
3324
3325
        $urlAlias = $mockedService->createGlobalUrlAlias(
3326
            $resource,
3327
            'path',
3328
            'languageCode',
3329
            'forwarding',
3330
            'alwaysAvailable'
3331
        );
3332
3333
        self::assertInstanceOf(URLAlias::class, $urlAlias);
3334
    }
3335
3336
    /**
3337
     * Test for the createGlobalUrlAlias() method.