mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/DiscussionTools
synced 2024-12-11 00:02:43 +00:00
fcdabc5fcc
Many methods are covered indirectly, and using method-level @covers filters means these are reported as not being covered. Change-Id: I94eb3e8c48209ff0b6bfc09e18c93555bb167e8f
37 lines
1.2 KiB
PHP
37 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace MediaWiki\Extension\DiscussionTools\Tests;
|
|
|
|
use MediaWiki\Extension\DiscussionTools\CommentUtils;
|
|
use MediaWiki\MediaWikiServices;
|
|
|
|
/**
|
|
* @group DiscussionTools
|
|
* @covers \MediaWiki\Extension\DiscussionTools\CommentUtils
|
|
*/
|
|
class CommentUtilsTest extends IntegrationTestCase {
|
|
/**
|
|
* @dataProvider provideIsSingleCommentSignedBy
|
|
*/
|
|
public function testIsSingleCommentSignedBy(
|
|
string $msg, string $title, string $username, string $html, bool $expected
|
|
) {
|
|
$doc = static::createDocument( $html );
|
|
$container = static::getThreadContainer( $doc );
|
|
|
|
$config = static::getJson( "../data/enwiki-config.json" );
|
|
$data = static::getJson( "../data/enwiki-data.json" );
|
|
$this->setupEnv( $config, $data );
|
|
$title = MediaWikiServices::getInstance()->getTitleParser()->parseTitle( $title );
|
|
$parser = static::createParser( $data );
|
|
|
|
$threadItemSet = $parser->parse( $container, $title );
|
|
$isSigned = CommentUtils::isSingleCommentSignedBy( $threadItemSet, $username, $container );
|
|
static::assertEquals( $expected, $isSigned, $msg );
|
|
}
|
|
|
|
public function provideIsSingleCommentSignedBy(): array {
|
|
return static::getJson( '../cases/isSingleCommentSignedBy.json' );
|
|
}
|
|
}
|