1
1
<?php
2
2
/**
3
- * Copyright © Magento, Inc. All rights reserved.
4
- * See COPYING.txt for license details .
3
+ * Copyright 2014 Adobe
4
+ * All Rights Reserved .
5
5
*/
6
6
declare (strict_types=1 );
7
7
@@ -624,33 +624,35 @@ public function testGetAllowedCurrencies()
624
624
* @dataProvider isCurrentlySecureDataProvider
625
625
*
626
626
* @param bool $expected
627
- * @param array $value
627
+ * @param array|int|null $value
628
628
* @param bool $requestSecure
629
629
* @param bool $useSecureInFrontend
630
630
* @param string|null $secureBaseUrl
631
631
*/
632
632
public function testIsCurrentlySecure (
633
- $ expected ,
634
- $ value ,
635
- $ requestSecure = false ,
636
- $ useSecureInFrontend = true ,
637
- $ secureBaseUrl = 'https://example.com:443 '
633
+ bool $ expected ,
634
+ array | int | null $ value ,
635
+ bool $ requestSecure = false ,
636
+ bool $ useSecureInFrontend = true ,
637
+ ? string $ secureBaseUrl = 'https://example.com:443 '
638
638
) {
639
639
/* @var ReinitableConfigInterface|MockObject $configMock */
640
- $ configMock = $ this ->getMockForAbstractClass (ReinitableConfigInterface::class);
640
+ $ configMock = $ this ->getMockBuilder (ReinitableConfigInterface::class)
641
+ ->disableOriginalConstructor ()
642
+ ->getMock ();
641
643
$ configMock ->expects ($ this ->any ())
642
644
->method ('getValue ' )
643
645
->willReturnMap ([
644
646
[
645
647
Store::XML_PATH_SECURE_BASE_URL ,
646
648
ScopeInterface::SCOPE_STORE ,
647
- null ,
649
+ 2 ,
648
650
$ secureBaseUrl
649
651
],
650
652
[
651
653
Store::XML_PATH_SECURE_IN_FRONTEND ,
652
654
ScopeInterface::SCOPE_STORE ,
653
- null ,
655
+ 2 ,
654
656
$ useSecureInFrontend
655
657
]
656
658
]);
@@ -670,6 +672,8 @@ public function testIsCurrentlySecure(
670
672
['config ' => $ configMock , 'request ' => $ this ->requestMock ]
671
673
);
672
674
675
+ $ model ->setStoreId (2 );
676
+
673
677
if ($ expected ) {
674
678
$ this ->assertTrue ($ model ->isCurrentlySecure (), "Was expecting this test to show as secure, but it wasn't " );
675
679
} else {
@@ -690,6 +694,7 @@ public static function isCurrentlySecureDataProvider()
690
694
'unsecure request, using registered port, not using secure in frontend ' => [false , 443 , false , false ],
691
695
'unsecure request, no secure base url, not using secure in frontend ' => [false , 443 , false , false , null ],
692
696
'unsecure request, not using registered port, not using secure in frontend ' => [false , 80 , false , false ],
697
+ 'unsecure request, no server setting ' => [false , null , false ],
693
698
];
694
699
}
695
700
0 commit comments