gplx/mediawiki/extensions/SemanticMediaWiki/tests/phpunit/Query/ResultPrinters/TableResultPrinterTest.php

46 lines
918 B
PHP

<?php
namespace SMW\Tests\Query\ResultPrinters;
use SMW\Query\ResultPrinters\TableResultPrinter;
use SMW\Tests\PHPUnitCompat;
/**
* @covers \SMW\Query\ResultPrinters\TableResultPrinter
* @group semantic-mediawiki
*
* @license GPL-2.0-or-later
* @since 3.0
*
* @author mwjames
*/
class TableResultPrinterTest extends \PHPUnit\Framework\TestCase {
use PHPUnitCompat;
public function testCanConstruct() {
$this->assertInstanceOf(
TableResultPrinter::class,
new TableResultPrinter( 'table' )
);
}
public function testGetResult_Empty() {
$queryResult = $this->getMockBuilder( '\SMW\Query\QueryResult' )
->disableOriginalConstructor()
->getMock();
$queryResult->expects( $this->any() )
->method( 'getErrors' )
->willReturn( [] );
$instance = new TableResultPrinter( 'table' );
$this->assertIsString(
$instance->getResult( $queryResult, [], SMW_OUTPUT_WIKI )
);
}
}