/**
  * @dataProvider annotationDataProvider
  */
 public function testChainableDecoratorAnnotation(array $parameters, array $expected)
 {
     $pageInfoProvider = $this->getMockBuilder('\\SMW\\PageInfo')->disableOriginalConstructor()->getMock();
     $pageInfoProvider->expects($this->atLeastOnce())->method('getModificationDate')->will($this->returnValue($parameters['modificationDate']));
     $semanticData = $this->semanticDataFactory->newEmptySemanticData(__METHOD__);
     $categoryPropertyAnnotator = new CategoryPropertyAnnotator(new NullPropertyAnnotator($semanticData), $parameters['categories']);
     $categoryPropertyAnnotator->setShowHiddenCategoriesState($parameters['settings']['smwgShowHiddenCategories']);
     $categoryPropertyAnnotator->setCategoryInstanceUsageState($parameters['settings']['smwgCategoriesAsInstances']);
     $categoryPropertyAnnotator->setCategoryHierarchyUsageState($parameters['settings']['smwgUseCategoryHierarchy']);
     $sortKeyPropertyAnnotator = new SortKeyPropertyAnnotator($categoryPropertyAnnotator, $parameters['sortkey']);
     $predefinedPropertyAnnotator = new PredefinedPropertyAnnotator($sortKeyPropertyAnnotator, $pageInfoProvider);
     $predefinedPropertyAnnotator->setPredefinedPropertyList($parameters['settings']['smwgPageSpecialProperties']);
     $predefinedPropertyAnnotator->addAnnotation();
     $this->semanticDataValidator->assertThatPropertiesAreSet($expected, $predefinedPropertyAnnotator->getSemanticData());
 }
 /**
  * @dataProvider hiddenCategoriesDataProvider
  */
 public function testAddCategoriesWithHiddenCategories(array $parameters, array $expected)
 {
     $expectedPageLookup = $parameters['settings']['smwgShowHiddenCategories'] ? $this->never() : $this->atLeastOnce();
     $wikiPage = $this->getMockBuilder('\\WikiPage')->disableOriginalConstructor()->getMock();
     $wikiPage->expects($expectedPageLookup)->method('getHiddenCategories')->will($this->returnValue($parameters['hidCategories']));
     $pageCreator = $this->getMockBuilder('\\SMW\\MediaWiki\\PageCreator')->disableOriginalConstructor()->getMock();
     $pageCreator->expects($expectedPageLookup)->method('createPage')->will($this->returnValue($wikiPage));
     $semanticData = $this->semanticDataFactory->setSubject(new DIWikiPage(__METHOD__, $parameters['namespace'], ''))->newEmptySemanticData();
     $this->testEnvironment->registerObject('PageCreator', $pageCreator);
     $instance = new CategoryPropertyAnnotator(new NullPropertyAnnotator($semanticData), $parameters['categories']);
     $instance->setShowHiddenCategoriesState($parameters['settings']['smwgShowHiddenCategories']);
     $instance->setCategoryInstanceUsageState($parameters['settings']['smwgCategoriesAsInstances']);
     $instance->setCategoryHierarchyUsageState($parameters['settings']['smwgUseCategoryHierarchy']);
     $instance->addAnnotation();
     $this->semanticDataValidator->assertThatPropertiesAreSet($expected, $semanticData);
 }
 /**
  * @since 2.0
  *
  * @param SemanticData $semanticData
  * @param array $categories
  *
  * @return CategoryPropertyAnnotator
  */
 public function newCategoryPropertyAnnotator(PropertyAnnotator $propertyAnnotator, array $categories)
 {
     $categoryPropertyAnnotator = new CategoryPropertyAnnotator($propertyAnnotator, $categories);
     $categoryPropertyAnnotator->setShowHiddenCategoriesState(ApplicationFactory::getInstance()->getSettings()->get('smwgShowHiddenCategories'));
     $categoryPropertyAnnotator->setCategoryInstanceUsageState(ApplicationFactory::getInstance()->getSettings()->get('smwgCategoriesAsInstances'));
     $categoryPropertyAnnotator->setCategoryHierarchyUsageState(ApplicationFactory::getInstance()->getSettings()->get('smwgUseCategoryHierarchy'));
     return $categoryPropertyAnnotator;
 }