From 494637679392110195e4734605b7382ad7728dbd Mon Sep 17 00:00:00 2001 From: Sam Minnee Date: Tue, 18 Feb 2014 18:43:58 +1300 Subject: [PATCH] FIX: Don't caused HTML tidying to make an unreliable test --- tests/VersionFeedTest.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/tests/VersionFeedTest.php b/tests/VersionFeedTest.php index f7eef8f..19cf1d1 100644 --- a/tests/VersionFeedTest.php +++ b/tests/VersionFeedTest.php @@ -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' ); }