CompositeCacheIntegrationTest::setUp()   A
last analyzed

Complexity

Conditions 3
Paths 4

Size

Total Lines 17
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 17
rs 9.4285
cc 3
eloc 9
nc 4
nop 0
1
<?php
2
3
namespace Onoi\Cache\Tests\Integration;
4
5
use HashBagOStuff;
6
use Doctrine\Common\Cache\ArrayCache;
7
use Onoi\Cache\CacheFactory;
8
9
/**
10
 * @group onoi-cache
11
 *
12
 * @license GNU GPL v2+
13
 * @since 1.2
14
 *
15
 * @author mwjames
16
 */
17
class CompositeCacheIntegrationTest extends CacheIntegrationTestCase {
18
19
	protected $cache;
20
21
	protected function setUp() {
22
23
		$cache = array();
24
		$cacheFactory = new CacheFactory();
25
26
		$cache[] = $cacheFactory->newFixedInMemoryLruCache();
27
28
		if ( class_exists( '\HashBagOStuff' ) ) {
29
			$cache[] = $cacheFactory->newMediaWikiCache( new HashBagOStuff() );
30
		}
31
32
		if ( class_exists( '\Doctrine\Common\Cache\ArrayCache' ) ) {
33
			$cache[] = $cacheFactory->newDoctrineCache( new ArrayCache() );
34
		}
35
36
		$this->cache = $cacheFactory->newCompositeCache( $cache );
37
	}
38
39
}
40