mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
BUGFIX: Ensure diff arrays are one-dimensional
This commit is contained in:
parent
687435a2f1
commit
7ad5f1bb14
@ -174,6 +174,7 @@ class Diff extends \Diff
|
||||
$content = $content ? "true" : "false";
|
||||
}
|
||||
if (is_array($content)) {
|
||||
$content = array_filter($content, 'is_scalar');
|
||||
// Convert array to CSV
|
||||
$content = implode(',', $content);
|
||||
}
|
||||
|
@ -77,4 +77,15 @@ class DiffTest extends SapphireTest
|
||||
|
||||
$this->assertRegExp($expected, $actual);
|
||||
}
|
||||
|
||||
public function testDiffArray()
|
||||
{
|
||||
$from = ['Lorem', ['array here please ignore'], 'ipsum dolor'];
|
||||
$to = 'Lorem,ipsum';
|
||||
$expected = "/^Lorem,ipsum *<del>dolor<\/del> *$/";
|
||||
$actual = Diff::compareHTML($from, $to);
|
||||
|
||||
$this->assertRegExp($expected, $actual);
|
||||
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user