mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-07 19:54:15 +08:00
Filter PayPal-supported language codes
This commit is contained in:
parent
e13dfad27c
commit
845a83acb4
4 changed files with 105 additions and 2 deletions
|
@ -0,0 +1,36 @@
|
|||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace WooCommerce\PayPalCommerce\ApiClient\Repository;
|
||||
|
||||
use WooCommerce\PayPalCommerce\ApiClient\TestCase;
|
||||
use WooCommerce\PayPalCommerce\Button\Assets\SmartButton;
|
||||
use function Brain\Monkey\Functions\when;
|
||||
|
||||
class ApplicationContextRepositoryTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @dataProvider provider
|
||||
*/
|
||||
public function test_valid_bcp47_code($input, $output)
|
||||
{
|
||||
$testee = $this->getMockBuilder(ApplicationContextRepository::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$method = new \ReflectionMethod($testee, 'valid_bcp47_code');
|
||||
$method->setAccessible(true);
|
||||
|
||||
when('get_user_locale')->justReturn($input);
|
||||
|
||||
$this->assertSame($output, $method->invoke($testee));
|
||||
}
|
||||
|
||||
public function provider()
|
||||
{
|
||||
return [
|
||||
'de-DE' => ['de-DE', 'de-DE'],
|
||||
'de-DE-formal' => ['de-DE-formal', 'de-DE'],
|
||||
];
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue