Hoo man has uploaded a new change for review.
https://gerrit.wikimedia.org/r/190633
Change subject: Fix RepoHooks test
......................................................................
Fix RepoHooks test
The finishImportPage callback changed in 341dfa25, adopt to that.
Also make use of ImportStringSource which is possible since 891cc28a9793
Change-Id: I65df855a7deb49a4120acbd5c8e9b181a27c9f08
---
M repo/tests/phpunit/includes/RepoHooksTest.php
1 file changed, 3 insertions(+), 25 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase
refs/changes/33/190633/1
diff --git a/repo/tests/phpunit/includes/RepoHooksTest.php
b/repo/tests/phpunit/includes/RepoHooksTest.php
index 0ad1ecb..22f30a3 100644
--- a/repo/tests/phpunit/includes/RepoHooksTest.php
+++ b/repo/tests/phpunit/includes/RepoHooksTest.php
@@ -2,6 +2,7 @@
namespace Wikibase\Tests;
+use ImportStringSource;
use ConfigFactory;
use Exception;
use Wikibase\Repo\WikibaseRepo;
@@ -60,30 +61,6 @@
RepoHooks::onImportHandleRevisionXMLTag( $importer, array(),
$revisionInfo );
$this->assertTrue( true ); // make PHPUnit happy
- }
-
- private function getMockImportStream( $xml ) {
- $source = $this->getMockBuilder( 'ImportStreamSource' )
- ->disableOriginalConstructor()
- ->getMock();
-
- $atEnd = new \stdClass();
- $atEnd->atEnd = false;
-
- $source->expects( $this->any() )
- ->method( 'atEnd' )
- ->will( $this->returnCallback( function() use ( $atEnd
) {
- return $atEnd->atEnd;
- } ) );
-
- $source->expects( $this->any() )
- ->method( 'readChunk' )
- ->will( $this->returnCallback( function() use ( $atEnd,
$xml ) {
- $atEnd->atEnd = true;
- return $xml;
- } ) );
-
- return $source;
}
public function importProvider() {
@@ -170,12 +147,13 @@
WikibaseRepo::getDefaultInstance()->getSettings()->setSetting(
'allowEntityImport', $allowImport );
- $source = $this->getMockImportStream( $xml );
+ $source = new ImportStringSource( $xml );
$importer = new WikiImporter( $source,
ConfigFactory::getDefaultInstance()->makeConfig( 'main' ) );
$importer->setNoticeCallback( function() {
// Do nothing for now. Could collect and compare
notices.
} );
+ $importer->setPageOutCallback( function() {} );
if ( $expectedException !== null ) {
$this->setExpectedException( $expectedException );
--
To view, visit https://gerrit.wikimedia.org/r/190633
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I65df855a7deb49a4120acbd5c8e9b181a27c9f08
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Hoo man <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits