blob: f6144827bcdf89b950bb291234ab9f1d8e473cfb (
plain)
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
|
<?php
namespace SMW\Tests\Integration\SQLStore;
use SMW\DIProperty;
use SMW\DIWikiPage;
use SMW\Tests\MwDBaseUnitTestCase;
use SMW\Tests\Utils\PageCreator;
use SMW\Tests\Utils\PageDeleter;
use SMW\Tests\Utils\Validators\SemanticDataValidator;
use Title;
/**
*
* @group SMW
* @group SMWExtension
* @group semantic-mediawiki-integration
* @group mediawiki-database
* @group medium
*
* @license GNU GPL v2+
* @since 2.0
*
* @author mwjames
*/
class SubSemanticDataDBIntegrationTest extends MwDBaseUnitTestCase {
private $title;
protected function tearDown() {
$pageDeleter= new PageDeleter();
$pageDeleter->deletePage( $this->title );
parent::tearDown();
}
public function testCreatePageWithSubobject() {
$this->title = Title::newFromText( __METHOD__ );
$pageCreator = new PageCreator();
$pageCreator
->createPage( $this->title )
->doEdit(
'{{#subobject:namedSubobject|AA=Test1|@sortkey=Z}}' .
'{{#subobject:|BB=Test2|@sortkey=Z}}' );
$semanticData = $this->getStore()->getSemanticData( DIWikiPage::newFromTitle( $this->title ) );
$this->assertInstanceOf(
'SMW\SemanticData',
$semanticData->findSubSemanticData( 'namedSubobject' )
);
$expected = [
'propertyCount' => 2,
'properties' => [
new DIProperty( 'AA' ),
new DIProperty( 'BB' ),
new DIProperty( '_SKEY' )
],
'propertyValues' => [
'Test1',
'Test2',
'Z'
]
];
$semanticDataValidator = new SemanticDataValidator();
foreach ( $semanticData->getSubSemanticData() as $subSemanticData ) {
$semanticDataValidator->assertThatPropertiesAreSet(
$expected,
$subSemanticData
);
}
}
}
|