mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/DiscussionTools
synced 2024-12-25 14:24:37 +00:00
672ca86016
ApiDiscussionToolsPageInfo and ApiDiscussionToolsCompare in direct parsoid or VRS modes tries to fetch HTML using VisualEditor thus stashing the HTML gotten which we don't want, we only need it for viewing in these cases. This seems like something that was/is already happening in RESTBase. So for APIs in DiscussionTools that need the HTML for viewing, just get it from parser cache and not stash it. Bug: T323357 Change-Id: I101c1e84739a2ac1f562f2f7bdc4b8f53d9f3b23
46 lines
1.4 KiB
PHP
46 lines
1.4 KiB
PHP
<?php
|
|
|
|
namespace MediaWiki\Extension\DiscussionTools\Tests;
|
|
|
|
use ApiTestCase;
|
|
use Title;
|
|
|
|
/**
|
|
* @group medium
|
|
* @group Database
|
|
* @covers \MediaWiki\Extension\DiscussionTools\ApiDiscussionToolsCompare
|
|
*/
|
|
class ApiDiscussionToolsCompareTest extends ApiTestCase {
|
|
|
|
/**
|
|
* @covers \MediaWiki\Extension\DiscussionTools\ApiDiscussionToolsCompare::execute
|
|
*/
|
|
public function testExecuteApiDiscussionToolsCompare() {
|
|
$title = Title::newFromText( 'Talk:' . __METHOD__ );
|
|
$page = $this->getNonexistingTestPage( $title );
|
|
|
|
$this->editPage( $page, "== Test ==\n\nadd DT pageinfo content\n" );
|
|
$rev1 = $page->getLatest();
|
|
|
|
$this->editPage( $page, ':adding another edit' );
|
|
$rev2 = $page->getLatest();
|
|
|
|
$params = [
|
|
'action' => 'discussiontoolscompare',
|
|
'fromrev' => $rev1,
|
|
'torev' => $rev2,
|
|
];
|
|
|
|
$result = $this->doApiRequestWithToken( $params );
|
|
|
|
$this->assertNotEmpty( $result[0]['discussiontoolscompare'] );
|
|
$this->assertArrayHasKey( 'fromrevid', $result[0]['discussiontoolscompare'] );
|
|
$this->assertSame( $rev1, $result[0]['discussiontoolscompare']['fromrevid'] );
|
|
$this->assertArrayHasKey( 'torevid', $result[0]['discussiontoolscompare'] );
|
|
$this->assertSame( $rev2, $result[0]['discussiontoolscompare']['torevid'] );
|
|
$this->assertArrayHasKey( 'removedcomments', $result[0]['discussiontoolscompare'] );
|
|
$this->assertArrayHasKey( 'addedcomments', $result[0]['discussiontoolscompare'] );
|
|
}
|
|
|
|
}
|