File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed
tests/Integration/Service Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change 99namespace App \Tests \Integration \Service ;
1010
1111use App \Enum \Language ;
12+ use App \Enum \Locale ;
1213use App \Service \Localization ;
1314use Exception ;
1415use PHPUnit \Framework \Attributes \TestDox ;
2324 */
2425class LocalizationTest extends KernelTestCase
2526{
27+ #[TestDox('Test that `getLanguages` returns expected ' )]
2628 public function testThatGetLanguagesReturnsExpected (): void
2729 {
2830 $ cache = $ this ->getMockBuilder (CacheInterface::class)->getMock ();
@@ -37,6 +39,21 @@ public function testThatGetLanguagesReturnsExpected(): void
3739 );
3840 }
3941
42+ #[TestDox('Test that `getLocales` returns expected ' )]
43+ public function testThatGetLocalesReturnsExpected (): void
44+ {
45+ $ cache = $ this ->getMockBuilder (CacheInterface::class)->getMock ();
46+ $ logger = $ this ->getMockBuilder (LoggerInterface::class)->getMock ();
47+ $ requestStack = new RequestStack ();
48+
49+ $ expected = Locale::getValues ();
50+
51+ self ::assertSame (
52+ $ expected ,
53+ (new Localization ($ cache , $ logger , $ requestStack ))->getLocales (),
54+ );
55+ }
56+
4057 #[TestDox('Test that `LoggerInterface::error` method is called when `CacheInterface` throws an exception ' )]
4158 public function testThatLoggerIsCalledWhenCacheThrowsAnException (): void
4259 {
You can’t perform that action at this time.
0 commit comments