Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

17847 Fixed wrong state title #26569

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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