Skip to content

Commit 14241e5

Browse files
committed
Added Unit Test Coverage
1 parent b167225 commit 14241e5

File tree

1 file changed

+16
-11
lines changed

1 file changed

+16
-11
lines changed

app/code/Magento/Store/Test/Unit/Model/StoreTest.php

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
/**
3-
* Copyright © Magento, Inc. All rights reserved.
4-
* See COPYING.txt for license details.
3+
* Copyright 2014 Adobe
4+
* All Rights Reserved.
55
*/
66
declare(strict_types=1);
77

@@ -624,33 +624,35 @@ public function testGetAllowedCurrencies()
624624
* @dataProvider isCurrentlySecureDataProvider
625625
*
626626
* @param bool $expected
627-
* @param array $value
627+
* @param array|int|null $value
628628
* @param bool $requestSecure
629629
* @param bool $useSecureInFrontend
630630
* @param string|null $secureBaseUrl
631631
*/
632632
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'
638638
) {
639639
/* @var ReinitableConfigInterface|MockObject $configMock */
640-
$configMock = $this->getMockForAbstractClass(ReinitableConfigInterface::class);
640+
$configMock = $this->getMockBuilder(ReinitableConfigInterface::class)
641+
->disableOriginalConstructor()
642+
->getMock();
641643
$configMock->expects($this->any())
642644
->method('getValue')
643645
->willReturnMap([
644646
[
645647
Store::XML_PATH_SECURE_BASE_URL,
646648
ScopeInterface::SCOPE_STORE,
647-
null,
649+
2,
648650
$secureBaseUrl
649651
],
650652
[
651653
Store::XML_PATH_SECURE_IN_FRONTEND,
652654
ScopeInterface::SCOPE_STORE,
653-
null,
655+
2,
654656
$useSecureInFrontend
655657
]
656658
]);
@@ -670,6 +672,8 @@ public function testIsCurrentlySecure(
670672
['config' => $configMock, 'request' => $this->requestMock]
671673
);
672674

675+
$model->setStoreId(2);
676+
673677
if ($expected) {
674678
$this->assertTrue($model->isCurrentlySecure(), "Was expecting this test to show as secure, but it wasn't");
675679
} else {
@@ -690,6 +694,7 @@ public static function isCurrentlySecureDataProvider()
690694
'unsecure request, using registered port, not using secure in frontend' => [false, 443, false, false],
691695
'unsecure request, no secure base url, not using secure in frontend' => [false, 443, false, false, null],
692696
'unsecure request, not using registered port, not using secure in frontend' => [false, 80, false, false],
697+
'unsecure request, no server setting' => [false, null, false],
693698
];
694699
}
695700

0 commit comments

Comments
 (0)