mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-06 18:16:38 +08:00
Add Test for ApplicationContextRepository PCP-28
Add new parameter to ::currentContext()
This commit is contained in:
parent
449d3440bd
commit
1d0333026f
1 changed files with 10 additions and 3 deletions
|
@ -18,7 +18,12 @@ class ApplicationContextRepositoryTest extends TestCase
|
||||||
/**
|
/**
|
||||||
* @dataProvider currentContextData
|
* @dataProvider currentContextData
|
||||||
*/
|
*/
|
||||||
public function testCurrentContext(array $container, string $userLocale, array $expected): void
|
public function testCurrentContext(
|
||||||
|
array $container,
|
||||||
|
string $userLocale,
|
||||||
|
string $shippingPreference,
|
||||||
|
array $expected
|
||||||
|
): void
|
||||||
{
|
{
|
||||||
$brandName = 'Acme Corp.';
|
$brandName = 'Acme Corp.';
|
||||||
|
|
||||||
|
@ -38,7 +43,7 @@ class ApplicationContextRepositoryTest extends TestCase
|
||||||
/* @var ApplicationContextRepository $testee */
|
/* @var ApplicationContextRepository $testee */
|
||||||
$testee = $this->buildTestee()[1];
|
$testee = $this->buildTestee()[1];
|
||||||
|
|
||||||
$context = $testee->currentContext();
|
$context = $testee->currentContext($shippingPreference);
|
||||||
|
|
||||||
self::assertInstanceOf(
|
self::assertInstanceOf(
|
||||||
ApplicationContext::class,
|
ApplicationContext::class,
|
||||||
|
@ -66,10 +71,12 @@ class ApplicationContextRepositoryTest extends TestCase
|
||||||
'landing_page' => ApplicationContext::LANDING_PAGE_BILLING,
|
'landing_page' => ApplicationContext::LANDING_PAGE_BILLING,
|
||||||
],
|
],
|
||||||
'user_locale' => 'de_DE',
|
'user_locale' => 'de_DE',
|
||||||
|
'shippingPreference' => ApplicationContext::SHIPPING_PREFERENCE_NO_SHIPPING,
|
||||||
'expected' => [
|
'expected' => [
|
||||||
'locale' => 'de-DE',
|
'locale' => 'de-DE',
|
||||||
'brandName' => 'Acme corp.',
|
'brandName' => 'Acme corp.',
|
||||||
'landingPage' => ApplicationContext::LANDING_PAGE_BILLING,
|
'landingPage' => ApplicationContext::LANDING_PAGE_BILLING,
|
||||||
|
'shippingPreference' => ApplicationContext::SHIPPING_PREFERENCE_NO_SHIPPING,
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue