Merge pull request #3 from flamerohr/pulls/fix-can-permissions

Add permission tests for editing fix
This commit is contained in:
Damian Mooyman 2016-03-14 14:01:39 +13:00
commit 570157242e

View File

@ -12,14 +12,18 @@ class EditableFormFieldTest extends FunctionalTest {
$text = $this->objFromFixture('EditableTextField', 'basic-text');
$this->logInWithPermission('ADMIN');
$this->assertTrue($text->canCreate());
$this->assertTrue($text->canView());
$this->assertTrue($text->canEdit());
$this->assertTrue($text->canDelete());
$text->setReadonly(true);
$this->assertTrue($text->canView());
$this->assertFalse($text->canEdit());
$this->assertFalse($text->canDelete());
$text->setReadonly(false);
$this->assertTrue($text->canView());
$this->assertTrue($text->canEdit());
$this->assertTrue($text->canDelete());
@ -27,11 +31,15 @@ class EditableFormFieldTest extends FunctionalTest {
$member->logout();
$this->logInWithPermission('SITETREE_VIEW_ALL');
$this->assertFalse($text->canCreate());
$text->setReadonly(false);
$this->assertTrue($text->canView());
$this->assertFalse($text->canEdit());
$this->assertFalse($text->canDelete());
$text->setReadonly(true);
$this->assertTrue($text->canView());
$this->assertFalse($text->canEdit());
$this->assertFalse($text->canDelete());
}