Skip to content

Commit 6dc076b

Browse files
author
Dmytro Poperechnyy
committed
MAGETWO-33060: Refactor __() to return Phrase object
- Expected result in unit tests modified for it to contain Phrase objects instead of raw strings;
1 parent 4ba8eab commit 6dc076b

File tree

3 files changed

+8
-18
lines changed

3 files changed

+8
-18
lines changed

dev/tests/unit/testsuite/Magento/CatalogWidget/Model/Rule/Condition/CombineTest.php

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@ protected function setUp()
4545
public function testGetNewChildSelectOptions()
4646
{
4747
$expectedOptions = [
48-
['value' => '', 'label' => 'Please choose a condition to add.'],
49-
['value' => 'Magento\CatalogWidget\Model\Rule\Condition\Combine', 'label' => 'Conditions Combination'],
50-
['label' => 'Product Attribute', 'value' => [
48+
['value' => '', 'label' => __('Please choose a condition to add.')],
49+
['value' => 'Magento\CatalogWidget\Model\Rule\Condition\Combine', 'label' => __('Conditions Combination')],
50+
['label' => __('Product Attribute'), 'value' => [
5151
['value' => 'Magento\CatalogWidget\Model\Rule\Condition\Product|sku', 'label' => 'SKU'],
5252
['value' => 'Magento\CatalogWidget\Model\Rule\Condition\Product|category', 'label' => 'Category'],
5353
]],
@@ -67,12 +67,7 @@ public function testGetNewChildSelectOptions()
6767

6868
$this->conditionFactory->expects($this->atLeastOnce())->method('create')->willReturn($productCondition);
6969

70-
$actualOptions = $this->condition->getNewChildSelectOptions();
71-
foreach ($actualOptions as $key => $option) {
72-
$actualOptions[$key]['label'] = (string)$option['label'];
73-
}
74-
75-
$this->assertSame($expectedOptions, $actualOptions);
70+
$this->assertEquals($expectedOptions, $this->condition->getNewChildSelectOptions());
7671
}
7772

7873
public function testCollectValidatedAttributes()

dev/tests/unit/testsuite/Magento/Core/Model/Layout/MergeTest.php

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -321,22 +321,17 @@ public function testGetAllDesignAbstractions()
321321
$expected = [
322322
'customer_account' => [
323323
'name' => 'customer_account',
324-
'label' => 'Customer My Account (All Pages)',
324+
'label' => __('Customer My Account (All Pages)'),
325325
'design_abstraction' => 'custom',
326326
],
327327
'page_empty' => [
328328
'name' => 'page_empty',
329-
'label' => 'All Empty Layout Pages',
329+
'label' => __('All Empty Layout Pages'),
330330
'design_abstraction' => 'page_layout',
331331
],
332332
];
333333

334-
$actualAbstractions = $this->_model->getAllDesignAbstractions();
335-
foreach ($actualAbstractions as $key => $abstraction) {
336-
$actualAbstractions[$key]['label'] = (string)$abstraction['label'];
337-
}
338-
339-
$this->assertSame($expected, $actualAbstractions);
334+
$this->assertEquals($expected, $this->_model->getAllDesignAbstractions());
340335
}
341336

342337
public function testIsPageLayoutDesignAbstractions()

dev/tests/unit/testsuite/Magento/Tax/Model/Sales/Total/Quote/TaxTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -701,7 +701,7 @@ public function testGetLabel()
701701
{
702702
$objectManager = new ObjectManager($this);
703703
$taxTotalsCalcModel = $objectManager->getObject('Magento\Tax\Model\Sales\Total\Quote\Tax');
704-
$this->assertSame((string)$taxTotalsCalcModel->getLabel(), (string)__('Tax'));
704+
$this->assertEquals($taxTotalsCalcModel->getLabel(), __('Tax'));
705705
}
706706

707707
/**

0 commit comments

Comments
 (0)