Completed
Push — bibtex-move ( 9d522c )
by mw
08:30
created

BibTexFileExportPrinterTest::testCanConstruct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 7
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace SRF\Tests\BibTex;
4
5
use SRF\BibTex\BibTexFileExportPrinter;
6
use SMW\Tests\TestEnvironment;
7
8
/**
9
 * @covers \SRF\BibTex\BibTexFileExportPrinter
10
 * @group semantic-result-formats
11
 *
12
 * @license GNU GPL v2+
13
 * @since 3.1
14
 *
15
 * @author mwjames
16
 */
17
class BibTexFileExportPrinterTest extends \PHPUnit_Framework_TestCase {
18
19
	private $queryResult;
20
	private $resultPrinterReflector;
21
22
	protected function setUp() {
23
		parent::setUp();
24
25
		$this->resultPrinterReflector = TestEnvironment::getUtilityFactory()->newResultPrinterReflector();
0 ignored issues
show
Bug introduced by
The method newResultPrinterReflector() does not seem to exist on object<SMW\Tests\Utils\UtilityFactory>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
26
27
		$this->queryResult = $this->getMockBuilder( '\SMWQueryResult' )
28
			->disableOriginalConstructor()
29
			->getMock();
30
	}
31
32
	public function testCanConstruct() {
33
34
		$this->assertInstanceOf(
35
			BibTexFileExportPrinter::class,
36
			new BibTexFileExportPrinter( 'bibtex' )
37
		);
38
	}
39
40
	public function testGetFileName() {
41
42
		$parameters = [
43
			'filename' => 'foo'
44
		];
45
46
		$instance = new BibTexFileExportPrinter(
47
			'bibtex'
48
		);
49
50
		$this->resultPrinterReflector->addParameters( $instance, $parameters );
51
52
		$this->assertEquals(
53
			'foo.bib',
54
			$instance->getFileName( $this->queryResult )
55
		);
56
	}
57
58
	public function testGetMimeType() {
59
60
		$instance = new BibTexFileExportPrinter(
61
			'bibtex'
62
		);
63
64
		$this->assertEquals(
65
			'text/bibtex',
66
			$instance->getMimeType( $this->queryResult )
67
		);
68
	}
69
70
}
71