Completed
Push — master ( 74c3c7...591b88 )
by Eric
08:09
created

testRepository()   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 36
Code Lines 27

Duplication

Lines 36
Ratio 100 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 36
loc 36
rs 8.8571
cc 1
eloc 27
nc 1
nop 0
1
<?php
2
3
/*
4
 * This file is part of the Lug package.
5
 *
6
 * (c) Eric GELOEN <[email protected]>
7
 *
8
 * For the full copyright and license information, please read the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Lug\Component\Translation\Tests\Repository\Doctrine\ORM;
13
14
use Doctrine\ORM\Configuration;
15
use Doctrine\ORM\EntityManagerInterface;
16
use Doctrine\ORM\EntityRepository;
17
use Doctrine\ORM\Mapping\ClassMetadata;
18
use Lug\Component\Registry\Model\RegistryInterface;
19
use Lug\Component\Resource\Model\ResourceInterface;
20
use Lug\Component\Resource\Repository\Doctrine\ORM\Repository;
21
use Lug\Component\Resource\Repository\Doctrine\ORM\RepositoryFactory;
22
use Lug\Component\Translation\Context\LocaleContextInterface;
23
use Lug\Component\Translation\Repository\Doctrine\ORM\TranslatableRepository;
24
use Lug\Component\Translation\Repository\Doctrine\ORM\TranslatableRepositoryFactory;
25
use Symfony\Component\DependencyInjection\ContainerInterface;
26
27
/**
28
 * @author GeLo <[email protected]>
29
 */
