Completed
Push — master ( 981814...5ed881 )
by Jeroen De
236:00 queued 133:09
created

SpreadsheetTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 2
dl 0
loc 37
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getFormats() 0 3 1
A getClass() 0 3 1
A testLink() 0 25 1
1
<?php
2
3
namespace SRF\Tests\Unit\Formats;
4
5
use SMW\Test\QueryPrinterRegistryTestCase;
6
use SRF\SpreadsheetPrinter;
7
8
/**
9
 * @ingroup SemanticResultFormats
10
 * @ingroup Test
11
 * @group SRF
12
 * @group SMWExtension
13
 * @group ResultPrinters
14
 */
15
class SpreadsheetTest extends QueryPrinterRegistryTestCase {
16
17
	public function getFormats() {
18
		return [ 'spreadsheet' ];
19
	}
20
21
	public function getClass() {
22
		return 'SRF\SpreadsheetPrinter';
23
	}
24
25
	public function testLink() {
26
27
		$link = $this->getMockBuilder( '\SMWInfolink' )
28
			->disableOriginalConstructor()
29
			->getMock();
30
31
		$queryResult = $this->getMockBuilder( '\SMWQueryResult' )
32
			->disableOriginalConstructor()
33
			->getMock();
34
35
		$queryResult->expects( $this->once() )
36
			->method( 'getQueryLink' )
37
			->will( $this->returnValue( $link ) );
38
39
		$queryResult->expects( $this->any() )
40
			->method( 'getCount' )
41
			->will( $this->returnValue( 1 ) );
42
43
		$queryResult->expects( $this->any() )
44
			->method( 'getErrors' )
45
			->will( $this->returnValue( [] ) );
46
47
		$instance = new SpreadsheetPrinter( 'csv' );
48
		$instance->getResult( $queryResult, [], SMW_OUTPUT_WIKI );
49
	}
50
51
}
52