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
This commit is contained in:
Ingo Schommer 2009-09-10 05:02:47 +00:00
parent f9e7ec9674
commit 966155a054

View File

@ -15,12 +15,10 @@ class SecurityAdminTest extends FunctionalTest {
/* Then load the export page */ /* Then load the export page */
$this->get('admin/security//EditForm/field/Members/export'); $this->get('admin/security//EditForm/field/Members/export');
$lines = preg_split('/\n/', $this->content());
$this->assertRegExp( $this->assertEquals(count($lines), 3, "Export with members has one content row");
'/"' . _t('MemberTableField.FIRSTNAME') . '","' . _t('MemberTableField.SURNAME') . '","' . _t('MemberTableField.EMAIL') . '"/', $this->assertRegExp('/"","","admin@example.com"/', $lines[1], "Member values are correctly exported");
$this->content()
);
$this->assertRegExp('/"","","admin@example.com"/', $this->content());
} }
function testEmptyGroupExport() { function testEmptyGroupExport() {
@ -32,11 +30,10 @@ class SecurityAdminTest extends FunctionalTest {
/* Then load the export page */ /* Then load the export page */
$this->get('admin/security//EditForm/field/Members/export'); $this->get('admin/security//EditForm/field/Members/export');
$lines = preg_split('/\n/', $this->content());
$this->assertRegExp( $this->assertEquals(count($lines), 2, "Empty export only has header fields and an empty row");
'/"' . _t('MemberTableField.FIRSTNAME') . '","' . _t('MemberTableField.SURNAME') . '","' . _t('MemberTableField.EMAIL') . '"/', $this->assertEquals($lines[1], '', "Empty export only has no content row");
$this->content()
);
} }
} }