示例#1
0
 /**
  * @see EntityContent::getEntityPageProperties
  *
  * Records the number of statements in the 'wb-claims' key
  * and the number of sitelinks in the 'wb-sitelinks' key.
  *
  * @return array A map from property names to property values.
  */
 public function getEntityPageProperties()
 {
     $properties = parent::getEntityPageProperties();
     if (!$this->isRedirect()) {
         $item = $this->getItem();
         $properties['wb-claims'] = $item->getStatements()->count();
         $properties['wb-sitelinks'] = $item->getSiteLinkList()->count();
     }
     return $properties;
 }
 /**
  * @dataProvider provideGetEntityPageProperties
  */
 public function testGetEntityPageProperties(EntityContent $content, array $pageProps)
 {
     $actual = $content->getEntityPageProperties();
     foreach ($pageProps as $key => $value) {
         $this->assertArrayHasKey($key, $actual);
         $this->assertEquals($value, $actual[$key], $key);
     }
     $this->assertArrayEquals(array_keys($pageProps), array_keys($actual));
 }
 /**
  * @see EntityContent::getEntityPageProperties
  *
  * Records the number of statements in the 'wb-claims' key.
  *
  * @return array A map from property names to property values.
  */
 public function getEntityPageProperties()
 {
     $properties = parent::getEntityPageProperties();
     $properties['wb-claims'] = $this->getProperty()->getStatements()->count();
     return $properties;
 }