diff --git a/app/code/Magento/Sales/Block/Status/Grid/Column/State.php b/app/code/Magento/Sales/Block/Status/Grid/Column/State.php index d2163fae72428..10f8edb524c34 100644 --- a/app/code/Magento/Sales/Block/Status/Grid/Column/State.php +++ b/app/code/Magento/Sales/Block/Status/Grid/Column/State.php @@ -6,6 +6,8 @@ namespace Magento\Sales\Block\Status\Grid\Column; /** + * Column State class + * * @api * @since 100.0.2 */ @@ -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; } } diff --git a/app/code/Magento/Sales/Test/Unit/Block/Status/Grid/Column/StateTest.php b/app/code/Magento/Sales/Test/Unit/Block/Status/Grid/Column/StateTest.php index 86e0c561ca5ee..76ebeb2487ef3 100644 --- a/app/code/Magento/Sales/Test/Unit/Block/Status/Grid/Column/StateTest.php +++ b/app/code/Magento/Sales/Test/Unit/Block/Status/Grid/Column/StateTest.php @@ -55,6 +55,7 @@ public function testDecorateState() [ 'status' => 'fraud', 'state' => 'processing', + 'is_default' => '0', 'label' => 'Suspected Fraud', ] ), @@ -62,6 +63,7 @@ public function testDecorateState() [ 'status' => 'processing', 'state' => 'processing', + 'is_default' => '1', 'label' => 'Processing', ] ) @@ -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); } } diff --git a/app/code/Magento/Sales/Test/Unit/Model/Order/ConfigTest.php b/app/code/Magento/Sales/Test/Unit/Model/Order/ConfigTest.php index feee2816b2cd4..0bd20150cd450 100644 --- a/app/code/Magento/Sales/Test/Unit/Model/Order/ConfigTest.php +++ b/app/code/Magento/Sales/Test/Unit/Model/Order/ConfigTest.php @@ -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 {