Manually change appconfig value for share policy so tests work correctly

This commit is contained in:
Michael Gapczynski 2012-10-09 17:16:59 -04:00
parent 4e6f720f14
commit dc767798c6
1 changed files with 3 additions and 0 deletions

View File

@ -264,6 +264,8 @@ class Test_Share extends UnitTestCase {
} catch (Exception $exception) {
$this->assertEqual($exception->getMessage(), $message);
}
$policy = OC_Appconfig::getValue('core', 'shareapi_share_policy', 'global');
OC_Appconfig::setValue('core', 'shareapi_share_policy', 'groups_only');
$message = 'Sharing test.txt failed, because '.$this->user1.' is not a member of the group '.$this->group2;
try {
OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_GROUP, $this->group2, OCP\Share::PERMISSION_READ);
@ -271,6 +273,7 @@ class Test_Share extends UnitTestCase {
} catch (Exception $exception) {
$this->assertEqual($exception->getMessage(), $message);
}
OC_Appconfig::setValue('core', 'shareapi_share_policy', $policy);
// Valid share
$this->assertTrue(OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_GROUP, $this->group1, OCP\Share::PERMISSION_READ));