Skip to content

Commit 136cb04

Browse files
committed
25042 Add unit tests for header Logo block image dimension getters
1 parent 9abcf54 commit 136cb04

File tree

1 file changed

+34
-0
lines changed
  • app/code/Magento/Theme/Test/Unit/Block/Html/Header

1 file changed

+34
-0
lines changed

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
}

0 commit comments

Comments
 (0)