Passed
Pull Request — master (#136)
by None
04:56 queued 51s
created

CacheKeyProviderTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 2
dl 0
loc 39
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace SCI\Tests;
4
5
use SCI\CacheKeyProvider;
6
use SMW\Tests\PHPUnitCompat;
7
8
/**
9
 * @covers \SCI\CacheKeyProvider
10
 * @group semantic-cite
11
 *
12
 * @license GNU GPL v2+
13
 * @since   1.0
14
 *
15
 * @author mwjames
16
 */
17
class CacheKeyProviderTest extends \PHPUnit_Framework_TestCase {
18
19
	use PHPUnitCompat;
20
21
	public function testCanConstruct() {
22
23
		$this->assertInstanceOf(
24
			'\SCI\CacheKeyProvider',
25
			new CacheKeyProvider()
26
		);
27
	}
28
29
	public function testGetKey() {
30
31
		$instance = new CacheKeyProvider();
32
		$instance->setCachePrefix( 'foo' );
33
34
		$this->assertContains(
35
			'foo',
36
			$instance->getCacheKeyForCitationReference( 'abc' )
37
		);
38
39
		$this->assertContains(
40
			':ref:',
41
			$instance->getCacheKeyForCitationReference( 123 )
42
		);
43
44
		$this->assertContains(
45
			'foo',
46
			$instance->getCacheKeyForReferenceList( 'def' )
47
		);
48
49
		$this->assertContains(
50
			':reflist:',
51
			$instance->getCacheKeyForReferenceList( 456 )
52
		);
53
	}
54
55
}
56