Code Duplication    Length = 14-21 lines in 7 locations

eZ/Bundle/EzPublishRestBundle/Tests/Routing/OptionsLoaderTest.php 1 location

@@ 62-75 (lines=14) @@
59
     *
60
     * @return OptionsLoader|PHPUnit_Framework_MockObject_MockObject
61
     */
62
    protected function getOptionsLoader()
63
    {
64
        $mock = $this->getMockBuilder('eZ\Bundle\EzPublishRestBundle\Routing\OptionsLoader')
65
            ->setConstructorArgs(array($this->getRouteCollectionMapperMock()))
66
            ->setMethods(array('import'))
67
            ->getMock();
68
69
        $mock->expects($this->any())
70
            ->method('import')
71
            ->with($this->anything(), $this->anything())
72
            ->will($this->returnValue(new RouteCollection()));
73
74
        return $mock;
75
    }
76
77
    /**
78
     * @return PHPUnit_Framework_MockObject_MockObject

eZ/Publish/Core/REST/Server/Tests/Input/Parser/ContentCreateTest.php 1 location

@@ 525-545 (lines=21) @@
522
     *
523
     * @return \eZ\Publish\Core\REST\Common\Input\FieldTypeParser;
524
     */
525
    private function getFieldTypeParserMock()
526
    {
527
        $fieldTypeParserMock = $this->getMockBuilder(FieldTypeParser::class)
528
            ->disableOriginalConstructor()
529
            ->setMethods(array())
530
            ->setConstructorArgs(
531
                array(
532
                    $this->getContentServiceMock(),
533
                    $this->getContentTypeServiceMock(),
534
                    $this->createMock(FieldTypeService::class),
535
                )
536
            )
537
            ->getMock();
538
539
        $fieldTypeParserMock->expects($this->any())
540
            ->method('parseValue')
541
            ->with('ezstring', array())
542
            ->will($this->returnValue('foo'));
543
544
        return $fieldTypeParserMock;
545
    }
546
547
    /**
548
     * Returns the LocationCreate parser mock object.

eZ/Publish/Core/REST/Server/Tests/Input/Parser/UserCreateTest.php 1 location

@@ 455-475 (lines=21) @@
452
     *
453
     * @return \eZ\Publish\Core\REST\Common\Input\FieldTypeParser;
454
     */
455
    private function getFieldTypeParserMock()
456
    {
457
        $fieldTypeParserMock = $this->getMockBuilder(FieldTypeParser::class)
458
            ->setMethods(array())
459
            ->disableOriginalConstructor()
460
            ->setConstructorArgs(
461
                array(
462
                    $this->createMock(ContentService::class),
463
                    $this->getContentTypeServiceMock(),
464
                    $this->createMock(FieldTypeService::class),
465
                )
466
            )
467
            ->getMock();
468
469
        $fieldTypeParserMock->expects($this->any())
470
            ->method('parseValue')
471
            ->with('ezstring', array())
472
            ->will($this->returnValue('foo'));
473
474
        return $fieldTypeParserMock;
475
    }
476
477
    /**
478
     * Get the user service mock object.

eZ/Publish/Core/REST/Server/Tests/Input/Parser/UserGroupCreateTest.php 1 location

@@ 320-340 (lines=21) @@
317
     *
318
     * @return \eZ\Publish\Core\REST\Common\Input\FieldTypeParser;
319
     */
320
    private function getFieldTypeParserMock()
321
    {
322
        $fieldTypeParserMock = $this->getMockBuilder(FieldTypeParser::class)
323
            ->disableOriginalConstructor()
324
            ->setMethods(array())
325
            ->setConstructorArgs(
326
                array(
327
                    $this->createMock(ContentService::class),
328
                    $this->getContentTypeServiceMock(),
329
                    $this->createMock(FieldTypeService::class),
330
                )
331
            )
332
            ->getMock();
333
334
        $fieldTypeParserMock->expects($this->any())
335
            ->method('parseValue')
336
            ->with('ezstring', array())
337
            ->will($this->returnValue('foo'));
338
339
        return $fieldTypeParserMock;
340
    }
341
342
    /**
343
     * Get the user service mock object.

eZ/Publish/Core/REST/Server/Tests/Input/Parser/UserGroupUpdateTest.php 1 location

@@ 222-242 (lines=21) @@
219
     *
220
     * @return \eZ\Publish\Core\REST\Common\Input\FieldTypeParser;
221
     */
222
    private function getFieldTypeParserMock()
223
    {
224
        $fieldTypeParserMock = $this->getMockBuilder(FieldTypeParser::class)
225
            ->disableOriginalConstructor()
226
            ->setMethods(array())
227
            ->setConstructorArgs(
228
                array(
229
                    $this->getContentServiceMock(),
230
                    $this->createMock(ContentTypeService::class),
231
                    $this->createMock(FieldTypeService::class),
232
                )
233
            )
234
            ->getMock();
235
236
        $fieldTypeParserMock->expects($this->any())
237
            ->method('parseFieldValue')
238
            ->with(4, 'name', array())
239
            ->will($this->returnValue('foo'));
240
241
        return $fieldTypeParserMock;
242
    }
243
244
    /**
245
     * Get the user service mock object.

eZ/Publish/Core/REST/Server/Tests/Input/Parser/UserUpdateTest.php 1 location

@@ 252-272 (lines=21) @@
249
     *
250
     * @return \eZ\Publish\Core\REST\Common\Input\FieldTypeParser;
251
     */
252
    private function getFieldTypeParserMock()
253
    {
254
        $fieldTypeParserMock = $this->getMockBuilder(FieldTypeParser::class)
255
            ->setMethods(array())
256
            ->disableOriginalConstructor()
257
            ->setConstructorArgs(
258
                array(
259
                    $this->getContentServiceMock(),
260
                    $this->createMock(ContentTypeService::class),
261
                    $this->createMock(FieldTypeService::class),
262
                )
263
            )
264
            ->getMock();
265
266
        $fieldTypeParserMock->expects($this->any())
267
            ->method('parseFieldValue')
268
            ->with(14, 'first_name', array())
269
            ->will($this->returnValue('foo'));
270
271
        return $fieldTypeParserMock;
272
    }
273
274
    /**
275
     * Get the user service mock object.

eZ/Publish/Core/REST/Server/Tests/Input/Parser/VersionUpdateTest.php 1 location

@@ 146-166 (lines=21) @@
143
     *
144
     * @return \eZ\Publish\Core\REST\Common\Input\FieldTypeParser;
145
     */
146
    private function getFieldTypeParserMock()
147
    {
148
        $fieldTypeParserMock = $this->getMockBuilder(FieldTypeParser::class)
149
            ->setMethods(array())
150
            ->disableOriginalConstructor()
151
            ->setConstructorArgs(
152
                array(
153
                    $this->getContentServiceMock(),
154
                    $this->createMock(ContentTypeService::class),
155
                    $this->createMock(FieldTypeService::class),
156
                )
157
            )
158
            ->getMock();
159
160
        $fieldTypeParserMock->expects($this->any())
161
            ->method('parseFieldValue')
162
            ->with(42, 'subject', array())
163
            ->will($this->returnValue('foo'));
164
165
        return $fieldTypeParserMock;
166
    }
167
168
    /**
169
     * Get the Content service mock object.