Added tests for security group export

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@63582 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Sam Minnee 2008-10-03 02:26:23 +00:00
parent e434ade827
commit 155269c389
2 changed files with 39 additions and 2 deletions

View File

@ -12,8 +12,10 @@ Page:
URLSegment: home
Group:
admin:
Title: Administrators
admin:
Title: Administrators
empty:
Title: Empty Group
Member:
admin:

View File

@ -0,0 +1,35 @@
<?php
class SecurityAdminTest extends FunctionalTest {
static $fixture_file = 'cms/tests/CMSMainTest.yml';
function testGroupExport() {
$this->session()->inst_set('loggedInAs', $this->idFromFixture('Member', 'admin'));
/* First, open the applicable group */
$this->get('admin/security/getitem?ID=' . $this->idFromFixture('Group','admin'));
$this->assertRegExp('/<input[^>]+id="Form_EditForm_Title"[^>]+value="Administrators"[^>]*>/',$this->content());
/* Then load the export page */
$this->get('admin/security//EditForm/field/Members/export');
$this->assertRegExp('/"FirstName","Surname","Email"/', $this->content());
$this->assertRegExp('/"","","admin@example.com"/', $this->content());
}
function testEmptyGroupExport() {
$this->session()->inst_set('loggedInAs', $this->idFromFixture('Member', 'admin'));
/* First, open the applicable group */
$this->get('admin/security/getitem?ID=' . $this->idFromFixture('Group','empty'));
$this->assertRegExp('/<input[^>]+id="Form_EditForm_Title"[^>]+value="Empty Group"[^>]*>/',$this->content());
/* Then load the export page */
$this->get('admin/security//EditForm/field/Members/export');
$this->assertRegExp('/"FirstName","Surname","Email"/', $this->content());
}
}
?>