/** * @dataProvider specialPropertiesDataProvider */ public function testAddSpecialProperties(array $parameters, array $expected) { $semanticData = $this->semanticDataFactory->setSubject($parameters['subject'])->newEmptySemanticData(); $pageInfo = $this->getMockBuilder('\\SMW\\PageInfo')->disableOriginalConstructor()->getMock(); foreach ($parameters['pageInfo'] as $method => $returnValue) { $pageInfo->expects($this->any())->method($method)->will($this->returnValue($returnValue)); } $instance = new PredefinedPropertyAnnotator(new NullPropertyAnnotator($semanticData), $pageInfo); $instance->setPredefinedPropertyList($parameters['settings']['smwgPageSpecialProperties']); $instance->addAnnotation(); $this->semanticDataValidator->assertThatPropertiesAreSet($expected, $instance->getSemanticData()); }
/** * @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()); }