Skip to content

Commit 23f9e1c

Browse files
committed
MAGETWO-64081: Merge branch 'MAGETWO-64081' of github.com:magento-engcom/magento2ce into develop-prs
2 parents c19ce97 + 08aed7d commit 23f9e1c

File tree

3 files changed

+32
-7
lines changed

3 files changed

+32
-7
lines changed

app/code/Magento/Config/Block/System/Config/Form/Field/FieldArray/AbstractFieldArray.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,4 +279,12 @@ public function getColumns()
279279
{
280280
return $this->_columns;
281281
}
282+
283+
/**
284+
* @return string
285+
*/
286+
public function getAddButtonLabel()
287+
{
288+
return $this->_addButtonLabel;
289+
}
282290
}

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

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,14 @@
77

88
class AbstractTest extends \PHPUnit_Framework_TestCase
99
{
10-
public function testGetArrayRows()
10+
/**
11+
* @var \Magento\Config\Block\System\Config\Form\Field\FieldArray\AbstractFieldArray
12+
*/
13+
private $model;
14+
15+
protected function setUp()
1116
{
12-
/** @var $block \Magento\Config\Block\System\Config\Form\Field\FieldArray\AbstractFieldArray */
13-
$block = $this->getMockForAbstractClass(
17+
$this->model = $this->getMockForAbstractClass(
1418
\Magento\Config\Block\System\Config\Form\Field\FieldArray\AbstractFieldArray::class,
1519
[],
1620
'',
@@ -19,12 +23,15 @@ public function testGetArrayRows()
1923
true,
2024
['escapeHtml']
2125
);
22-
$block->expects($this->any())->method('escapeHtml')->will($this->returnArgument(0));
26+
}
2327

28+
public function testGetArrayRows()
29+
{
30+
$this->model->expects($this->any())->method('escapeHtml')->will($this->returnArgument(0));
2431
$objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
2532
$element = $objectManager->getObject(\Magento\Framework\Data\Form\Element\Multiselect::class);
2633
$element->setValue([['te<s>t' => 't<e>st', 'data&1' => 'da&ta1']]);
27-
$block->setElement($element);
34+
$this->model->setElement($element);
2835
$this->assertEquals(
2936
[
3037
new \Magento\Framework\DataObject(
@@ -36,7 +43,17 @@ public function testGetArrayRows()
3643
]
3744
),
3845
],
39-
$block->getArrayRows()
46+
$this->model->getArrayRows()
4047
);
4148
}
49+
50+
public function testGetAddButtonLabel()
51+
{
52+
$contextMock = $this->getMockBuilder(\Magento\Backend\Block\Template\Context::class)
53+
->disableOriginalConstructor()
54+
->getMock();
55+
$this->model->__construct($contextMock);
56+
57+
$this->assertEquals("Add", $this->model->getAddButtonLabel());
58+
}
4259
}

app/code/Magento/Config/view/adminhtml/templates/system/config/form/field/array.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ $_colspan = $block->isAddAfter() ? 2 : 1;
2828
<tr>
2929
<td colspan="<?php echo count($block->getColumns())+$_colspan; ?>" class="col-actions-add">
3030
<button id="addToEndBtn<?php /* @escapeNotVerified */ echo $_htmlId; ?>" class="action-add" title="<?php /* @escapeNotVerified */ echo __('Add'); ?>" type="button">
31-
<span><?php /* @escapeNotVerified */ echo $block->getAddButtonLabel(); ?><?php /* @escapeNotVerified */ echo __('Add'); ?></span>
31+
<span><?php /* @escapeNotVerified */ echo $block->getAddButtonLabel(); ?></span>
3232
</button>
3333
</td>
3434
</tr>

0 commit comments

Comments
 (0)