mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-04 08:47:23 +08:00
Merge pull request #154 from woocommerce/PCP-138-paypal-payments-doesnt-work-with
Filter PayPal-supported language codes
This commit is contained in:
commit
cc1cd30bb5
3 changed files with 59 additions and 2 deletions
|
@ -0,0 +1,38 @@
|
|||
<?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'],
|
||||
'de' => ['de', 'de'],
|
||||
'ceb' => ['ceb', 'en'],
|
||||
];
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue