summaryrefslogtreecommitdiff
path: root/www/wiki/extensions/SemanticMediaWiki/tests/phpunit/Unit/Factbox/FactboxFactoryTest.php
blob: b4fe99ceb182bedccc46dab2629e106b7508575c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<?php

namespace SMW\Tests\Factbox;

use SMW\Factbox\FactboxFactory;
use Title;

/**
 * @covers \SMW\Factbox\FactboxFactory
 * @group semantic-mediawiki
 *
 * @license GNU GPL v2+
 * @since 2.0
 *
 * @author mwjames
 */
class FactboxFactoryTest extends \PHPUnit_Framework_TestCase {

	public function testCanConstruct() {

		$this->assertInstanceOf(
			'\SMW\Factbox\FactboxFactory',
			new FactboxFactory()
		);
	}

	public function testCanConstructCachedFactbox() {

		$instance = new FactboxFactory();

		$this->assertInstanceOf(
			'\SMW\Factbox\CachedFactbox',
			$instance->newCachedFactbox()
		);
	}

	public function testCanConstructFactbox() {

		$title = $this->getMockBuilder( '\Title' )
			->disableOriginalConstructor()
			->getMock();

		$title->expects( $this->any() )
			->method( 'getNamespace' )
			->will( $this->returnValue( NS_MAIN ) );

		$parserOutput = $this->getMockBuilder( '\ParserOutput' )
			->disableOriginalConstructor()
			->getMock();

		$instance = new FactboxFactory();

		$this->assertInstanceOf(
			'\SMW\Factbox\Factbox',
			$instance->newFactbox( $title, $parserOutput )
		);
	}

}