* @return string of HTML representing a box.
*/
private static function messageBox( $html, $className, $heading = '' ) {
- if ( $heading ) {
+ if ( $heading !== '' ) {
$html = self::element( 'h2', [], $heading ) . $html;
}
return self::rawElement( 'div', [ 'class' => $className ], $html );
];
// Is it a redirect? If so, where to?
- if ( $title->isRedirect() ) {
+ $redirectTarget = $this->page->getRedirectTarget();
+ if ( $redirectTarget !== null ) {
$pageInfo['header-basic'][] = [
$this->msg( 'pageinfo-redirectsto' ),
- $linkRenderer->makeLink( $this->page->getRedirectTarget() ) .
+ $linkRenderer->makeLink( $redirectTarget ) .
$this->msg( 'word-separator' )->escaped() .
$this->msg( 'parentheses' )->rawParams( $linkRenderer->makeLink(
- $this->page->getRedirectTarget(),
+ $redirectTarget,
$this->msg( 'pageinfo-redirectsto-info' )->text(),
[],
[ 'action' => 'info' ]
Html::errorBox( 'err', 'heading' ),
'<div class="errorbox"><h2>heading</h2>err</div>'
);
+ $this->assertEquals(
+ Html::errorBox( 'err', '0' ),
+ '<div class="errorbox"><h2>0</h2>err</div>'
+ );
}
/**