/** * @dataProvider provideGetEntityStatus */ public function testGetEntityStatus(EntityContent $content, $status) { $actual = $content->getEntityStatus(); $this->assertEquals($status, $actual); }
/** * @see EntityContent::getEntityStatus() * * An item is considered a stub if it has terms but no statements or sitelinks. * If an item has sitelinks but no statements, it is considered a "linkstub". * If an item has statements, it's not empty nor a stub. * * @see STATUS_LINKSTUB * * @note Will fail of this ItemContent is a redirect. * * @return int */ public function getEntityStatus() { $status = parent::getEntityStatus(); if (!$this->isRedirect()) { $hasSiteLinks = !$this->getItem()->getSiteLinkList()->isEmpty(); if ($status === self::STATUS_EMPTY && $hasSiteLinks) { $status = self::STATUS_LINKSTUB; } elseif ($status === self::STATUS_STUB && $hasSiteLinks) { $status = self::STATUS_LINKSTUB; } } return $status; }