silverstripe-comments/tests/CommentAdminTest.php
Robbie Averill c02d851500 FIX Remove providePermissions tests
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.
2017-06-13 11:09:56 +12:00

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;
}
}