testNextOnEmptyElementsResult()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 23

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 23
rs 9.552
c 0
b 0
f 0
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