Skip to content

Commit 257fac9

Browse files
committed
testing tests v4
1 parent 1de88af commit 257fac9

File tree

2 files changed

+19
-5
lines changed

2 files changed

+19
-5
lines changed

tests/TranslatorTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@ class TranslatorTest extends TestCase
66
{
77
public function testTranslation()
88
{
9-
$translator = new Translator();
10-
$this->assertEquals('Hola', $translator->translate('Hello', 'es'));
9+
$translator = new Translator(dir: "./locales/", lang: "en_US");
10+
$this->assertEquals('hello world', $translator->locale('testValues', 'helloWorld'));
1111
}
1212

13-
public function testInvalidLanguage()
13+
/*public function testInvalidLanguage()
1414
{
15-
$translator = new Translator();
15+
$translator = new Translator(dir: "./locales/", lang: "en_US");
1616
$this->expectException(InvalidArgumentException::class);
1717
$translator->translate('Hello', 'invalid-lang');
18-
}
18+
}*/
1919
}

tests/locales/en_US/testValues.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
$l = [
2+
"helloWorld" => "hello world",
3+
"BasedOnNumber" => [
4+
1 => "box",
5+
2 => "boxes",
6+
50 => "a lot of boxes"
7+
],
8+
"thxText" => "Thank you {username} for buying {product}",
9+
"thxTextCounter" => [
10+
1 => "Thank you {username} for buying a piece of {product}",
11+
2 => "Thank you {username} for buying two of {product}",
12+
50 => "Thank you {username} for buying {count} pieces of {product}",
13+
],
14+
];

0 commit comments

Comments
 (0)