Skip to content

Commit a1e6e19

Browse files
committed
Merge remote-tracking branch 'origin/MC-30416' into borg-2.4.0
2 parents e759fa5 + 7c35aed commit a1e6e19

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

lib/internal/Magento/Framework/App/AreaList.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
*/
88
namespace Magento\Framework\App;
99

10+
/**
11+
* Lists router area codes & processes resolves FrontEndNames to area codes
12+
*/
1013
class AreaList
1114
{
1215
/**
@@ -72,7 +75,7 @@ public function getCodeByFrontName($frontName)
7275
$resolver = $this->_resolverFactory->create($areaInfo['frontNameResolver']);
7376
$areaInfo['frontName'] = $resolver->getFrontName(true);
7477
}
75-
if ($areaInfo['frontName'] == $frontName) {
78+
if ($areaInfo['frontName'] === $frontName) {
7679
return $areaCode;
7780
}
7881
}

lib/internal/Magento/Framework/App/Test/Unit/AreaListTest.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,19 @@ public function testGetFrontNameWhenAreaCodeAndFrontNameArentSet()
100100
$this->assertSame('test', $model->getArea($code));
101101
}
102102

103+
public function testGetFrontNameWhenFrontNameIsInvalid() : void
104+
{
105+
$this->_model = new AreaList(
106+
$this->objectManagerMock,
107+
$this->_resolverFactory,
108+
[
109+
'testAreaCode' => []
110+
]
111+
);
112+
113+
$this->assertNull($this->_model->getFrontName('0'));
114+
}
115+
103116
public function testGetCodes()
104117
{
105118
$areas = ['area1' => 'value1', 'area2' => 'value2'];

0 commit comments

Comments
 (0)