Skip to content

Commit e6586f8

Browse files
Merge branch 'MAGETWO-70618' of github.com:magento-folks/magento2ce into 2.2-bugs
2 parents 495d0c4 + 86210a7 commit e6586f8

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

app/code/Magento/Customer/Model/Address/AbstractAddress.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,8 @@ public function getStreetLine($number)
230230
*/
231231
public function getStreetFull()
232232
{
233-
return $this->getData('street');
233+
$street = $this->getData('street');
234+
return is_array($street) ? implode("\n", $street) : $street;
234235
}
235236

236237
/**

app/code/Magento/Customer/Test/Unit/Model/Address/AbstractAddressTest.php

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -377,4 +377,27 @@ public function validateDataProvider()
377377
'validated' => [array_merge($data, ['country_id' => $countryId++]), true],
378378
];
379379
}
380+
381+
/**
382+
* @dataProvider getStreetFullDataProvider
383+
*/
384+
public function testGetStreetFullAlwaysReturnsString($expectedResult, $street)
385+
{
386+
$this->model->setData('street', $street);
387+
$this->assertEquals($expectedResult, $this->model->getStreetFull());
388+
}
389+
390+
/**
391+
* @return array
392+
*/
393+
public function getStreetFullDataProvider()
394+
{
395+
return [
396+
[null, null],
397+
['', []],
398+
["first line\nsecond line", ['first line', 'second line']],
399+
['single line', ['single line']],
400+
['single line', 'single line'],
401+
];
402+
}
380403
}

0 commit comments

Comments
 (0)