Making our diff unit test a bit more forgiving of spaces.

#8053
This commit is contained in:
Maxime Rainville 2018-06-01 13:02:49 +12:00
parent 33b14e7ec2
commit adb64c074a

View File

@ -70,9 +70,11 @@ class DiffTest extends SapphireTest
$from = "$sentenceOne $sentenceTwo";
$to = "$sentenceTwo $sentenceOne";
$expected = "<del>$sentenceOne</del> $sentenceTwo <ins>$sentenceOne</ins>";
// We're cheating our test a little bit here, because depending on what HTML cleaner you have, you'll get
// spaces added or not added around the tags.
$expected = "/^ *<del>$sentenceOne<\/del> *$sentenceTwo *<ins>$sentenceOne<\/ins> *$/";
$actual = Diff::compareHTML($from, $to);
$this->assertEquals($expected, $actual);
$this->assertRegExp($expected, $actual);
}
}