Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #405 from SemanticMediaWiki/hotfix-linksupdate
MW 1.23+ / Hotfix for empty ParserOutput caused by RefreshLinksJob
- Loading branch information
Showing
3 changed files
with
110 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 64 additions & 0 deletions
64
tests/phpunit/Integration/MediaWiki/LinksUpdateEmptyParserOutputDBIntegrationTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
<?php | ||
|
||
namespace SMW\Tests\Integration\MediaWiki; | ||
|
||
use SMW\Tests\Util\SemanticDataValidator; | ||
use SMW\Tests\Util\ParserFactory; | ||
use SMW\Tests\Util\PageCreator; | ||
use SMW\Tests\MwDBaseUnitTestCase; | ||
|
||
use SMW\ContentParser; | ||
use SMW\ParserData; | ||
use SMW\DIWikiPage; | ||
|
||
use Title; | ||
use LinksUpdate; | ||
use ParserOutput; | ||
|
||
/** | ||
* @ingroup Test | ||
* | ||
* @group SMW | ||
* @group SMWExtension | ||
* @group semantic-mediawiki-integration | ||
* @group mediawiki-databaseless | ||
* @group medium | ||
* | ||
* @license GNU GPL v2+ | ||
* @since 2.0 | ||
* | ||
* @author mwjames | ||
*/ | ||
class LinksUpdateEmptyParserOutputDBIntegrationTest extends MwDBaseUnitTestCase { | ||
|
||
public function testDoUpdate() { | ||
|
||
$title = Title::newFromText( __METHOD__ ); | ||
$subject = DIWikiPage::newFromTitle( $title ); | ||
|
||
$pageCreator = new PageCreator(); | ||
|
||
$pageCreator | ||
->createPage( $title ) | ||
->doEdit( '[[Has some property::LinksUpdateConstructedOnEmptyParserOutput]]' ); | ||
|
||
$propertiesCountBeforeUpdate = count( $this->getStore()->getSemanticData( $subject )->getProperties() ); | ||
|
||
/** | ||
* See #347 and LinksUpdateConstructed | ||
*/ | ||
$linksUpdate = new LinksUpdate( $title, new ParserOutput() ); | ||
$linksUpdate->doUpdate(); | ||
|
||
/** | ||
* Asserts that before and after the update, the SemanticData container | ||
* holds the same amount of properties despite the fact that the ParserOutput | ||
* was invoked empty | ||
*/ | ||
$this->assertCount( | ||
$propertiesCountBeforeUpdate, | ||
$this->getStore()->getSemanticData( $subject )->getProperties() | ||
); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters