Completed
Pull Request — master (#445)
by Stephan
100:33 queued 95:58
created

SpreadsheetTest::getClass()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace SRF\Tests\Unit\Formats;
4
5
use SMW\Test\QueryPrinterRegistryTestCase;
6
use SRF\SpreadsheetPrinter;
7
8
/**
9
 * Tests for the SRF\Excel class.
10
 *
11
 * @since 1.9
12
 *
13
 * @ingroup SemanticResultFormats
14
 * @ingroup Test
15
 *
16
 * @group SRF
17
 * @group SMWExtension
18
 * @group ResultPrinters
19
 *
20
 * @author Kim Eik
21
 */
22
class SpreadsheetTest extends QueryPrinterRegistryTestCase {
23
24
	/**
25
	 * @see QueryPrinterRegistryTestCase::getFormats
26
	 *
27
	 * @since 1.8
28
	 *
29
	 * @return array
30
	 */
31
	public function getFormats() {
32
		return [ 'spreadsheet' ];
33
	}
34
35
	/**
36
	 * @see QueryPrinterRegistryTestCase::getClass
37
	 *
38
	 * @since 1.8
39
	 *
40
	 * @return string
41
	 */
42
	public function getClass() {
43
		return 'SRF\SpreadsheetPrinter';
44
	}
45
46
	public function testLink() {
47
48
		$link = $this->getMockBuilder( '\SMWInfolink' )
49
			->disableOriginalConstructor()
50
			->getMock();
51
52
		$queryResult = $this->getMockBuilder( '\SMWQueryResult' )
53
			->disableOriginalConstructor()
54
			->getMock();
55
56
		$queryResult->expects( $this->once() )
57
			->method( 'getQueryLink' )
58
			->will( $this->returnValue( $link ) );
59
60
		$queryResult->expects( $this->any() )
61
			->method( 'getCount' )
62
			->will( $this->returnValue( 1 ) );
63
64
		$queryResult->expects( $this->any() )
65
			->method( 'getErrors' )
66
			->will( $this->returnValue( [] ) );
67
68
		$instance = new SpreadsheetPrinter( 'csv' );
69
		$instance->getResult( $queryResult, [], SMW_OUTPUT_WIKI );
70
	}
71
72
}
73