-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Intl] Fixed support of Locale::getFallback #24157
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Symfony package. | ||
* | ||
* (c) Fabien Potencier <fabien@symfony.com> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Symfony\Component\Intl\Tests; | ||
|
||
use PHPUnit\Framework\TestCase; | ||
use Symfony\Component\Intl\Locale; | ||
|
||
class LocaleTest extends TestCase | ||
{ | ||
public function provideGetFallbackTests() | ||
{ | ||
$tests = array( | ||
array('sl_Latn_IT', 'sl_Latn_IT_nedis'), | ||
array('sl_Latn', 'sl_Latn_IT'), | ||
array('fr', 'fr_FR'), | ||
array('fr', 'fr-FR'), | ||
array('en', 'fr'), | ||
array('root', 'en'), | ||
array(null, 'root'), | ||
); | ||
|
||
if (function_exists('locale_parse')) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shouldn't we also add these complex locales ( There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have added more tests. |
||
$tests[] = array('sl_Latn_IT', 'sl-Latn-IT-nedis'); | ||
$tests[] = array('sl_Latn', 'sl-Latn_IT'); | ||
} else { | ||
$tests[] = array('sl-Latn-IT', 'sl-Latn-IT-nedis'); | ||
$tests[] = array('sl-Latn', 'sl-Latn-IT'); | ||
} | ||
|
||
return $tests; | ||
} | ||
|
||
/** | ||
* @dataProvider provideGetFallbackTests | ||
*/ | ||
public function testGetFallback($expected, $locale) | ||
{ | ||
$this->assertSame($expected, Locale::getFallback($locale)); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this looks weird to me. This function is part of ext-intl, so the polyfill will never be used when this function exists
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's the point. did I miss something?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah, I missed the fact that this is not a class from the polyfill. so fine