gplx/mediawiki/extensions/SemanticMediaWiki/tests/phpunit/Factbox/FactboxFactoryTest.php

65 lines
1.3 KiB
PHP

<?php
namespace SMW\Tests\Factbox;
use SMW\Factbox\FactboxFactory;
/**
* @covers \SMW\Factbox\FactboxFactory
* @group semantic-mediawiki
*
* @license GPL-2.0-or-later
* @since 2.0
*
* @author mwjames
*/
class FactboxFactoryTest extends \PHPUnit\Framework\TestCase {
public function testCanConstruct() {
$this->assertInstanceOf(
FactboxFactory::class,
new FactboxFactory()
);
}
public function testCanConstructCachedFactbox() {
$instance = new FactboxFactory();
$this->assertInstanceOf(
'\SMW\Factbox\CachedFactbox',
$instance->newCachedFactbox()
);
}
public function testCanConstructCheckMagicWords() {
$instance = new FactboxFactory();
$this->assertInstanceOf(
'\SMW\Factbox\CheckMagicWords',
$instance->newCheckMagicWords( [] )
);
}
public function testCanConstructFactbox() {
$title = $this->getMockBuilder( '\MediaWiki\Title\Title' )
->disableOriginalConstructor()
->getMock();
$title->expects( $this->any() )
->method( 'getNamespace' )
->willReturn( NS_MAIN );
$parserOutput = $this->getMockBuilder( '\MediaWiki\Parser\ParserOutput' )
->disableOriginalConstructor()
->getMock();
$instance = new FactboxFactory();
$this->assertInstanceOf(
'\SMW\Factbox\Factbox',
$instance->newFactbox( $title, $parserOutput )
);
}
}