summaryrefslogtreecommitdiff
path: root/www/wiki/extensions/SemanticMediaWiki/tests/phpunit/Unit/ParserFunctions/DocumentationParserFunctionTest.php
blob: a54eadf53dc6467cb6b34170526ab9032dcac42d (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
<?php

namespace SMW\Tests\ParserFunctions;

use ParamProcessor\ProcessedParam;
use ParamProcessor\ProcessingResult;
use SMW\ParserFunctions\DocumentationParserFunction;

/**
 * @covers \SMW\ParserFunctions\DocumentationParserFunction
 * @group semantic-mediawiki
 *
 * @license GNU GPL v2+
 * @since  2.4
 *
 * @author mwjames
 */
class DocumentationParserFunctionTest extends \PHPUnit_Framework_TestCase {

	public function testHandle() {

		$instance = new DocumentationParserFunction();

		$parser = $this->getMockBuilder( '\Parser' )
			->disableOriginalConstructor()
			->getMock();

		$processedParam = $this->getMockBuilder( ProcessedParam::class )
			->disableOriginalConstructor()
			->getMock();
		
		$language = $this->getMockBuilder( ProcessedParam::class )
			->disableOriginalConstructor()
			->getMock();

		$language->expects( $this->any() )
			->method( 'getValue' )
			->will( $this->returnValue( 'en' ) );

		$processingResult = $this->getMockBuilder( ProcessingResult::class )
			->disableOriginalConstructor()
			->getMock();

		$processingResult->expects( $this->any() )
			->method( 'getParameters' )
			->will( $this->returnValue( [
				'language'   => $language,
				'format'     => $processedParam,
				'parameters' => $processedParam ]
			) );

		$this->assertInternalType(
			'string',
			$instance->handle( $parser, $processingResult )
		);
	}

}