Skip to content

Commit 5422859

Browse files
author
Joan He
committed
MAGETWO-91528: Customizable options truncated when displaying ordered product in admin
- fix static test failures
1 parent 5233b27 commit 5422859

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

app/code/Magento/Sales/Block/Adminhtml/Items/Column/Name.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ class Name extends \Magento\Sales\Block\Adminhtml\Items\Column\DefaultColumn
2929
* @param string &$remainder
3030
* @param bool $breakWords
3131
* @return string
32+
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
3233
*/
3334
public function truncateString($value, $length = 80, $etc = '...', &$remainder = '', $breakWords = true)
3435
{

dev/tests/integration/testsuite/Magento/Framework/Filter/TruncateFilterTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ class TruncateFilterTest extends \PHPUnit\Framework\TestCase
1919
* @dataProvider truncateDataProvider
2020
*/
2121
public function testFilter(
22-
$expectedValue, $expectedRemainder,
22+
$expectedValue,
23+
$expectedRemainder,
2324
$string,
2425
$length = 5,
2526
$etc = '...',

lib/internal/Magento/Framework/Filter/TruncateFilter.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,11 @@ public function filter($string) : Result
9090
$preparedString = $string;
9191
$preparedLength = $length;
9292
if (!$this->breakWords) {
93-
$preparedString = preg_replace('/\s+?(\S+)?$/u', '', $this->stringUtils->substr($string, 0, $length + 1));
93+
$preparedString = preg_replace(
94+
'/\s+?(\S+)?$/u',
95+
'',
96+
$this->stringUtils->substr($string, 0, $length + 1)
97+
);
9498
$preparedLength = $this->stringUtils->strlen($preparedString);
9599
}
96100
$result->setRemainder($this->stringUtils->substr($string, $preparedLength, $originalLength));

0 commit comments

Comments
 (0)