Manually change appconfig value for share policy so tests work correctly
This commit is contained in:
parent
a0ac64cbd6
commit
0966f1358b
|
@ -264,6 +264,8 @@ class Test_Share extends UnitTestCase {
|
||||||
} catch (Exception $exception) {
|
} catch (Exception $exception) {
|
||||||
$this->assertEqual($exception->getMessage(), $message);
|
$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;
|
$message = 'Sharing test.txt failed, because '.$this->user1.' is not a member of the group '.$this->group2;
|
||||||
try {
|
try {
|
||||||
OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_GROUP, $this->group2, OCP\Share::PERMISSION_READ);
|
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) {
|
} catch (Exception $exception) {
|
||||||
$this->assertEqual($exception->getMessage(), $message);
|
$this->assertEqual($exception->getMessage(), $message);
|
||||||
}
|
}
|
||||||
|
OC_Appconfig::setValue('core', 'shareapi_share_policy', $policy);
|
||||||
|
|
||||||
// Valid share
|
// Valid share
|
||||||
$this->assertTrue(OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_GROUP, $this->group1, OCP\Share::PERMISSION_READ));
|
$this->assertTrue(OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_GROUP, $this->group1, OCP\Share::PERMISSION_READ));
|
||||||
|
|
Loading…
Reference in New Issue