mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/DiscussionTools
synced 2024-11-27 17:51:09 +00:00
Add test for DiscussionTools TOC additions
We verify that they appear in the action=parse API output. We should also have a test to verify that they appear in the Vector 2022 skin, but that might have to be done as a browser test. Bug: T326677 Change-Id: I81d5ddecd3b244aeee8cba71498f4d65f8e53696
This commit is contained in:
parent
b7405bb006
commit
cfd76f5eb0
34
tests/phpunit/integration/ApiParseDiscussionToolsTest.php
Normal file
34
tests/phpunit/integration/ApiParseDiscussionToolsTest.php
Normal file
|
@ -0,0 +1,34 @@
|
|||
<?php
|
||||
|
||||
namespace MediaWiki\Extension\DiscussionTools\Tests;
|
||||
|
||||
use ApiTestCase;
|
||||
|
||||
/**
|
||||
* @group medium
|
||||
* @group Database
|
||||
*/
|
||||
class ApiParseDiscussionToolsTest extends ApiTestCase {
|
||||
|
||||
/**
|
||||
* @covers \MediaWiki\Extension\DiscussionTools\CommentFormatter::addDiscussionTools
|
||||
*/
|
||||
public function testApiParseSections() {
|
||||
$params = [
|
||||
'action' => 'parse',
|
||||
'title' => 'Talk:Test',
|
||||
'uselang' => 'en',
|
||||
'text' => "__FORCETOC__\n== foo ==\nbar ~~~~",
|
||||
'pst' => 1,
|
||||
'prop' => 'sections',
|
||||
];
|
||||
|
||||
[ $result, ] = $this->doApiRequest( $params );
|
||||
|
||||
$this->assertSame(
|
||||
'<span class="ext-discussiontools-init-sidebar-meta">1 comment</span>',
|
||||
$result['parse']['sections'][0]['extensionData']['DiscussionTools-html-summary']
|
||||
);
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in a new issue