コード例 #1
0
 /**
  * @since  1.0
  *
  * @param Title $title
  *
  * @return HtmlBreadcrumbsBuilder
  */
 public function buildBreadcrumbs(Title $title)
 {
     $title->setFragment('');
     $subject = DIWikiPage::newFromTitle($title);
     $this->byPropertyHierarchicalLinksFinder->tryToFindLinksFor($subject);
     $parents = $this->byPropertyHierarchicalLinksFinder->getParents();
     $children = $this->byPropertyHierarchicalLinksFinder->getChildren();
     $parents = $this->tryToUseSubpageHierarchyFallback($subject, $parents);
     $this->formatToFlatList($subject, $parents, $children);
     return $this;
 }
 public function testChildSearchForInvalidPropertyType()
 {
     $subject = new DIWikiPage('Foo', NS_MAIN);
     $store = $this->getMockBuilder('\\SMW\\Store')->disableOriginalConstructor()->getMockForAbstractClass();
     $store->expects($this->atLeastOnce())->method('getPropertyValues')->will($this->returnValue(array()));
     $store->expects($this->never())->method('getPropertySubjects');
     $instance = new ByPropertyHierarchicalLinksFinder($store);
     $instance->setFindClosestDescendantState(true);
     $instance->setPropertySearchPatternByNamespace(array(NS_MAIN => array('_MDAT')));
     $instance->tryToFindLinksFor($subject);
     $this->assertEmpty($instance->getParents());
     $this->assertEmpty($instance->getChildren());
 }