FIX: Don't caused HTML tidying to make an unreliable test

This commit is contained in:
Sam Minnee 2014-02-18 18:43:58 +13:00
parent 55fe8eb050
commit 4946376793
1 changed files with 9 additions and 4 deletions

View File

@ -32,15 +32,20 @@ class VersionFeedTest extends SapphireTest {
$page->Title = 'My Unpublished Changed Title';
$page->write();
// Strip spaces from test output because they're not reliably maintained by the HTML Tidier
$cleanDiffOutput = function($val) {
return str_replace(' ','',strip_tags($val));
};
$this->assertContains(
_t('RSSHistory.TITLECHANGED', 'Title has changed:') . 'My Changed Title',
array_map('strip_tags', $page->getDiffedChanges()->column('DiffTitle')),
str_replace(' ' ,'',_t('RSSHistory.TITLECHANGED', 'Title has changed:') . 'My Changed Title'),
array_map($cleanDiffOutput, $page->getDiffedChanges()->column('DiffTitle')),
'Detects published title changes'
);
$this->assertNotContains(
_t('RSSHistory.TITLECHANGED', 'Title has changed:') . 'My Unpublished Changed Title',
array_map('strip_tags', $page->getDiffedChanges()->column('DiffTitle')),
str_replace(' ' ,'',_t('RSSHistory.TITLECHANGED', 'Title has changed:') . 'My Unpublished Changed Title'),
array_map($cleanDiffOutput, $page->getDiffedChanges()->column('DiffTitle')),
'Ignores unpublished title changes'
);
}