/
LinksUpdateEmptyParserOutputDBIntegrationTest.php
64 lines (51 loc) 路 1.45 KB
/
LinksUpdateEmptyParserOutputDBIntegrationTest.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
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()
);
}
}