public function testFormatPropertyItemLowUsageThreshold()
 {
     $property = $this->dataItemFactory->newDIProperty('Foo');
     $count = 42;
     $this->settings->set('smwgPropertyLowUsageThreshold', $count + 1);
     $this->settings->set('smwgPDefaultType', '_wpg');
     $instance = new PropertiesQueryPage($this->store, $this->settings);
     $result = $instance->formatResult($this->skin, array($property, $count));
     $this->assertContains('42', $result);
 }
예제 #2
0
 /**
  * @since 1.9
  *
  * @return PropertiesQueryPage
  */
 private function newInstance($result = null, $values = array(), $settings = array())
 {
     $collector = $this->newMockBuilder()->newObject('CacheableResultCollector', array('getResults' => $result));
     $mockStore = $this->newMockBuilder()->newObject('Store', array('getPropertyValues' => $values, 'getPropertiesSpecial' => $collector));
     if ($settings === array()) {
         $settings = array('smwgPDefaultType' => '_wpg', 'smwgPropertyLowUsageThreshold' => 5, 'smwgPropertyZeroCountDisplay' => true);
     }
     $instance = new PropertiesQueryPage($mockStore, $this->newSettings($settings));
     $instance->setContext($this->newContext());
     return $instance;
 }
 /**
  * @see SpecialPage::execute
  */
 public function execute($param)
 {
     $out = $this->getOutput();
     $out->setPageTitle($this->msg('properties')->text());
     $page = new PropertiesQueryPage($this->getStore(), $this->getSettings());
     $page->setContext($this->getContext());
     list($limit, $offset) = $this->getLimitOffset();
     $page->doQuery($offset, $limit, $this->getRequest()->getVal('property'));
     // Ensure locally collected output data is pushed to the output!
     SMWOutputs::commitToOutputPage($out);
 }
 /**
  * @since 1.9
  *
  * @return PropertiesQueryPage
  */
 private function newInstance($result = null, $values = array(), $settings = array())
 {
     $listLookup = $this->getMockBuilder('\\SMW\\SQLStore\\ListLookup')->disableOriginalConstructor()->getMock();
     $listLookup->expects($this->any())->method('fetchList')->will($this->returnValue($result));
     $mockStore = $this->newMockBuilder()->newObject('Store', array('getPropertyValues' => $values, 'getPropertiesSpecial' => $listLookup));
     if ($settings === array()) {
         $settings = array('smwgPDefaultType' => '_wpg', 'smwgPropertyLowUsageThreshold' => 5, 'smwgPropertyZeroCountDisplay' => true);
     }
     $instance = new PropertiesQueryPage($mockStore, $this->newSettings($settings));
     $instance->setContext($this->newContext());
     return $instance;
 }