-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- fixes the properties and methods scope
- adds more tests - CS chore
- Loading branch information
Showing
7 changed files
with
116 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<?php | ||
|
||
return [ | ||
|
||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
|
||
namespace Tests\Koded\I18n\Unit; | ||
|
||
use Koded\I18n\ArrayCatalog; | ||
use Koded\I18n\I18n; | ||
use Koded\I18n\I18nCatalog; | ||
use Koded\I18n\NoCatalog; | ||
use Koded\Stdlib\Config; | ||
|
||
class InvalidArrayCatalogTest extends I18nTestCase | ||
{ | ||
public function test_invalid_array() | ||
{ | ||
I18n::register(I18nCatalog::new((new Config) | ||
->set('translation.locale', 'xx_XX') | ||
->set('translation.dir', __DIR__ . '/../Fixtures') | ||
->set('translation.catalog', ArrayCatalog::class) | ||
)); | ||
|
||
$this->assertInstanceOf(NoCatalog::class, I18n::catalogs()['xx_XX'], | ||
'Expected ArrayCatalog, but it fallback to NoCatalog (invalid array)'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
|
||
namespace Tests\Koded\I18n\Unit; | ||
|
||
use Koded\I18n\I18n; | ||
use Koded\I18n\I18nCatalog; | ||
use Koded\I18n\NoCatalog; | ||
use Koded\Stdlib\Config; | ||
use PHPUnit\Framework\TestCase; | ||
|
||
class NormalizeLocaleTest extends TestCase | ||
{ | ||
public function test_should_normalize_locale() | ||
{ | ||
$this->assertSame('mk_MK', I18n::catalogs()['mk_MK']->locale(), | ||
'The locale is normalized'); | ||
} | ||
|
||
protected function setUp(): void | ||
{ | ||
I18n::register(I18nCatalog::new((new Config) | ||
->set('translation.catalog', NoCatalog::class) | ||
->set('translation.locale', 'mk_MK_UTF8') | ||
)); | ||
} | ||
|
||
protected function tearDown(): void | ||
{ | ||
I18n::flush(); | ||
} | ||
} |