GlossaryCacheTest::testGetKeys()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 22

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 22
rs 9.568
c 0
b 0
f 0
1
<?php
2
3
namespace SG\Tests\Cache;
4
5
use SG\Cache\GlossaryCache;
6
7
/**
8
 * @covers \SG\Cache\GlossaryCache
9
 *
10
 * @ingroup Test
11
 *
12
 * @group SG
13
 * @group SGExtension
14
 * @group extension-semantic-glossary
15
 *
16
 * @license GNU GPL v2+
17
 * @since 1.0
18
 *
19
 * @author mwjames
20
 */
21
class GlossaryCacheTest extends \PHPUnit_Framework_TestCase {
22
23
	public function testGetDefaultCache() {
24
25
		$instance = new GlossaryCache();
26
27
		$this->assertInstanceOf(
28
			'BagOStuff',
29
			$instance->getCache()
30
		);
31
	}
32
33
	public function testGetCacheType() {
34
35
		$instance = new GlossaryCache();
36
37
		$this->assertInternalType(
38
			'integer',
39
			$instance->getCacheType()
40
		);
41
	}
42
43
	public function testGetKeys() {
44
45
		$instance = new GlossaryCache();
46
47
		$subject = $this->getMockBuilder( '\SMW\DIWikiPage' )
48
			->disableOriginalConstructor()
49
			->getMock();
50
51
		$subject->expects( $this->once() )
52
			->method( 'getSerialization' )
53
			->will( $this->returnValue( 'Foo' ) );
54
55
		$this->assertInternalType(
56
			'string',
57
			$instance->getKeyForSubject( $subject )
58
		);
59
60
		$this->assertInternalType(
61
			'string',
62
			$instance->getKeyForLingo()
63
		);
64
	}
65
66
}
67