mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
✅ Test updated no-each logic
Added a test that trigger the DiffEngine::diag. This test when run against the old `each` loop under PHP 7.2 triggers a deprecated warning. #8053
This commit is contained in:
parent
4b3e76a976
commit
33b14e7ec2
@ -54,6 +54,25 @@ class DiffTest extends SapphireTest
|
|||||||
$compare = preg_replace('/[\s\t\n\r]*/', '', $compare);
|
$compare = preg_replace('/[\s\t\n\r]*/', '', $compare);
|
||||||
$expected = preg_replace('/[\s\t\n\r]*/', '', $expected);
|
$expected = preg_replace('/[\s\t\n\r]*/', '', $expected);
|
||||||
|
|
||||||
$this->assertEquals($compare, $expected);
|
$this->assertEquals($expected, $compare);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see https://github.com/silverstripe/silverstripe-framework/issues/8053
|
||||||
|
*/
|
||||||
|
public function testLegacyEachStatement()
|
||||||
|
{
|
||||||
|
$sentenceOne =
|
||||||
|
'Lorem ipsum dolor sit amet, consectetur adipiscing elit.';
|
||||||
|
$sentenceTwo =
|
||||||
|
'Nulla porttitor, ex quis commodo pharetra, diam dui efficitur justo, eu gravida elit eros vel libero.';
|
||||||
|
|
||||||
|
$from = "$sentenceOne $sentenceTwo";
|
||||||
|
$to = "$sentenceTwo $sentenceOne";
|
||||||
|
|
||||||
|
$expected = "<del>$sentenceOne</del> $sentenceTwo <ins>$sentenceOne</ins>";
|
||||||
|
$actual = Diff::compareHTML($from, $to);
|
||||||
|
|
||||||
|
$this->assertEquals($expected, $actual);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user