58 lines
1.3 KiB
PHP
58 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace SMW\Tests\ParserFunctions;
|
|
|
|
use SMW\ParserFunctions\InfoParserFunction;
|
|
use SMW\Tests\PHPUnitCompat;
|
|
|
|
/**
|
|
* @covers \SMW\ParserFunctions\InfoParserFunction
|
|
* @group semantic-mediawiki
|
|
*
|
|
* @license GPL-2.0-or-later
|
|
* @since 2.4
|
|
*
|
|
* @author mwjames
|
|
*/
|
|
class InfoParserFunctionTest extends \PHPUnit\Framework\TestCase {
|
|
|
|
use PHPUnitCompat;
|
|
|
|
public function testCanConstruct() {
|
|
$this->assertInstanceOf(
|
|
'\SMW\ParserFunctions\InfoParserFunction',
|
|
new InfoParserFunction()
|
|
);
|
|
}
|
|
|
|
public function testHandle() {
|
|
$instance = new InfoParserFunction();
|
|
|
|
$parser = $this->getMockBuilder( '\MediaWiki\Parser\Parser' )
|
|
->disableOriginalConstructor()
|
|
->getMock();
|
|
|
|
$processedParam = $this->getMockBuilder( '\ParamProcessor\ProcessedParam' )
|
|
->disableOriginalConstructor()
|
|
->getMock();
|
|
|
|
$processingResult = $this->getMockBuilder( '\ParamProcessor\ProcessingResult' )
|
|
->disableOriginalConstructor()
|
|
->getMock();
|
|
|
|
$processingResult->expects( $this->any() )
|
|
->method( 'getParameters' )
|
|
->willReturn( [
|
|
'message' => $processedParam,
|
|
'max-width' => $processedParam,
|
|
'theme' => $processedParam,
|
|
'icon' => $processedParam ] );
|
|
|
|
$this->assertIsString(
|
|
|
|
$instance->handle( $parser, $processingResult )
|
|
);
|
|
}
|
|
|
|
}
|