public function testDisabledSubcategoryLookup()
 {
     $store = $this->getMockBuilder('\\SMW\\Store')->disableOriginalConstructor()->getMockForAbstractClass();
     $cache = $this->getMockBuilder('\\Onoi\\Cache\\Cache')->disableOriginalConstructor()->getMock();
     $cache->expects($this->never())->method('contains')->will($this->returnValue(false));
     $instance = new PropertyHierarchyLookup($store, $cache);
     $instance->setSubcategoryDepth(0);
     $this->assertFalse($instance->hasSubcategoryFor(DIWikiPage::newFromText('Foo', NS_CATEGORY)));
 }
 private function doMatchSubcategory(&$subjects, DIWikiPage $category)
 {
     $subcategories = $this->propertyHierarchyLookup->findSubcategoryListFor($category);
     foreach ($subcategories as $subcategory) {
         if ($this->propertyHierarchyLookup->hasSubcategoryFor($subcategory)) {
             $this->doMatchSubcategory($subjects, $subcategory);
         }
         $subjects[] = $subcategory;
     }
 }
 private function doMatchSubcategory(&$subjects, DIWikiPage $category)
 {
     $hash = $category->getHash();
     $subcategories = array();
     // #1713
     // Safeguard against a possible category (or redirect thereof) to point
     // to itself by relying on tracking the hash of already inserted objects
     if (!isset($subjects[$hash])) {
         $subcategories = $this->propertyHierarchyLookup->findSubcategoryListFor($category);
     }
     foreach ($subcategories as $subcategory) {
         $subjects[$subcategory->getHash()] = $subcategory;
         if ($this->propertyHierarchyLookup->hasSubcategoryFor($subcategory)) {
             $this->doMatchSubcategory($subjects, $subcategory);
         }
     }
 }