}
}
+ protected function shareUserOneTestFileWithUserTwo()
+ {
+ OC_User::setUserId($this->user1);
+ $this->assertTrue(
+ OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_USER, $this->user2, OCP\PERMISSION_READ),
+ 'Failed asserting that user 1 successfully shared text.txt with user 2.'
+ );
+ $this->assertEquals(
+ array('test.txt'),
+ OCP\Share::getItemShared('test', 'test.txt', Test_Share_Backend::FORMAT_SOURCE),
+ 'Failed asserting that test.txt is a shared file of user 1.'
+ );
+
+ OC_User::setUserId($this->user2);
+ $this->assertEquals(
+ array('test.txt'),
+ OCP\Share::getItemSharedWith('test', 'test.txt', Test_Share_Backend::FORMAT_SOURCE),
+ 'Failed asserting that user 2 has access to test.txt after initial sharing.'
+ );
+ }
+
public function testShareWithUser() {
// Invalid shares
$message = 'Sharing test.txt failed, because the user '.$this->user1.' is the item owner';
}
// Valid share
- $this->assertTrue(OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_USER, $this->user2, OCP\PERMISSION_READ));
- $this->assertEquals(array('test.txt'), OCP\Share::getItemShared('test', 'test.txt', Test_Share_Backend::FORMAT_SOURCE));
- OC_User::setUserId($this->user2);
- $this->assertEquals(array('test.txt'), OCP\Share::getItemSharedWith('test', 'test.txt', Test_Share_Backend::FORMAT_SOURCE));
+ $this->shareUserOneTestFileWithUserTwo();
// Attempt to share again
OC_User::setUserId($this->user1);
);
}
- protected function shareUserOneTestFileWithUserTwo()
- {
- OC_User::setUserId($this->user1);
- $this->assertTrue(
- OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_USER, $this->user2, OCP\PERMISSION_READ),
- 'Failed asserting that user 1 successfully shared text.txt with user 2.'
- );
- $this->assertEquals(
- array('test.txt'),
- OCP\Share::getItemShared('test', 'test.txt', Test_Share_Backend::FORMAT_SOURCE),
- 'Failed asserting that test.txt is a shared file of user 1.'
- );
-
- OC_User::setUserId($this->user2);
- $this->assertEquals(
- array('test.txt'),
- OCP\Share::getItemSharedWith('test', 'test.txt', Test_Share_Backend::FORMAT_SOURCE),
- 'Failed asserting that user 2 has access to test.txt after initial sharing.'
- );
- }
-
public function testShareWithGroup() {
// Invalid shares
$message = 'Sharing test.txt failed, because the group foobar does not exist';