Completed
Push — master ( 635b00...c497e6 )
by André
79:58 queued 63:10
created

PHPUnit5CompatTrait::createMock()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 6
nc 1
nop 1
dl 0
loc 9
rs 9.6666
c 0
b 0
f 0
1
<?php
2
/**
3
 * File containing PHPUnit 5 Forward Compatibility trait.
4
 *
5
 * @copyright Copyright (C) eZ Systems AS. All rights reserved.
6
 * @license For full copyright and license information view LICENSE file distributed with this source code.
7
 */
8
namespace eZ\Publish\Core\Base\Tests;
9
10
/**
11
 * Trait for PHPUnit 5 Forward Compatibility, for PHPUnit 4.8 use and up.
12
 */
13
trait PHPUnit5CompatTrait
14
{
15
    /**
16
     * @deprecated Since PHPUnit 5.4, marked as deprecated here to make it clear when working on 6.7/5.4 branches
17
     * {@inheritdoc}
18
     */
19
    public function getMock($originalClassName, $methods = array(), array $arguments = array(), $mockClassName = '', $callOriginalConstructor = true, $callOriginalClone = true, $callAutoload = true, $cloneArguments = false, $callOriginalMethods = false, $proxyTarget = null)
20
    {
21
        return parent::getMock(
22
            $originalClassName,
23
            $methods,
24
            $arguments,
25
            $mockClassName,
26
            $callOriginalConstructor,
27
            $callOriginalClone,
28
            $callAutoload,
29
            $cloneArguments,
30
            $callOriginalMethods,
31
            $proxyTarget
32
        );
33
    }
34
35
    /**
36
     * Returns a test double for the specified class.
37
     *
38
     * @internal Forward compatibility with PHPUnit 5/6, so unit tests written on 6.7 & backported to 5.4 can use this.
39
     *
40
     * @param string $originalClassName
41
     *
42
     * @return \PHPUnit_Framework_MockObject_MockObject
43
     */
44
    protected function createMock($originalClassName)
45
    {
46
        return $this->getMockBuilder($originalClassName)
0 ignored issues
show
Bug introduced by
The method getMockBuilder() does not exist on eZ\Publish\Core\Base\Tests\PHPUnit5CompatTrait. Did you maybe mean getMock()?

This check marks calls to methods that do not seem to exist on an object.

This is most likely the result of a method being renamed without all references to it being renamed likewise.

Loading history...
47
            ->disableOriginalConstructor()
48
            ->disableOriginalClone()
49
            ->disableArgumentCloning()
50
            //->disallowMockingUnknownTypes() Not defined in PHPunit 4.8
51
            ->getMock();
52
    }
53
}
54