mirror of
https://github.com/silverstripe/silverstripe-comments
synced 2024-10-22 11:05:49 +02:00
c02d851500
Removed the testProvidePermissions case since it is testing localisations that do not exist, and a localisation that belongs to the framework which should not be tested here.
39 lines
982 B
PHP
39 lines
982 B
PHP
<?php
|
|
|
|
class CommentAdminTest extends SapphireTest
|
|
{
|
|
protected $usesDatabase = true;
|
|
|
|
public function testGetEditForm()
|
|
{
|
|
$commentAdmin = new CommentAdmin();
|
|
$this->logInWithPermission('CMS_ACCESS_CommentAdmin');
|
|
$form = $commentAdmin->getEditForm();
|
|
$names = $this->getFormFieldNames($form);
|
|
$expected = array(
|
|
'NewComments',
|
|
'ApprovedComments',
|
|
'SpamComments'
|
|
);
|
|
$this->assertEquals($expected, $names);
|
|
|
|
if ($member = Member::currentUser()) {
|
|
$member->logOut();
|
|
}
|
|
|
|
$form = $commentAdmin->getEditForm();
|
|
}
|
|
|
|
private function getFormFieldNames($form)
|
|
{
|
|
$result = array();
|
|
$fields = $form->Fields();
|
|
$tab = $fields->findOrMakeTab('Root');
|
|
$fields = $tab->FieldList();
|
|
foreach ($fields as $field) {
|
|
array_push($result, $field->getName());
|
|
}
|
|
return $result;
|
|
}
|
|
}
|