30
class TranslatableRepositoryFactoryTest extends \PHPUnit_Framework_TestCase
31
{
32
    /**
33
     * @var TranslatableRepositoryFactory
34
     */
35
    private $repositoryFactory;
36
37
    /**
38
     * @var \PHPUnit_Framework_MockObject_MockObject|ContainerInterface
39
     */
40
    private $container;
41
42
    /**
43
     * @var \PHPUnit_Framework_MockObject_MockObject|RegistryInterface
44
     */
45
    private $resourceRegistry;
46
47
    /**
48
     * @var \PHPUnit_Framework_MockObject_MockObject|LocaleContextInterface
49
     */
50
    private $localeContext;
51
52
    /**
53
     * {@inheritdoc}
54
     */
55 View Code Duplication
    protected function setUp()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
56
    {
57
        $this->resourceRegistry = $this->createServiceRegistryMock();
0 ignored issues
show
Documentation Bug introduced by
It seems like $this->createServiceRegistryMock() can also be of type object<Lug\Component\Reg...odel\RegistryInterface>. However, the property $resourceRegistry is declared as type object<PHPUnit_Framework_MockObject_MockObject>. Maybe add an additional type check?

Our type inference engine has found a suspicous assignment of a value to a property. This check raises an issue when a value that can be of a mixed type is assigned to a property that is type hinted more strictly.

For example, imagine you have a variable $accountId that can either hold an Id object or false (if there is no account id yet). Your code now assigns that value to the id property of an instance of the Account class. This class holds a proper account, so the id value must no longer be false.

Either this assignment is in error or a type check should be added for that assignment.

class Id
{
    public $id;

    public function __construct($id)
    {
        $this->id = $id;
    }

}

class Account
{
    /** @var  Id $id */
    public $id;
}

$account_id = false;

if (starsAreRight()) {
    $account_id = new Id(42);
}

$account = new Account();
if ($account instanceof Id)
{
    $account->id = $account_id;
}
Loading history...
58
        $this->localeContext = $this->createLocaleContextMock();
0 ignored issues
show
Documentation Bug introduced by
It seems like $this->createLocaleContextMock() can also be of type object<Lug\Component\Tra...LocaleContextInterface>. However, the property $localeContext is declared as type object<PHPUnit_Framework_MockObject_MockObject>. Maybe add an additional type check?

Our type inference engine has found a suspicous assignment of a value to a property. This check raises an issue when a value that can be of a mixed type is assigned to a property that is type hinted more strictly.

For example, imagine you have a variable $accountId that can either hold an Id object or false (if there is no account id yet). Your code now assigns that value to the id property of an instance of the Account class. This class holds a proper account, so the id value must no longer be false.

Either this assignment is in error or a type check should be added for that assignment.

class Id
{
    public $id;

    public function __construct($id)
    {
        $this->id = $id;
    }

}

class Account
{
    /** @var  Id $id */
    public $id;
}

$account_id = false;

if (starsAreRight()) {
    $account_id = new Id(42);
}

$account = new Account();
if ($account instanceof Id)
{
    $account->id = $account_id;
}
Loading history...
59
60
        $this->container = $this->createContainerMock();
61
        $this->container
0 ignored issues
show
Bug introduced by
The method expects does only exist in PHPUnit_Framework_MockObject_MockObject, but not in Symfony\Component\Depend...tion\ContainerInterface.

It seems like the method you are trying to call exists only in some of the possible types.

Let’s take a look at an example:

class A
{
    public function foo() { }
}

class B extends A
{
    public function bar() { }
}

/**
 * @param A|B $x
 */
function someFunction($x)
{
    $x->foo(); // This call is fine as the method exists in A and B.
    $x->bar(); // This method only exists in B and might cause an error.
}

Available Fixes

  1. Add an additional type-check:

    /**
     * @param A|B $x
     */
    function someFunction($x)
    {
        $x->foo();
    
        if ($x instanceof B) {
            $x->bar();
        }
    }
    
  2. Only allow a single type to be passed if the variable comes from a parameter:

    function someFunction(B $x) { /** ... */ }
    
Loading history...
62
            ->expects($this->atLeast(1))
63
            ->method('get')
64
            ->will($this->returnValueMap([
65
                [
66
                    'lug.resource.registry',
67
                    ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE,
68
                    $this->resourceRegistry,
69
                ],
70
                [
71
                    'lug.translation.context.locale',
72
                    ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE,
73
                    $this->localeContext,
74
                ],
75
            ]));
76
77
        $this->repositoryFactory = new TranslatableRepositoryFactory($this->container);
78
    }
79
80
    public function testInheritance()
81
    {
82
        $this->assertInstanceOf(RepositoryFactory::class, $this->repositoryFactory);
83
    }
84
85 View Code Duplication
    public function testRepository()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
86
    {
87
        $entityManager = $this->createEntityManagerMock();
88
        $entityManager
0 ignored issues
show
Bug introduced by
The method expects does only exist in PHPUnit_Framework_MockObject_MockObject, but not in Doctrine\ORM\EntityManagerInterface.

It seems like the method you are trying to call exists only in some of the possible types.

Let’s take a look at an example:

class A
{
    public function foo() { }
}

class B extends A
{
    public function bar() { }
}

/**
 * @param A|B $x
 */
function someFunction($x)
{
    $x->foo(); // This call is fine as the method exists in A and B.
    $x->bar(); // This method only exists in B and might cause an error.
}

Available Fixes

  1. Add an additional type-check:

    /**
     * @param A|B $x
     */
    function someFunction($x)
    {
        $x->foo();
    
        if ($x instanceof B) {
            $x->bar();
        }
    }
    
  2. Only allow a single type to be passed if the variable comes from a parameter:

    function someFunction(B $x) { /** ... */ }
    
Loading history...
89
            ->expects($this->exactly(3))
90
            ->method('getClassMetadata')
91
            ->with($this->identicalTo($entityName = 'entity'))
92
            ->will($this->returnValue($classMetadata = $this->createClassMetadataMock()));
93
94
        $entityManager
95
            ->expects($this->once())
96
            ->method('getConfiguration')
97
            ->will($this->returnValue($configuration = $this->createConfigurationMock()));
98
99
        $configuration
0 ignored issues
show
Bug introduced by
The method expects does only exist in PHPUnit_Framework_MockObject_MockObject, but not in Doctrine\ORM\Configuration.

It seems like the method you are trying to call exists only in some of the possible types.

Let’s take a look at an example:

class A
{
    public function foo() { }
}

class B extends A
{
    public function bar() { }
}

/**
 * @param A|B $x
 */
function someFunction($x)
{
    $x->foo(); // This call is fine as the method exists in A and B.
    $x->bar(); // This method only exists in B and might cause an error.
}

Available Fixes

  1. Add an additional type-check:

    /**
     * @param A|B $x
     */
    function someFunction($x)
    {
        $x->foo();
    
        if ($x instanceof B) {
            $x->bar();
        }
    }
    
  2. Only allow a single type to be passed if the variable comes from a parameter:

    function someFunction(B $x) { /** ... */ }
    
Loading history...
100
            ->expects($this->once())
101
            ->method('getDefaultRepositoryClassName')
102
            ->will($this->returnValue($repositoryClass = EntityRepository::class));
103
104
        $classMetadata
0 ignored issues
show
Bug introduced by
The method expects does only exist in PHPUnit_Framework_MockObject_MockObject, but not in Doctrine\ORM\Mapping\ClassMetadata.

It seems like the method you are trying to call exists only in some of the possible types.

Let’s take a look at an example:

class A
{
    public function foo() { }
}

class B extends A
{
    public function bar() { }
}

/**
 * @param A|B $x
 */
function someFunction($x)
{
    $x->foo(); // This call is fine as the method exists in A and B.
    $x->bar(); // This method only exists in B and might cause an error.
}

Available Fixes

  1. Add an additional type-check:

    /**
     * @param A|B $x
     */
    function someFunction($x)
    {
        $x->foo();
    
        if ($x instanceof B) {
            $x->bar();
        }
    }
    
  2. Only allow a single type to be passed if the variable comes from a parameter:

    function someFunction(B $x) { /** ... */ }
    
Loading history...
105
            ->expects($this->exactly(3))
106
            ->method('getName')
107
            ->will($this->returnValue($model = 'name'));
108
109
        $this->resourceRegistry
110
            ->expects($this->once())
111
            ->method('getIterator')
112
            ->will($this->returnValue(new \ArrayIterator([])));
113
114
        $this->assertInstanceOf(
115
            $repositoryClass,
116
            $repository = $this->repositoryFactory->getRepository($entityManager, $entityName)
0 ignored issues
show
Bug introduced by
It seems like $entityManager defined by $this->createEntityManagerMock() on line 87 can also be of type object<PHPUnit_Framework_MockObject_MockObject>; however, Lug\Component\Resource\R...actory::getRepository() does only seem to accept object<Doctrine\ORM\EntityManagerInterface>, maybe add an additional type check?

If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:

/**
 * @return array|string
 */
function returnsDifferentValues($x) {
    if ($x) {
        return 'foo';
    }

    return array();
}

$x = returnsDifferentValues($y);
if (is_array($x)) {
    // $x is an array.
}

If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.

Loading history...
117
        );
118
119
        $this->assertSame($repository, $this->repositoryFactory->getRepository($entityManager, $entityName));
0 ignored issues
show
Bug introduced by
It seems like $entityManager defined by $this->createEntityManagerMock() on line 87 can also be of type object<PHPUnit_Framework_MockObject_MockObject>; however, Lug\Component\Resource\R...actory::getRepository() does only seem to accept object<Doctrine\ORM\EntityManagerInterface>, maybe add an additional type check?

If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:

/**
 * @return array|string
 */
function returnsDifferentValues($x) {
    if ($x) {
        return 'foo';
    }

    return array();
}

$x = returnsDifferentValues($y);
if (is_array($x)) {
    // $x is an array.
}

If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.

Loading history...
120
    }
121
122 View Code Duplication
    public function testResourceRepository()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
123
    {
124
        $entityManager = $this->createEntityManagerMock();
125
        $entityManager
0 ignored issues
show
Bug introduced by
The method expects does only exist in PHPUnit_Framework_MockObject_MockObject, but not in Doctrine\ORM\EntityManagerInterface.

It seems like the method you are trying to call exists only in some of the possible types.

Let’s take a look at an example:

class A
{
    public function foo() { }
}

class B extends A
{
    public function bar() { }
}

/**
 * @param A|B $x
 */
function someFunction($x)
{
    $x->foo(); // This call is fine as the method exists in A and B.
    $x->bar(); // This method only exists in B and might cause an error.
}

Available Fixes

  1. Add an additional type-check:

    /**
     * @param A|B $x
     */
    function someFunction($x)
    {
        $x->foo();
    
        if ($x instanceof B) {
            $x->bar();
        }
    }
    
  2. Only allow a single type to be passed if the variable comes from a parameter:

    function someFunction(B $x) { /** ... */ }
    
Loading history...
126
            ->expects($this->exactly(3))
127
            ->method('getClassMetadata')
128
            ->with($this->identicalTo($entityName = 'entity'))
129
            ->will($this->returnValue($classMetadata = $this->createClassMetadataMock()));
130
131
        $classMetadata
0 ignored issues
show
Bug introduced by
The method expects does only exist in PHPUnit_Framework_MockObject_MockObject, but not in Doctrine\ORM\Mapping\ClassMetadata.

It seems like the method you are trying to call exists only in some of the possible types.

Let’s take a look at an example:

class A
{
    public function foo() { }
}

class B extends A
{
    public function bar() { }
}

/**
 * @param A|B $x
 */
function someFunction($x)
{
    $x->foo(); // This call is fine as the method exists in A and B.
    $x->bar(); // This method only exists in B and might cause an error.
}

Available Fixes

  1. Add an additional type-check:

    /**
     * @param A|B $x
     */
    function someFunction($x)
    {
        $x->foo();
    
        if ($x instanceof B) {
            $x->bar();
        }
    }
    
  2. Only allow a single type to be passed if the variable comes from a parameter:

    function someFunction(B $x) { /** ... */ }
    
Loading history...
132
            ->expects($this->exactly(3))
133
            ->method('getName')
134
            ->will($this->returnValue($model = 'name'));
135
136
        $this->resourceRegistry
137
            ->expects($this->once())
138
            ->method('getIterator')
139
            ->will($this->returnValue(new \ArrayIterator([$resource = $this->createResourceMock()])));
140
141
        $resource
0 ignored issues
show
Bug introduced by
The method expects does only exist in PHPUnit_Framework_MockObject_MockObject, but not in Lug\Component\Resource\Model\ResourceInterface.

It seems like the method you are trying to call exists only in some of the possible types.

Let’s take a look at an example:

class A
{
    public function foo() { }
}

class B extends A
{
    public function bar() { }
}

/**
 * @param A|B $x
 */
function someFunction($x)
{
    $x->foo(); // This call is fine as the method exists in A and B.
    $x->bar(); // This method only exists in B and might cause an error.
}

Available Fixes

  1. Add an additional type-check:

    /**
     * @param A|B $x
     */
    function someFunction($x)
    {
        $x->foo();
    
        if ($x instanceof B) {
            $x->bar();
        }
    }
    
  2. Only allow a single type to be passed if the variable comes from a parameter:

    function someFunction(B $x) { /** ... */ }
    
Loading history...
142
            ->expects($this->once())
143
            ->method('getModel')
144
            ->will($this->returnValue($model));
145
146
        $classMetadata->customRepositoryClassName = $repositoryClass = Repository::class;
147
148
        $this->assertInstanceOf(
149
            $repositoryClass,
150
            $repository = $this->repositoryFactory->getRepository($entityManager, $entityName)
0 ignored issues
show
Bug introduced by
It seems like $entityManager defined by $this->createEntityManagerMock() on line 124 can also be of type object<PHPUnit_Framework_MockObject_MockObject>; however, Lug\Component\Resource\R...actory::getRepository() does only seem to accept object<Doctrine\ORM\EntityManagerInterface>, maybe add an additional type check?

If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:

/**
 * @return array|string
 */
function returnsDifferentValues($x) {
    if ($x) {
        return 'foo';
    }

    return array();
}

$x = returnsDifferentValues($y);
if (is_array($x)) {
    // $x is an array.
}

If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.

Loading history...
151
        );
152
153
        $this->assertSame($repository, $this->repositoryFactory->getRepository($entityManager, $entityName));
0 ignored issues
show
Bug introduced by
It seems like $entityManager defined by $this->createEntityManagerMock() on line 124 can also be of type object<PHPUnit_Framework_MockObject_MockObject>; however, Lug\Component\Resource\R...actory::getRepository() does only seem to accept object<Doctrine\ORM\EntityManagerInterface>, maybe add an additional type check?

If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:

/**
 * @return array|string
 */
function returnsDifferentValues($x) {
    if ($x) {
        return 'foo';
    }

    return array();
}

$x = returnsDifferentValues($y);
if (is_array($x)) {
    // $x is an array.
}

If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.

Loading history...
154
    }
155
156 View Code Duplication
    public function testTranslatableRepository()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
157
    {
158
        $entityManager = $this->createEntityManagerMock();
159
        $entityManager
0 ignored issues
show
Bug introduced by
The method expects does only exist in PHPUnit_Framework_MockObject_MockObject, but not in Doctrine\ORM\EntityManagerInterface.

It seems like the method you are trying to call exists only in some of the possible types.

Let’s take a look at an example:

class A
{
    public function foo() { }
}

class B extends A
{
    public function bar() { }
}

/**
 * @param A|B $x
 */
function someFunction($x)
{
    $x->foo(); // This call is fine as the method exists in A and B.
    $x->bar(); // This method only exists in B and might cause an error.
}

Available Fixes

  1. Add an additional type-check:

    /**
     * @param A|B $x
     */
    function someFunction($x)
    {
        $x->foo();
    
        if ($x instanceof B) {
            $x->bar();
        }
    }
    
  2. Only allow a single type to be passed if the variable comes from a parameter:

    function someFunction(B $x) { /** ... */ }
    
Loading history...
160
            ->expects($this->exactly(3))
161
            ->method('getClassMetadata')
162
            ->with($this->identicalTo($entityName = 'entity'))
163
            ->will($this->returnValue($classMetadata = $this->createClassMetadataMock()));
164
165
        $classMetadata
0 ignored issues
show
Bug introduced by
The method expects does only exist in PHPUnit_Framework_MockObject_MockObject, but not in Doctrine\ORM\Mapping\ClassMetadata.

It seems like the method you are trying to call exists only in some of the possible types.

Let’s take a look at an example:

class A
{
    public function foo() { }
}

class B extends A
{
    public function bar() { }
}

/**
 * @param A|B $x
 */
function someFunction($x)
{
    $x->foo(); // This call is fine as the method exists in A and B.
    $x->bar(); // This method only exists in B and might cause an error.
}

Available Fixes

  1. Add an additional type-check:

    /**
     * @param A|B $x
     */
    function someFunction($x)
    {
        $x->foo();
    
        if ($x instanceof B) {
            $x->bar();
        }
    }
    
  2. Only allow a single type to be passed if the variable comes from a parameter:

    function someFunction(B $x) { /** ... */ }
    
Loading history...
166
            ->expects($this->exactly(3))
167
            ->method('getName')
168
            ->will($this->returnValue($model = 'name'));
169
170
        $this->resourceRegistry
171
            ->expects($this->once())
172
            ->method('getIterator')
173
            ->will($this->returnValue(new \ArrayIterator([$resource = $this->createResourceMock()])));
174
175
        $resource
0 ignored issues
show
Bug introduced by
The method expects does only exist in PHPUnit_Framework_MockObject_MockObject, but not in Lug\Component\Resource\Model\ResourceInterface.

It seems like the method you are trying to call exists only in some of the possible types.

Let’s take a look at an example:

class A
{
    public function foo() { }
}

class B extends A
{
    public function bar() { }
}

/**
 * @param A|B $x
 */
function someFunction($x)
{
    $x->foo(); // This call is fine as the method exists in A and B.
    $x->bar(); // This method only exists in B and might cause an error.
}

Available Fixes

  1. Add an additional type-check:

    /**
     * @param A|B $x
     */
    function someFunction($x)
    {
        $x->foo();
    
        if ($x instanceof B) {
            $x->bar();
        }
    }
    
  2. Only allow a single type to be passed if the variable comes from a parameter:

    function someFunction(B $x) { /** ... */ }
    
Loading history...
176
            ->expects($this->once())
177
            ->method('getModel')
178
            ->will($this->returnValue($model));
179
180
        $classMetadata->customRepositoryClassName = $repositoryClass = TranslatableRepository::class;
181
182
        $this->assertInstanceOf(
183
            $repositoryClass,
184
            $repository = $this->repositoryFactory->getRepository($entityManager, $entityName)
0 ignored issues
show
Bug introduced by
It seems like $entityManager defined by $this->createEntityManagerMock() on line 158 can also be of type object<PHPUnit_Framework_MockObject_MockObject>; however, Lug\Component\Resource\R...actory::getRepository() does only seem to accept object<Doctrine\ORM\EntityManagerInterface>, maybe add an additional type check?

If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:

/**
 * @return array|string
 */
function returnsDifferentValues($x) {
    if ($x) {
        return 'foo';
    }

    return array();
}

$x = returnsDifferentValues($y);
if (is_array($x)) {
    // $x is an array.
}

If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.

Loading history...
185
        );
186
187
        $this->assertSame($repository, $this->repositoryFactory->getRepository($entityManager, $entityName));
0 ignored issues
show
Bug introduced by
It seems like $entityManager defined by $this->createEntityManagerMock() on line 158 can also be of type object<PHPUnit_Framework_MockObject_MockObject>; however, Lug\Component\Resource\R...actory::getRepository() does only seem to accept object<Doctrine\ORM\EntityManagerInterface>, maybe add an additional type check?

If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:

/**
 * @return array|string
 */
function returnsDifferentValues($x) {
    if ($x) {
        return 'foo';
    }

    return array();
}

$x = returnsDifferentValues($y);
if (is_array($x)) {
    // $x is an array.
}

If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.

Loading history...
188
    }
189
190
    /**
191
     * @return \PHPUnit_Framework_MockObject_MockObject|RegistryInterface
192
     */
193
    private function createServiceRegistryMock()
194
    {
195
        return $this->getMock(RegistryInterface::class);
196
    }
197
198
    /**
199
     * @return \PHPUnit_Framework_MockObject_MockObject|ContainerInterface
200
     */
201
    private function createContainerMock()
202
    {
203
        return $this->getMock(ContainerInterface::class);
204
    }
205
206
    /**
207
     * @return \PHPUnit_Framework_MockObject_MockObject|LocaleContextInterface
208
     */
209
    private function createLocaleContextMock()
210
    {
211
        return $this->getMock(LocaleContextInterface::class);
212
    }
213
214
    /**
215
     * @return \PHPUnit_Framework_MockObject_MockObject|EntityManagerInterface
216
     */
217
    private function createEntityManagerMock()
218
    {
219
        return $this->getMock(EntityManagerInterface::class);
220
    }
221
222
    /**
223
     * @return \PHPUnit_Framework_MockObject_MockObject|ClassMetadata
224
     */
225
    private function createClassMetadataMock()
226
    {
227
        return $this->getMockBuilder(ClassMetadata::class)
228
            ->disableOriginalConstructor()
229
            ->getMock();
230
    }
231
232
    /**
233
     * @return \PHPUnit_Framework_MockObject_MockObject|Configuration
234
     */
235
    private function createConfigurationMock()
236
    {
237
        return $this->getMock(Configuration::class);
238
    }
239
240
    /**
241
     * @return \PHPUnit_Framework_MockObject_MockObject|ResourceInterface
242
     */
243
    private function createResourceMock()
244
    {
245
        return $this->getMock(ResourceInterface::class);
246
    }
247
}
248