Failed Conditions
Pull Request — develop (#6873)
by
unknown
112:44 queued 47:41
created

testBuildCachedCollectionPersisterException()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 15
Code Lines 9

Duplication

Lines 15
Ratio 100 %

Importance

Changes 0
Metric Value
cc 1
eloc 9
nc 1
nop 0
dl 15
loc 15
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Doctrine\Tests\ORM\Cache;
6
7
use Doctrine\Common\Cache\Cache;
8
use Doctrine\Common\Cache\CacheProvider;
9
use Doctrine\ORM\Cache\CacheFactory;
10
use Doctrine\ORM\Cache\DefaultCacheFactory;
11
use Doctrine\ORM\Cache\Persister\Collection\CachedCollectionPersister;
12
use Doctrine\ORM\Cache\Persister\Collection\NonStrictReadWriteCachedCollectionPersister;
13
use Doctrine\ORM\Cache\Persister\Collection\ReadOnlyCachedCollectionPersister;
14
use Doctrine\ORM\Cache\Persister\Collection\ReadWriteCachedCollectionPersister;
15
use Doctrine\ORM\Cache\Persister\Entity\CachedEntityPersister;
16
use Doctrine\ORM\Cache\Persister\Entity\NonStrictReadWriteCachedEntityPersister;
17
use Doctrine\ORM\Cache\Persister\Entity\ReadOnlyCachedEntityPersister;
18
use Doctrine\ORM\Cache\Persister\Entity\ReadWriteCachedEntityPersister;
19
use Doctrine\ORM\Cache\Region\DefaultMultiGetRegion;
20
use Doctrine\ORM\Cache\Region\DefaultRegion;
21
use Doctrine\ORM\Cache\RegionsConfiguration;
22
use Doctrine\ORM\Mapping\CacheMetadata;
23
use Doctrine\ORM\Mapping\CacheUsage;
24
use Doctrine\ORM\Persisters\Collection\OneToManyPersister;
25
use Doctrine\ORM\Persisters\Entity\BasicEntityPersister;
0 ignored issues
show
Bug introduced by
The type Doctrine\ORM\Persisters\...ty\BasicEntityPersister was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
26
use Doctrine\Tests\Mocks\ConcurrentRegionMock;
27
use Doctrine\Tests\Models\Cache\AttractionContactInfo;
28
use Doctrine\Tests\Models\Cache\AttractionLocationInfo;
29
use Doctrine\Tests\Models\Cache\City;
30
use Doctrine\Tests\Models\Cache\State;
31
use Doctrine\Tests\OrmTestCase;
32
33
/**
34
 * @group DDC-2183
35
 */
36
class DefaultCacheFactoryTest extends OrmTestCase
37
{
38
    /**
39
     * @var \Doctrine\ORM\Cache\CacheFactory
40
     */
41
    private $factory;
42
43
    /**
44
     * @var \Doctrine\ORM\EntityManagerInterface
45
     */
46
    private $em;
47
48
    /**
49
     * @var \Doctrine\ORM\Cache\RegionsConfiguration
50
     */
51
    private $regionsConfig;
52
53
    protected function setUp()
54
    {
55
        $this->enableSecondLevelCache();
56
57
        parent::setUp();
58
59
        $this->em            = $this->getTestEntityManager();
60
        $this->regionsConfig = new RegionsConfiguration;
61
62
        $arguments = [
63
            $this->regionsConfig,
64
            $this->getSharedSecondLevelCacheDriverImpl()
65
        ];
66
67
        $this->factory = $this->getMockBuilder(DefaultCacheFactory::class)
1 ignored issue
show
Documentation Bug introduced by
It seems like $this->getMockBuilder(Do...($arguments)->getMock() of type PHPUnit\Framework\MockObject\MockObject is incompatible with the declared type Doctrine\ORM\Cache\CacheFactory of property $factory.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
68
            ->setMethods(['getRegion'])
69
            ->setConstructorArgs($arguments)
70
            ->getMock()
71
        ;
72
    }
73
74
    public function testImplementsCacheFactory()
75
    {
76
        self::assertInstanceOf(CacheFactory::class, $this->factory);
77
    }
78
79
    public function testBuildCachedEntityPersisterReadOnly()
80
    {
81
        $em         = $this->em;
82
        $metadata   = clone $em->getClassMetadata(State::class);
83
        $persister  = new BasicEntityPersister($em, $metadata);
84
        $region     = new ConcurrentRegionMock(
85
            new DefaultRegion('regionName', $this->getSharedSecondLevelCacheDriverImpl())
86
        );
87
88
        $metadata->setCache(
0 ignored issues
show
Bug introduced by
The method setCache() does not exist on Doctrine\Common\Persistence\Mapping\ClassMetadata. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

88
        $metadata->/** @scrutinizer ignore-call */ 
89
                   setCache(

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
89
            new CacheMetadata(CacheUsage::READ_ONLY, 'doctrine_tests_models_cache_state')
90
        );
91
92
        $this->factory->expects($this->once())
1 ignored issue
show
Bug introduced by
The method expects() does not exist on Doctrine\ORM\Cache\CacheFactory. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

92
        $this->factory->/** @scrutinizer ignore-call */ 
93
                        expects($this->once())

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
93
            ->method('getRegion')
94
            ->with($this->equalTo($metadata->getCache()))
0 ignored issues
show
Bug introduced by
The method getCache() does not exist on Doctrine\Common\Persistence\Mapping\ClassMetadata. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

94
            ->with($this->equalTo($metadata->/** @scrutinizer ignore-call */ getCache()))

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
95
            ->will($this->returnValue($region));
96
97
        $cachedPersister = $this->factory->buildCachedEntityPersister($em, $persister, $metadata);
0 ignored issues
show
Bug introduced by
$metadata of type Doctrine\Common\Persistence\Mapping\ClassMetadata is incompatible with the type Doctrine\ORM\Mapping\ClassMetadata expected by parameter $metadata of Doctrine\ORM\Cache\Cache...CachedEntityPersister(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

97
        $cachedPersister = $this->factory->buildCachedEntityPersister($em, $persister, /** @scrutinizer ignore-type */ $metadata);
Loading history...
98
99
        self::assertInstanceOf(CachedEntityPersister::class, $cachedPersister);
100
        self::assertInstanceOf(ReadOnlyCachedEntityPersister::class, $cachedPersister);
101
    }
102
103
    public function testBuildCachedEntityPersisterReadWrite()
104
    {
105
        $em        = $this->em;
106
        $metadata  = clone $em->getClassMetadata(State::class);
107
        $persister = new BasicEntityPersister($em, $metadata);
108
        $region    = new ConcurrentRegionMock(
109
            new DefaultRegion('regionName', $this->getSharedSecondLevelCacheDriverImpl())
110
        );
111
112
        $metadata->setCache(
113
            new CacheMetadata(CacheUsage::READ_WRITE, 'doctrine_tests_models_cache_state')
114
        );
115
116
        $this->factory->expects($this->once())
117
            ->method('getRegion')
118
            ->with($this->equalTo($metadata->getCache()))
119
            ->will($this->returnValue($region));
120
121
        $cachedPersister = $this->factory->buildCachedEntityPersister($em, $persister, $metadata);
0 ignored issues
show
Bug introduced by
$metadata of type Doctrine\Common\Persistence\Mapping\ClassMetadata is incompatible with the type Doctrine\ORM\Mapping\ClassMetadata expected by parameter $metadata of Doctrine\ORM\Cache\Cache...CachedEntityPersister(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

121
        $cachedPersister = $this->factory->buildCachedEntityPersister($em, $persister, /** @scrutinizer ignore-type */ $metadata);
Loading history...
122
123
        self::assertInstanceOf(CachedEntityPersister::class, $cachedPersister);
124
        self::assertInstanceOf(ReadWriteCachedEntityPersister::class, $cachedPersister);
125
    }
126
127
    public function testBuildCachedEntityPersisterNonStrictReadWrite()
128
    {
129
        $em         = $this->em;
130
        $metadata   = clone $em->getClassMetadata(State::class);
131
        $persister  = new BasicEntityPersister($em, $metadata);
132
        $region     = new ConcurrentRegionMock(
133
            new DefaultRegion('regionName', $this->getSharedSecondLevelCacheDriverImpl())
134
        );
135
136
        $metadata->setCache(
137
            new CacheMetadata(CacheUsage::NONSTRICT_READ_WRITE, 'doctrine_tests_models_cache_state')
138
        );
139
140
        $this->factory->expects($this->once())
141
            ->method('getRegion')
142
            ->with($this->equalTo($metadata->getCache()))
143
            ->will($this->returnValue($region));
144
145
        $cachedPersister = $this->factory->buildCachedEntityPersister($em, $persister, $metadata);
0 ignored issues
show
Bug introduced by
$metadata of type Doctrine\Common\Persistence\Mapping\ClassMetadata is incompatible with the type Doctrine\ORM\Mapping\ClassMetadata expected by parameter $metadata of Doctrine\ORM\Cache\Cache...CachedEntityPersister(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

145
        $cachedPersister = $this->factory->buildCachedEntityPersister($em, $persister, /** @scrutinizer ignore-type */ $metadata);
Loading history...
146
147
        self::assertInstanceOf(CachedEntityPersister::class, $cachedPersister);
148
        self::assertInstanceOf(NonStrictReadWriteCachedEntityPersister::class, $cachedPersister);
149
    }
150
151 View Code Duplication
    public function testBuildCachedCollectionPersisterReadOnly()
152
    {
153
        $em          = $this->em;
154
        $metadata    = clone $em->getClassMetadata(State::class);
155
        $association = $metadata->getProperty('cities');
0 ignored issues
show
Bug introduced by
The method getProperty() does not exist on Doctrine\Common\Persistence\Mapping\ClassMetadata. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

155
        /** @scrutinizer ignore-call */ 
156
        $association = $metadata->getProperty('cities');

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
156
        $persister   = new OneToManyPersister($em);
157
        $region      = new ConcurrentRegionMock(
158
            new DefaultRegion('regionName', $this->getSharedSecondLevelCacheDriverImpl())
159
        );
160
161
        $association->setCache(
162
            new CacheMetadata(CacheUsage::READ_ONLY, 'doctrine_tests_models_cache_state__cities')
163
        );
164
165
        $this->factory->expects($this->once())
166
            ->method('getRegion')
167
            ->with($this->equalTo($association->getCache()))
168
            ->will($this->returnValue($region));
169
170
171
        $cachedPersister = $this->factory->buildCachedCollectionPersister($em, $persister, $association);
172
173
        self::assertInstanceOf(CachedCollectionPersister::class, $cachedPersister);
174
        self::assertInstanceOf(ReadOnlyCachedCollectionPersister::class, $cachedPersister);
175
    }
176
177 View Code Duplication
    public function testBuildCachedCollectionPersisterReadWrite()
178
    {
179
        $em         = $this->em;
180
        $metadata   = clone $em->getClassMetadata(State::class);
181
        $association    = $metadata->getProperty('cities');
182
        $persister  = new OneToManyPersister($em);
183
        $region     = new ConcurrentRegionMock(
184
            new DefaultRegion('regionName', $this->getSharedSecondLevelCacheDriverImpl())
185
        );
186
187
        $association->setCache(
188
            new CacheMetadata(CacheUsage::READ_WRITE, 'doctrine_tests_models_cache_state__cities')
189
        );
190
191
        $this->factory->expects($this->once())
192
            ->method('getRegion')
193
            ->with($this->equalTo($association->getCache()))
194
            ->will($this->returnValue($region));
195
196
        $cachedPersister = $this->factory->buildCachedCollectionPersister($em, $persister, $association);
197
198
        self::assertInstanceOf(CachedCollectionPersister::class, $cachedPersister);
199
        self::assertInstanceOf(ReadWriteCachedCollectionPersister::class, $cachedPersister);
200
    }
201
202 View Code Duplication
    public function testBuildCachedCollectionPersisterNonStrictReadWrite()
203
    {
204
        $em          = $this->em;
205
        $metadata    = clone $em->getClassMetadata(State::class);
206
        $association = $metadata->getProperty('cities');
207
        $persister   = new OneToManyPersister($em);
208
        $region      = new ConcurrentRegionMock(
209
            new DefaultRegion('regionName', $this->getSharedSecondLevelCacheDriverImpl())
210
        );
211
212
        $association->setCache(
213
            new CacheMetadata(CacheUsage::NONSTRICT_READ_WRITE, 'doctrine_tests_models_cache_state__cities')
214
        );
215
216
        $this->factory->expects($this->once())
217
            ->method('getRegion')
218
            ->with($this->equalTo($association->getCache()))
219
            ->will($this->returnValue($region));
220
221
        $cachedPersister = $this->factory->buildCachedCollectionPersister($em, $persister, $association);
222
223
        self::assertInstanceOf(CachedCollectionPersister::class, $cachedPersister);
224
        self::assertInstanceOf(NonStrictReadWriteCachedCollectionPersister::class, $cachedPersister);
225
    }
226
227 View Code Duplication
    public function testInheritedEntityCacheRegion()
228
    {
229
        $em         = $this->em;
230
        $metadata1  = clone $em->getClassMetadata(AttractionContactInfo::class);
231
        $metadata2  = clone $em->getClassMetadata(AttractionLocationInfo::class);
232
        $persister1 = new BasicEntityPersister($em, $metadata1);
233
        $persister2 = new BasicEntityPersister($em, $metadata2);
234
        $factory    = new DefaultCacheFactory($this->regionsConfig, $this->getSharedSecondLevelCacheDriverImpl());
235
236
        $cachedPersister1 = $factory->buildCachedEntityPersister($em, $persister1, $metadata1);
0 ignored issues
show
Bug introduced by
$metadata1 of type Doctrine\Common\Persistence\Mapping\ClassMetadata is incompatible with the type Doctrine\ORM\Mapping\ClassMetadata expected by parameter $metadata of Doctrine\ORM\Cache\Defau...CachedEntityPersister(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

236
        $cachedPersister1 = $factory->buildCachedEntityPersister($em, $persister1, /** @scrutinizer ignore-type */ $metadata1);
Loading history...
237
        $cachedPersister2 = $factory->buildCachedEntityPersister($em, $persister2, $metadata2);
238
239
        self::assertInstanceOf(CachedEntityPersister::class, $cachedPersister1);
240
        self::assertInstanceOf(CachedEntityPersister::class, $cachedPersister2);
241
242
        self::assertNotSame($cachedPersister1, $cachedPersister2);
243
        self::assertSame($cachedPersister1->getCacheRegion(), $cachedPersister2->getCacheRegion());
244
    }
245
246 View Code Duplication
    public function testCreateNewCacheDriver()
247
    {
248
        $em         = $this->em;
249
        $metadata1  = clone $em->getClassMetadata(State::class);
250
        $metadata2  = clone $em->getClassMetadata(City::class);
251
        $persister1 = new BasicEntityPersister($em, $metadata1);
252
        $persister2 = new BasicEntityPersister($em, $metadata2);
253
        $factory    = new DefaultCacheFactory($this->regionsConfig, $this->getSharedSecondLevelCacheDriverImpl());
254
255
        $cachedPersister1 = $factory->buildCachedEntityPersister($em, $persister1, $metadata1);
0 ignored issues
show
Bug introduced by
$metadata1 of type Doctrine\Common\Persistence\Mapping\ClassMetadata is incompatible with the type Doctrine\ORM\Mapping\ClassMetadata expected by parameter $metadata of Doctrine\ORM\Cache\Defau...CachedEntityPersister(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

255
        $cachedPersister1 = $factory->buildCachedEntityPersister($em, $persister1, /** @scrutinizer ignore-type */ $metadata1);
Loading history...
256
        $cachedPersister2 = $factory->buildCachedEntityPersister($em, $persister2, $metadata2);
257
258
        self::assertInstanceOf(CachedEntityPersister::class, $cachedPersister1);
259
        self::assertInstanceOf(CachedEntityPersister::class, $cachedPersister2);
260
261
        self::assertNotSame($cachedPersister1, $cachedPersister2);
262
        self::assertNotSame($cachedPersister1->getCacheRegion(), $cachedPersister2->getCacheRegion());
263
    }
264
265 View Code Duplication
    public function testBuildCachedEntityPersisterNonStrictException()
266
    {
267
        $em         = $this->em;
268
        $metadata   = clone $em->getClassMetadata(State::class);
269
        $persister  = new BasicEntityPersister($em, $metadata);
270
271
        $metadata->setCache(
272
            new CacheMetadata('-1', 'doctrine_tests_models_cache_state')
273
        );
274
275
        $this->expectException(\InvalidArgumentException::class);
276
        $this->expectExceptionMessage('Unrecognized access strategy type [-1]');
277
278
        $this->factory->buildCachedEntityPersister($em, $persister, $metadata);
0 ignored issues
show
Bug introduced by
$metadata of type Doctrine\Common\Persistence\Mapping\ClassMetadata is incompatible with the type Doctrine\ORM\Mapping\ClassMetadata expected by parameter $metadata of Doctrine\ORM\Cache\Cache...CachedEntityPersister(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

278
        $this->factory->buildCachedEntityPersister($em, $persister, /** @scrutinizer ignore-type */ $metadata);
Loading history...
279
    }
280
281 View Code Duplication
    public function testBuildCachedCollectionPersisterException()
282
    {
283
        $em          = $this->em;
284
        $metadata    = clone $em->getClassMetadata(State::class);
285
        $association = $metadata->getProperty('cities');
286
        $persister   = new OneToManyPersister($em);
287
288
        $association->setCache(
289
            new CacheMetadata('-1', 'doctrine_tests_models_cache_state__cities')
290
        );
291
292
        $this->expectException(\InvalidArgumentException::class);
293
        $this->expectExceptionMessage('Unrecognized access strategy type [-1]');
294
295
        $this->factory->buildCachedCollectionPersister($em, $persister, $association);
296
    }
297
298 View Code Duplication
    public function testInvalidFileLockRegionDirectoryException()
299
    {
300
        $factory = new DefaultCacheFactory($this->regionsConfig, $this->getSharedSecondLevelCacheDriverImpl());
301
302
        $this->expectException(\LogicException::class);
303
        $this->expectExceptionMessage(
304
            'If you want to use a "READ_WRITE" cache an implementation of "Doctrine\ORM\Cache\ConcurrentRegion" '
305
            . 'is required, The default implementation provided by doctrine is '
306
            . '"Doctrine\ORM\Cache\Region\FileLockRegion" if you want to use it please provide a valid directory'
307
        );
308
309
        $fooCache  = new CacheMetadata(CacheUsage::READ_WRITE, 'foo');
310
        $factory->getRegion($fooCache);
311
    }
312
313 View Code Duplication
    public function testInvalidFileLockRegionDirectoryExceptionWithEmptyString()
314
    {
315
        $factory = new DefaultCacheFactory($this->regionsConfig, $this->getSharedSecondLevelCacheDriverImpl());
316
317
        $factory->setFileLockRegionDirectory('');
318
319
        $this->expectException(\LogicException::class);
320
        $this->expectExceptionMessage(
321
            'If you want to use a "READ_WRITE" cache an implementation of "Doctrine\ORM\Cache\ConcurrentRegion" '
322
            . 'is required, The default implementation provided by doctrine is '
323
            . '"Doctrine\ORM\Cache\Region\FileLockRegion" if you want to use it please provide a valid directory'
324
        );
325
326
        $fooCache  = new CacheMetadata(CacheUsage::READ_WRITE, 'foo');
327
        $factory->getRegion($fooCache);
328
    }
329
330
    public function testBuildsNewNamespacedCacheInstancePerRegionInstance()
331
    {
332
        $factory = new DefaultCacheFactory($this->regionsConfig, $this->getSharedSecondLevelCacheDriverImpl());
333
334
        $fooCache  = new CacheMetadata(CacheUsage::READ_ONLY, 'foo');
335
        $fooRegion = $factory->getRegion($fooCache);
336
337
        $barCache  = new CacheMetadata(CacheUsage::READ_ONLY, 'bar');
338
        $barRegion = $factory->getRegion($barCache);
339
340
        self::assertSame('foo', $fooRegion->getCache()->getNamespace());
0 ignored issues
show
Bug introduced by
The method getCache() does not exist on Doctrine\ORM\Cache\Region. It seems like you code against a sub-type of Doctrine\ORM\Cache\Region such as Doctrine\ORM\Cache\Region\DefaultRegion or Doctrine\ORM\Cache\Region\UpdateTimestampCache. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

340
        self::assertSame('foo', $fooRegion->/** @scrutinizer ignore-call */ getCache()->getNamespace());
Loading history...
341
        self::assertSame('bar', $barRegion->getCache()->getNamespace());
342
    }
343
344
    public function testAppendsNamespacedCacheInstancePerRegionInstanceWhenItsAlreadySet()
345
    {
346
        $cache = clone $this->getSharedSecondLevelCacheDriverImpl();
347
        $cache->setNamespace('testing');
348
349
        $factory = new DefaultCacheFactory($this->regionsConfig, $cache);
350
351
        $fooCache  = new CacheMetadata(CacheUsage::READ_ONLY, 'foo');
352
        $fooRegion = $factory->getRegion($fooCache);
353
354
        $barCache  = new CacheMetadata(CacheUsage::READ_ONLY, 'bar');
355
        $barRegion = $factory->getRegion($barCache);
356
357
        self::assertSame('testing:foo', $fooRegion->getCache()->getNamespace());
358
        self::assertSame('testing:bar', $barRegion->getCache()->getNamespace());
359
    }
360
361 View Code Duplication
    public function testBuildsDefaultCacheRegionFromGenericCacheRegion()
362
    {
363
        /* @var $cache \Doctrine\Common\Cache\Cache */
364
        $cache   = $this->createMock(Cache::class);
365
        $factory = new DefaultCacheFactory($this->regionsConfig, $cache);
366
367
        $barCache  = new CacheMetadata(CacheUsage::READ_ONLY, 'bar');
368
        $barRegion = $factory->getRegion($barCache);
369
370
        self::assertInstanceOf(DefaultRegion::class, $barRegion);
371
    }
372
373 View Code Duplication
    public function testBuildsMultiGetCacheRegionFromGenericCacheRegion()
374
    {
375
        /* @var $cache \Doctrine\Common\Cache\CacheProvider */
376
        $cache   = $this->getMockForAbstractClass(CacheProvider::class);
377
        $factory = new DefaultCacheFactory($this->regionsConfig, $cache);
378
379
        $barCache  = new CacheMetadata(CacheUsage::READ_ONLY, 'bar');
380
        $barRegion = $factory->getRegion($barCache);
381
382
        self::assertInstanceOf(DefaultMultiGetRegion::class, $barRegion);
383
    }
384
385
}
386