@@ -33,22 +33,6 @@ class MerchantPortalTest extends TestCase
3333 */
3434 private $ mageOrder ;
3535
36- /**
37- * @covers ::getOrderMerchantPortalLink
38- */
39- public function testGetOrderMerchantPortalLinkUsesGlobalUrl (): void
40- {
41- $ merchantId = 'K1 ' ;
42- $ this ->dependencyMocks ['apiConfiguration ' ]->method ('getUserName ' )
43- ->willReturn ($ merchantId );
44-
45- $ urlPath = 'merchants/ ' . $ merchantId . '/orders/ ' ;
46- $ result = $ this ->model ->getOrderMerchantPortalLink ($ this ->mageOrder , $ this ->klarnaOrder );
47- $ expected = MerchantPortal::MERCHANT_PORTAL . $ urlPath ;
48-
49- static ::assertEquals ($ result , $ expected );
50- }
51-
5236 protected function setUp (): void
5337 {
5438 $ this ->model = parent ::setUpMocks (MerchantPortal::class);
@@ -64,5 +48,47 @@ protected function setUp(): void
6448 ->willReturn ($ store );
6549 $ this ->mageOrder ->method ('getOrderCurrencyCode ' )
6650 ->willReturn ('currency_code ' );
51+
52+ $ merchantId = 'MERCHANT-123 ' ;
53+ $ this ->dependencyMocks ['apiConfiguration ' ]
54+ ->method ('getUsername ' )
55+ ->willReturn ($ merchantId );
56+ $ this ->klarnaOrder
57+ ->method ('getKlarnaOrderId ' )
58+ ->willReturn ('ORDER-123 ' );
59+ }
60+
61+ /**
62+ * @covers ::getOrderMerchantPortalLink
63+ */
64+ public function testGetOrderMerchantPortalLinkToLive (): void
65+ {
66+ $ this ->dependencyMocks ['apiConfiguration ' ]
67+ ->method ('isTestMode ' )
68+ ->willreturn (false );
69+
70+ $ urlPath = 'orders/ORDER-123?merchantId=MERCHANT-123 ' ;
71+ $ expected = MerchantPortal::MERCHANT_PORTAL . $ urlPath ;
72+
73+ $ result = $ this ->model ->getOrderMerchantPortalLink ($ this ->mageOrder , $ this ->klarnaOrder );
74+
75+ static ::assertEquals ($ result , $ expected );
76+ }
77+
78+ /**
79+ * @covers ::getOrderMerchantPortalLink
80+ */
81+ public function testGetOrderMerchantPortalLinkToTest (): void
82+ {
83+ $ this ->dependencyMocks ['apiConfiguration ' ]
84+ ->method ('isTestMode ' )
85+ ->willreturn (true );
86+
87+ $ urlPath = 'orders/ORDER-123?merchantId=MERCHANT-123 ' ;
88+ $ expected = MerchantPortal::MERCHANT_TEST_PORTAL . $ urlPath ;
89+
90+ $ result = $ this ->model ->getOrderMerchantPortalLink ($ this ->mageOrder , $ this ->klarnaOrder );
91+
92+ static ::assertEquals ($ result , $ expected );
6793 }
6894}
0 commit comments