Skip to content

Commit

Permalink
ENGCOM-6786: 17847 Fixed wrong state title #26569
Browse files Browse the repository at this point in the history
  • Loading branch information
lenaorobei authored Feb 4, 2020
2 parents 241fa71 + 47ae5a2 commit 0b0d98d
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 8 deletions.
17 changes: 11 additions & 6 deletions app/code/Magento/Sales/Block/Status/Grid/Column/State.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
namespace Magento\Sales\Block\Status\Grid\Column;

/**
* Column State class
*
* @api
* @since 100.0.2
*/
Expand Down Expand Up @@ -53,12 +55,15 @@ public function getFrameCallback()
*/
public function decorateState($value, $row, $column, $isExport)
{
$status = $row->getStatus();
if ($value) {
$cell = $value . '[' . $this->_config->getStateLabelByStateAndStatus($value, $status) . ']';
} else {
$cell = $value;
$states = $this->_config->getStates();
if (isset($states[$value])) {
return sprintf(
"%s[%s]",
$value,
$states[$value]
);
}
return $cell;

return $value;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,15 @@ public function testDecorateState()
[
'status' => 'fraud',
'state' => 'processing',
'is_default' => '0',
'label' => 'Suspected Fraud',
]
),
new \Magento\Framework\DataObject(
[
'status' => 'processing',
'state' => 'processing',
'is_default' => '1',
'label' => 'Processing',
]
)
Expand All @@ -78,6 +80,6 @@ public function testDecorateState()
->will($this->returnValue($statuses));

$result = $this->stateColumn->decorateState('processing', $rowMock, $columnMock, false);
$this->assertSame('processing[Suspected Fraud]', $result);
$this->assertSame('processing[Processing]', $result);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
use Magento\Sales\Model\ResourceModel\Order\Status\Collection;

/**
* Class ConfigTest
* Test for Magento\Sales\Model\Order\Config class
*/
class ConfigTest extends \PHPUnit\Framework\TestCase
{
Expand Down

0 comments on commit 0b0d98d

Please sign in to comment.