Skip to content

Commit fd82bd8

Browse files
author
Maksym Savich
committed
MAGETWO-36484: Unit test code coverage in MLS10
1 parent 356fa1b commit fd82bd8

File tree

2 files changed

+53
-5
lines changed

2 files changed

+53
-5
lines changed

app/code/Magento/Config/Test/Unit/Block/System/Config/Form/Field/FileTest.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,6 @@
1313

1414
class FileTest extends \PHPUnit_Framework_TestCase
1515
{
16-
/**
17-
* @var \PHPUnit_Framework_MockObject_MockObject
18-
*/
19-
protected $_objectManagerMock;
20-
2116
/**
2217
* @var \Magento\Config\Block\System\Config\Form\Field\File
2318
*/
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
<?php
2+
/**
3+
* Copyright © 2015 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
// @codingStandardsIgnoreFile
8+
9+
/**
10+
* Tests for \Magento\Framework\Data\Form\Element\File
11+
*/
12+
namespace Magento\Config\Test\Unit\Block\System\Config\Form\Field;
13+
14+
class HeadingTest extends \PHPUnit_Framework_TestCase
15+
{
16+
/**
17+
* @var \PHPUnit_Framework_MockObject_MockObject
18+
*/
19+
protected $_objectManagerMock;
20+
21+
/**
22+
* @var \Magento\Config\Block\System\Config\Form\Field\File
23+
*/
24+
protected $file;
25+
26+
public function testRender()
27+
{
28+
$htmlId = 'test_HTML_id';
29+
$label = 'test_label';
30+
31+
$elementMock = $this->getMockBuilder('Magento\Framework\Data\Form\Element\AbstractElement')
32+
->disableOriginalConstructor()
33+
->setMethods(['getHtmlId', 'getLabel'])
34+
->getMock();
35+
$elementMock->expects($this->any())->method('getHtmlId')->willReturn($htmlId);
36+
$elementMock->expects($this->any())->method('getLabel')->willReturn($label);
37+
38+
$objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
39+
40+
$heading = $objectManager->getObject('\Magento\Config\Block\System\Config\Form\Field\Heading', []);
41+
42+
$html = $heading->render($elementMock);
43+
44+
$this->assertEquals(
45+
'<tr class="system-fieldset-sub-head" id="row_' . $htmlId . '">' .
46+
'<td colspan="5">' .
47+
'<h4 id="' . $htmlId . '">' . $label . '</h4>' .
48+
'</td>' .
49+
'</tr>',
50+
$html
51+
);
52+
}
53+
}

0 commit comments

Comments
 (0)