LingoBackendAdapterTest   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 1
dl 0
loc 35
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testCanConstruct() 0 7 1
A testNextOnEmptyElementsResult() 0 23 1
1
<?php
2
3
namespace SG\Tests;
4
5
use SG\LingoBackendAdapter;
6
7
/**
8
 * @covers \SG\LingoBackendAdapter
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.1
18
 *
19
 * @author mwjames
20
 */
21
class LingoBackendAdapterTest extends \PHPUnit_Framework_TestCase {
22
23
	public function testCanConstruct() {
24
25
		$this->assertInstanceOf(
26
			'\SG\LingoBackendAdapter',
27
			new LingoBackendAdapter()
28
		);
29
	}
30
31
	public function testNextOnEmptyElementsResult() {
32
33
		$lingoMessageLog = $this->getMockBuilder( '\Lingo\MessageLog' )
34
			->disableOriginalConstructor()
35
			->getMock();
36
37
		$elementsCacheBuilder = $this->getMockBuilder( '\SG\Cache\ElementsCacheBuilder' )
38
			->disableOriginalConstructor()
39
			->getMock();
40
41
		$elementsCacheBuilder->expects( $this->once() )
42
			->method( 'getElements' )
43
			->will( $this->returnValue( array() ) );
44
45
		$instance = new LingoBackendAdapter(
46
			$lingoMessageLog,
47
			$elementsCacheBuilder
48
		);
49
50
		$instance->next();
51
52
		$this->assertTrue( $instance->useCache() );
53
	}
54
55
}
56