コード例 #1
0
 /**
  * Issue #241
  */
 public function testCategoryAnnotationForBothColonIdentifier()
 {
     $text = '[[Category:SingleColonNotion]], [[Category::DoubleColonNotion]]';
     $expected = array('propertyCount' => 1, 'propertyties' => array(new DIProperty('_INST'), new DIProperty('Category')), 'propertyValues' => array('SingleColonNotion', 'DoubleColonNotion'));
     $parserData = new ParserData(Title::newFromText(__METHOD__), new ParserOutput());
     $instance = ApplicationFactory::getInstance()->newInTextAnnotationParser($parserData);
     $instance->parse($text);
     $semanticDataValidator = new SemanticDataValidator();
     $semanticDataValidator->assertThatPropertiesAreSet($expected, $parserData->getSemanticData());
 }
コード例 #2
0
 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 = array('propertyCount' => 2, 'properties' => array(new DIProperty('AA'), new DIProperty('BB'), new DIProperty('_SKEY')), 'propertyValues' => array('Test1', 'Test2', 'Z'));
     $semanticDataValidator = new SemanticDataValidator();
     foreach ($semanticData->getSubSemanticData() as $subSemanticData) {
         $semanticDataValidator->assertThatPropertiesAreSet($expected, $subSemanticData);
     }
 }
コード例 #3
0
 protected function assertSemanticDataAfterParse($instance, $expected)
 {
     $parserData = new ParserData($instance->getTitle(), $instance->getOutput());
     $semanticDataValidator = new SemanticDataValidator();
     $semanticDataValidator->assertThatPropertiesAreSet($expected, $parserData->getSemanticData());
 }