This commit is contained in:
Paolo A
2024-08-13 13:44:16 +00:00
parent 1bbb23088d
commit e796d76612
4001 changed files with 30101 additions and 40075 deletions

View File

@@ -30,7 +30,7 @@ use Symfony\Contracts\Translation\TranslatorTrait;
*/
class TranslatorTest extends TestCase
{
private $defaultLocale;
private string $defaultLocale;
protected function setUp(): void
{
@@ -114,7 +114,7 @@ class TranslatorTest extends TestCase
$this->assertEquals('en', $translator->getLocale());
}
public function getTransTests()
public static function getTransTests()
{
return [
['Symfony is great!', 'Symfony is great!', []],
@@ -122,7 +122,7 @@ class TranslatorTest extends TestCase
];
}
public function getTransChoiceTests()
public static function getTransChoiceTests()
{
return [
['There are no apples', '{0} There are no apples|{1} There is one apple|]1,Inf] There are %count% apples', 0],
@@ -137,7 +137,7 @@ class TranslatorTest extends TestCase
}
/**
* @dataProvider getInternal
* @dataProvider getInterval
*/
public function testInterval($expected, $number, $interval)
{
@@ -146,7 +146,7 @@ class TranslatorTest extends TestCase
$this->assertEquals($expected, $translator->trans($interval.' foo|[1,Inf[ bar', ['%count%' => $number]));
}
public function getInternal()
public static function getInterval()
{
return [
['foo', 3, '{1,2, 3 ,4}'],
@@ -183,13 +183,14 @@ class TranslatorTest extends TestCase
*/
public function testThrowExceptionIfMatchingMessageCannotBeFound($id, $number)
{
$this->expectException(\InvalidArgumentException::class);
$translator = $this->getTranslator();
$this->expectException(\InvalidArgumentException::class);
$translator->trans($id, ['%count%' => $number]);
}
public function getNonMatchingMessages()
public static function getNonMatchingMessages()
{
return [
['{0} There are no apples|{1} There is one apple', 2],
@@ -199,7 +200,7 @@ class TranslatorTest extends TestCase
];
}
public function getChooseTests()
public static function getChooseTests()
{
return [
['There are no apples', '{0} There are no apples|{1} There is one apple|]1,Inf] There are %count% apples', 0],
@@ -255,13 +256,13 @@ class TranslatorTest extends TestCase
new-line in it. Selector = 0.|{1}This is a text with a
new-line in it. Selector = 1.|[1,Inf]This is a text with a
new-line in it. Selector > 1.', 5],
// with double-quotes and id split accros lines
// with double-quotes and id split across lines
['This is a text with a
new-line in it. Selector = 1.', '{0}This is a text with a
new-line in it. Selector = 0.|{1}This is a text with a
new-line in it. Selector = 1.|[1,Inf]This is a text with a
new-line in it. Selector > 1.', 1],
// with single-quotes and id split accros lines
// with single-quotes and id split across lines
['This is a text with a
new-line in it. Selector > 1.', '{0}This is a text with a
new-line in it. Selector = 0.|{1}This is a text with a
@@ -269,9 +270,9 @@ class TranslatorTest extends TestCase
new-line in it. Selector > 1.', 5],
// with single-quotes and \n in text
['This is a text with a\nnew-line in it. Selector = 0.', '{0}This is a text with a\nnew-line in it. Selector = 0.|{1}This is a text with a\nnew-line in it. Selector = 1.|[1,Inf]This is a text with a\nnew-line in it. Selector > 1.', 0],
// with double-quotes and id split accros lines
// with double-quotes and id split across lines
["This is a text with a\nnew-line in it. Selector = 1.", "{0}This is a text with a\nnew-line in it. Selector = 0.|{1}This is a text with a\nnew-line in it. Selector = 1.|[1,Inf]This is a text with a\nnew-line in it. Selector > 1.", 1],
// esacape pipe
// escape pipe
['This is a text with | in it. Selector = 0.', '{0}This is a text with || in it. Selector = 0.|{1}This is a text with || in it. Selector = 1.', 0],
// Empty plural set (2 plural forms) from a .PO file
['', '|', 1],
@@ -315,7 +316,7 @@ class TranslatorTest extends TestCase
*
* As it is impossible to have this ever complete we should try as hard as possible to have it almost complete.
*/
public function successLangcodes(): array
public static function successLangcodes(): array
{
return [
['1', ['ay', 'bo', 'cgg', 'dz', 'id', 'ja', 'jbo', 'ka', 'kk', 'km', 'ko', 'ky']],
@@ -334,7 +335,7 @@ class TranslatorTest extends TestCase
*
* @return array with nplural together with langcodes
*/
public function failingLangcodes(): array
public static function failingLangcodes(): array
{
return [
['1', ['fa']],