[],
[],
],
+ [
+ [],
+ [ [] ],
+ ],
[
[ 'foo' ],
[ 'foo' ],
[ [ 'baz', 'foo' ] ],
],
[
- [ 'baz', 'foo' ],
+ [ Message::rawParam( 'baz' ) ],
+ [ Message::rawParam( 'baz' ) ],
+ ],
+ [
+ [ Message::rawParam( 'baz' ), 'foo' ],
+ [ Message::rawParam( 'baz' ), 'foo' ],
+ ],
+ [
+ [ Message::rawParam( 'baz' ) ],
+ [ [ Message::rawParam( 'baz' ) ] ],
+ ],
+ [
+ [ Message::rawParam( 'baz' ), 'foo' ],
+ [ [ Message::rawParam( 'baz' ), 'foo' ] ],
+ ],
+
+ // Test handling of erroneous input, to detect if it changes
+ [
+ [ [ 'baz', 'foo' ], 'hhh' ],
[ [ 'baz', 'foo' ], 'hhh' ],
],
[
- [ 'baz', 'foo' ],
+ [ [ 'baz', 'foo' ], 'hhh', [ 'ahahahahha' ] ],
[ [ 'baz', 'foo' ], 'hhh', [ 'ahahahahha' ] ],
],
[
- [ 'baz', 'foo' ],
+ [ [ 'baz', 'foo' ], [ 'ahahahahha' ] ],
[ [ 'baz', 'foo' ], [ 'ahahahahha' ] ],
],
[
- [ 'baz' ],
+ [ [ 'baz' ], [ 'ahahahahha' ] ],
[ [ 'baz' ], [ 'ahahahahha' ] ],
],
];
public function testWfMessageParams() {
$this->assertSame( 'Return to $1.', wfMessage( 'returnto' )->text() );
$this->assertSame( 'Return to $1.', wfMessage( 'returnto', [] )->text() );
+ $this->assertSame(
+ 'Return to 1,024.',
+ wfMessage( 'returnto', Message::numParam( 1024 ) )->text()
+ );
+ $this->assertSame(
+ 'Return to 1,024.',
+ wfMessage( 'returnto', [ Message::numParam( 1024 ) ] )->text()
+ );
$this->assertSame(
'You have foo (bar).',
wfMessage( 'youhavenewmessages', 'foo', 'bar' )->text()
'You have foo (bar).',
wfMessage( 'youhavenewmessages', [ 'foo', 'bar' ] )->text()
);
+ $this->assertSame(
+ 'You have 1,024 (bar).',
+ wfMessage(
+ 'youhavenewmessages',
+ Message::numParam( 1024 ), 'bar'
+ )->text()
+ );
+ $this->assertSame(
+ 'You have foo (2,048).',
+ wfMessage(
+ 'youhavenewmessages',
+ 'foo', Message::numParam( 2048 )
+ )->text()
+ );
+ $this->assertSame(
+ 'You have 1,024 (2,048).',
+ wfMessage(
+ 'youhavenewmessages',
+ [ Message::numParam( 1024 ), Message::numParam( 2048 ) ]
+ )->text()
+ );
}
/**
return [
[ '<span>foo</span>', 'parse', '<span>foo</span>', '<span>foo</span>' ],
[ '<span>foo</span>', 'escaped', '<span>foo</span>',
- '<span>foo</span>' ],
+ '<span>foo</span>' ],
[ '<span>foo</span>', 'plain', '<span>foo</span>', '<span>foo</span>' ],
[ '<script>alert(1)</script>', 'parse', '<script>alert(1)</script>',
'<script>alert(1)</script>' ],
[ '<script>alert(1)</script>', 'escaped', '<script>alert(1)</script>',
'<script>alert(1)</script>' ],
[ '<script>alert(1)</script>', 'plain', '<script>alert(1)</script>',
- '<script>alert(1)</script>' ],
+ '<script>alert(1)</script>' ],
];
}
}
/**
- * FIXME: This should not need database, but Language#formatExpiry does (bug 55912)
+ * FIXME: This should not need database, but Language#formatExpiry does (T57912)
* @group Database
* @covers Message::expiryParam
* @covers Message::expiryParams