mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Cite
synced 2024-11-23 14:36:51 +00:00
Prematurely move References test to integration
This isn't needed until patch I576dfff415, but is split into a predecessor to keep the test and logic changes obviously separate. Bug: T377454 Change-Id: Iff4a96be77af53a71a1ebe179f31bcc214182bfe
This commit is contained in:
parent
60fbb32c1a
commit
1af67c0416
|
@ -4,16 +4,21 @@ declare( strict_types = 1 );
|
|||
|
||||
namespace Cite\Tests\Integration;
|
||||
|
||||
use Cite\Parsoid\References;
|
||||
use MediaWiki\Config\Config;
|
||||
use MediaWiki\Registration\ExtensionRegistry;
|
||||
use Wikimedia\ObjectFactory\ObjectFactory;
|
||||
use Wikimedia\Parsoid\Core\SelserData;
|
||||
use Wikimedia\Parsoid\DOM\Element;
|
||||
use Wikimedia\Parsoid\Ext\ParsoidExtensionAPI;
|
||||
use Wikimedia\Parsoid\Mocks\MockDataAccess;
|
||||
use Wikimedia\Parsoid\Mocks\MockPageConfig;
|
||||
use Wikimedia\Parsoid\Mocks\MockPageContent;
|
||||
use Wikimedia\Parsoid\Mocks\MockSiteConfig;
|
||||
use Wikimedia\Parsoid\NodeData\DataMw;
|
||||
use Wikimedia\Parsoid\Parsoid;
|
||||
use Wikimedia\Parsoid\Utils\DOMCompat;
|
||||
use Wikimedia\Parsoid\Utils\DOMDataUtils;
|
||||
use Wikimedia\Parsoid\Utils\DOMUtils;
|
||||
|
||||
/**
|
||||
|
@ -237,4 +242,23 @@ EOT;
|
|||
);
|
||||
$this->wtToLint( "<ref name='x' />{{#tag:ref|<ref name='x' />|name=x}}" );
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \Cite\Parsoid\References::processAttributeEmbeddedHTML
|
||||
*/
|
||||
public function testProcessAttributeEmbeddedHTML() {
|
||||
$doc = DOMUtils::parseHTML( '' );
|
||||
DOMDataUtils::prepareDoc( $doc );
|
||||
$elt = $doc->createElement( 'a' );
|
||||
DOMDataUtils::setDataMw( $elt, new DataMw( [ 'body' => (object)[ 'html' => 'old' ] ] ) );
|
||||
|
||||
$refs = new References( $this->createNoOpMock( Config::class ) );
|
||||
$refs->processAttributeEmbeddedHTML(
|
||||
$this->createNoOpMock( ParsoidExtensionAPI::class ),
|
||||
$elt,
|
||||
fn () => 'new'
|
||||
);
|
||||
|
||||
$this->assertSame( 'new', DOMDataUtils::getDataMw( $elt )->body->html );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,37 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Cite\Tests\Unit;
|
||||
|
||||
use Cite\Parsoid\References;
|
||||
use MediaWiki\Config\Config;
|
||||
use MediaWikiUnitTestCase;
|
||||
use Wikimedia\Parsoid\Ext\ParsoidExtensionAPI;
|
||||
use Wikimedia\Parsoid\NodeData\DataMw;
|
||||
use Wikimedia\Parsoid\Utils\DOMDataUtils;
|
||||
use Wikimedia\Parsoid\Utils\DOMUtils;
|
||||
|
||||
/**
|
||||
* @covers \Cite\Parsoid\References
|
||||
* @license GPL-2.0-or-later
|
||||
*/
|
||||
class ReferencesTest extends MediaWikiUnitTestCase {
|
||||
|
||||
public function testProcessAttributeEmbeddedHTML() {
|
||||
$doc = DOMUtils::parseHTML( '' );
|
||||
DOMDataUtils::prepareDoc( $doc );
|
||||
$elt = $doc->createElement( 'a' );
|
||||
DOMDataUtils::setDataMw( $elt, new DataMw( [ 'body' => (object)[ 'html' => 'old' ] ] ) );
|
||||
|
||||
$refs = new References( $this->createNoOpMock( Config::class ) );
|
||||
$refs->processAttributeEmbeddedHTML(
|
||||
$this->createNoOpMock( ParsoidExtensionAPI::class ),
|
||||
$elt,
|
||||
fn () => 'new'
|
||||
);
|
||||
|
||||
$this->assertSame( 'new', DOMDataUtils::getDataMw( $elt )->body->html );
|
||||
}
|
||||
|
||||
// TODO: Incomplete, there are many more static and non-static methods to test
|
||||
|
||||
}
|
Loading…
Reference in a new issue