Skip to content

Commit 24bff33

Browse files
ENGCOM-6371: #25042 Remove logo dimension parameters from layout files #25789
2 parents 64143a1 + 656587b commit 24bff33

File tree

4 files changed

+37
-14
lines changed

4 files changed

+37
-14
lines changed

app/code/Magento/Theme/Block/Html/Header/Logo.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ public function getLogoWidth()
9898
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
9999
);
100100
}
101-
return (int)$this->_data['logo_width'] ? : (int)$this->getLogoImgWidth();
101+
return (int)$this->_data['logo_width'];
102102
}
103103

104104
/**
@@ -114,7 +114,7 @@ public function getLogoHeight()
114114
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
115115
);
116116
}
117-
return (int)$this->_data['logo_height'] ? : (int)$this->getLogoImgHeight();
117+
return (int)$this->_data['logo_height'];
118118
}
119119

120120
/**

app/code/Magento/Theme/Test/Unit/Block/Html/Header/LogoTest.php

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,38 @@ public function testGetLogoSrc()
4444

4545
$this->assertEquals('http://localhost/pub/media/logo/default/image.gif', $block->getLogoSrc());
4646
}
47+
48+
/**
49+
* cover \Magento\Theme\Block\Html\Header\Logo::getLogoHeight
50+
*/
51+
public function testGetLogoHeight()
52+
{
53+
$scopeConfig = $this->createMock(\Magento\Framework\App\Config\ScopeConfigInterface::class);
54+
$scopeConfig->expects($this->once())->method('getValue')->willReturn(null);
55+
56+
$objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
57+
$arguments = [
58+
'scopeConfig' => $scopeConfig,
59+
];
60+
$block = $objectManager->getObject(\Magento\Theme\Block\Html\Header\Logo::class, $arguments);
61+
62+
$this->assertEquals(null, $block->getLogoHeight());
63+
}
64+
65+
/**
66+
* @covers \Magento\Theme\Block\Html\Header\Logo::getLogoWidth
67+
*/
68+
public function testGetLogoWidth()
69+
{
70+
$scopeConfig = $this->createMock(\Magento\Framework\App\Config\ScopeConfigInterface::class);
71+
$scopeConfig->expects($this->once())->method('getValue')->willReturn('170');
72+
73+
$objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
74+
$arguments = [
75+
'scopeConfig' => $scopeConfig,
76+
];
77+
$block = $objectManager->getObject(\Magento\Theme\Block\Html\Header\Logo::class, $arguments);
78+
79+
$this->assertEquals('170', $block->getLogoHeight());
80+
}
4781
}

app/code/Magento/Theme/view/frontend/layout/default.xml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,7 @@
5050
</container>
5151
</container>
5252
<container name="header-wrapper" label="Page Header" as="header-wrapper" htmlTag="div" htmlClass="header content">
53-
<block class="Magento\Theme\Block\Html\Header\Logo" name="logo">
54-
<arguments>
55-
<argument name="logo_img_width" xsi:type="number">189</argument>
56-
<argument name="logo_img_height" xsi:type="number">64</argument>
57-
</arguments>
58-
</block>
53+
<block class="Magento\Theme\Block\Html\Header\Logo" name="logo"/>
5954
</container>
6055
</referenceContainer>
6156
<referenceContainer name="page.top">

app/design/frontend/Magento/luma/Magento_Theme/layout/default.xml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,6 @@
1414
</arguments>
1515
</block>
1616
</referenceContainer>
17-
<referenceBlock name="logo">
18-
<arguments>
19-
<argument name="logo_img_width" xsi:type="number">148</argument>
20-
<argument name="logo_img_height" xsi:type="number">43</argument>
21-
</arguments>
22-
</referenceBlock>
2317
<referenceContainer name="footer">
2418
<block class="Magento\Store\Block\Switcher" name="store_switcher" as="store_switcher" after="footer_links" template="Magento_Store::switch/stores.phtml"/>
2519
</referenceContainer>

0 commit comments

Comments
 (0)