@@ -17,9 +17,19 @@ public function setUp(): void
1717 {
1818 Locale::$ exceptions = false ; // Disable exceptions
1919
20+ $ this ->assertCount (0 , Locale::getLanguages ());
21+
2022 Locale::setLanguageFromArray ('en-US ' , ['hello ' => 'Hello ' , 'world ' => 'World ' , 'helloPlaceholder ' => 'Hello {{name}} {{surname}}! ' , 'numericPlaceholder ' => 'We have {{usersAmount}} users registered. ' , 'multiplePlaceholders ' => 'Lets repeat: {{word}}, {{word}}, {{word}} ' ]); // Set English
23+
24+ $ this ->assertCount (1 , Locale::getLanguages ());
25+
2126 Locale::setLanguageFromArray ('he-IL ' , ['hello ' => 'שלום ' ]); // Set Hebrew
27+
28+ $ this ->assertCount (2 , Locale::getLanguages ());
29+
2230 Locale::setLanguageFromJSON ('hi-IN ' , realpath (__DIR__ .'/../hi-IN.json ' ) ?: '' ); // Set Hindi
31+
32+ $ this ->assertCount (3 , Locale::getLanguages ());
2333 }
2434
2535 public function tearDown (): void
@@ -33,16 +43,24 @@ public function testTexts(): void
3343 $ this ->assertEquals ('Hello ' , $ locale ->getText ('hello ' ));
3444 $ this ->assertEquals ('World ' , $ locale ->getText ('world ' ));
3545
46+ $ translations = $ locale ->getTranslations ();
47+ $ this ->assertCount (5 , $ translations );
48+ $ this ->assertEquals (['hello ' => 'Hello ' , 'world ' => 'World ' , 'helloPlaceholder ' => 'Hello {{name}} {{surname}}! ' , 'numericPlaceholder ' => 'We have {{usersAmount}} users registered. ' , 'multiplePlaceholders ' => 'Lets repeat: {{word}}, {{word}}, {{word}} ' ], $ translations );
49+
3650 $ locale ->setDefault ('hi-IN ' );
3751
3852 $ this ->assertEquals ('Namaste ' , $ locale ->getText ('hello ' ));
3953 $ this ->assertEquals ('Duniya ' , $ locale ->getText ('world ' ));
4054
55+ $ this ->assertCount (2 , $ locale ->getTranslations ());
56+
4157 $ locale ->setDefault ('he-IL ' );
4258
4359 $ this ->assertEquals ('שלום ' , $ locale ->getText ('hello ' ));
4460 // $this->assertEquals('empty', $locale->getText('world', 'empty')); Has been removed in 0.5.0
4561
62+ $ this ->assertCount (1 , $ locale ->getTranslations ());
63+
4664 // Test placeholders
4765 $ locale ->setDefault ('en-US ' );
4866
@@ -65,6 +83,7 @@ public function testTexts(): void
6583
6684 // Test exceptions
6785 $ locale ->setDefault ('he-IL ' );
86+
6887 Locale::$ exceptions = true ;
6988
7089 try {
0 commit comments