Skip to content

Commit e43e142

Browse files
committed
Added integration test for Localization::getLocales method
1 parent 6af36f1 commit e43e142

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

tests/Integration/Service/LocalizationTest.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
namespace App\Tests\Integration\Service;
1010

1111
use App\Enum\Language;
12+
use App\Enum\Locale;
1213
use App\Service\Localization;
1314
use Exception;
1415
use PHPUnit\Framework\Attributes\TestDox;
@@ -23,6 +24,7 @@
2324
*/
2425
class 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
{

0 commit comments

Comments
 (0)