From 966155a0548aef402154251b51868d30102e62ff Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Thu, 10 Sep 2009 05:02:47 +0000 Subject: [PATCH] BUGFIX Made SecurityAdminTest more resilient against changes to localized strings, by inspecting the CSV line-by-line instead git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@86060 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- tests/SecurityAdminTest.php | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/tests/SecurityAdminTest.php b/tests/SecurityAdminTest.php index 9e3a41eb..4522c7eb 100644 --- a/tests/SecurityAdminTest.php +++ b/tests/SecurityAdminTest.php @@ -15,12 +15,10 @@ class SecurityAdminTest extends FunctionalTest { /* Then load the export page */ $this->get('admin/security//EditForm/field/Members/export'); + $lines = preg_split('/\n/', $this->content()); - $this->assertRegExp( - '/"' . _t('MemberTableField.FIRSTNAME') . '","' . _t('MemberTableField.SURNAME') . '","' . _t('MemberTableField.EMAIL') . '"/', - $this->content() - ); - $this->assertRegExp('/"","","admin@example.com"/', $this->content()); + $this->assertEquals(count($lines), 3, "Export with members has one content row"); + $this->assertRegExp('/"","","admin@example.com"/', $lines[1], "Member values are correctly exported"); } function testEmptyGroupExport() { @@ -32,11 +30,10 @@ class SecurityAdminTest extends FunctionalTest { /* Then load the export page */ $this->get('admin/security//EditForm/field/Members/export'); + $lines = preg_split('/\n/', $this->content()); - $this->assertRegExp( - '/"' . _t('MemberTableField.FIRSTNAME') . '","' . _t('MemberTableField.SURNAME') . '","' . _t('MemberTableField.EMAIL') . '"/', - $this->content() - ); + $this->assertEquals(count($lines), 2, "Empty export only has header fields and an empty row"); + $this->assertEquals($lines[1], '', "Empty export only has no content row"); } }