Fix oracle
This commit is contained in:
parent
0be05fdddd
commit
532b8a1ad0
|
@ -76,22 +76,33 @@ class DefaultShareProviderTest extends \Test\TestCase {
|
||||||
|
|
||||||
$qb->insert('share')
|
$qb->insert('share')
|
||||||
->values([
|
->values([
|
||||||
'id' => $qb->expr()->literal(1),
|
|
||||||
'share_type' => $qb->expr()->literal(\OCP\Share::SHARE_TYPE_USER),
|
'share_type' => $qb->expr()->literal(\OCP\Share::SHARE_TYPE_USER),
|
||||||
'share_with' => $qb->expr()->literal('sharedWith'),
|
'share_with' => $qb->expr()->literal('sharedWith'),
|
||||||
'uid_owner' => $qb->expr()->literal('sharedBy'),
|
'uid_owner' => $qb->expr()->literal('sharedBy'),
|
||||||
|
'item_type' => $qb->expr()->literal('file'),
|
||||||
'file_source' => $qb->expr()->literal(42),
|
'file_source' => $qb->expr()->literal(42),
|
||||||
'permissions' => $qb->expr()->literal(13),
|
|
||||||
'file_target' => $qb->expr()->literal('myTarget'),
|
'file_target' => $qb->expr()->literal('myTarget'),
|
||||||
|
'permissions' => $qb->expr()->literal(13),
|
||||||
]);
|
]);
|
||||||
$qb->execute();
|
$qb->execute();
|
||||||
|
|
||||||
|
// Get the id
|
||||||
|
$qb = $this->dbConn->getQueryBuilder();
|
||||||
|
$cursor = $qb->select('id')
|
||||||
|
->from('share')
|
||||||
|
->setMaxResults(1)
|
||||||
|
->orderBy('id', 'DESC')
|
||||||
|
->execute();
|
||||||
|
$id = $cursor->fetch();
|
||||||
|
$id = $id['id'];
|
||||||
|
$cursor->closeCursor();
|
||||||
|
|
||||||
$storage = $this->getMock('OC\Files\Storage\Storage');
|
$storage = $this->getMock('OC\Files\Storage\Storage');
|
||||||
$storage
|
$storage
|
||||||
->expects($this->once())
|
->expects($this->once())
|
||||||
->method('getOwner')
|
->method('getOwner')
|
||||||
->willReturn('shareOwner');
|
->willReturn('shareOwner');
|
||||||
$path = $this->getMock('OCP\Files\Node');
|
$path = $this->getMock('OCP\Files\File');
|
||||||
$path
|
$path
|
||||||
->expects($this->once())
|
->expects($this->once())
|
||||||
->method('getStorage')
|
->method('getStorage')
|
||||||
|
@ -113,9 +124,9 @@ class DefaultShareProviderTest extends \Test\TestCase {
|
||||||
['shareOwner', $shareOwner],
|
['shareOwner', $shareOwner],
|
||||||
]));
|
]));
|
||||||
|
|
||||||
$share = $this->provider->getShareById(1);
|
$share = $this->provider->getShareById($id);
|
||||||
|
|
||||||
$this->assertEquals(1, $share->getId());
|
$this->assertEquals($id, $share->getId());
|
||||||
$this->assertEquals(\OCP\Share::SHARE_TYPE_USER, $share->getShareType());
|
$this->assertEquals(\OCP\Share::SHARE_TYPE_USER, $share->getShareType());
|
||||||
$this->assertEquals($sharedWith, $share->getSharedWith());
|
$this->assertEquals($sharedWith, $share->getSharedWith());
|
||||||
$this->assertEquals($sharedBy, $share->getSharedBy());
|
$this->assertEquals($sharedBy, $share->getSharedBy());
|
||||||
|
@ -132,22 +143,33 @@ class DefaultShareProviderTest extends \Test\TestCase {
|
||||||
|
|
||||||
$qb->insert('share')
|
$qb->insert('share')
|
||||||
->values([
|
->values([
|
||||||
'id' => $qb->expr()->literal(1),
|
|
||||||
'share_type' => $qb->expr()->literal(\OCP\Share::SHARE_TYPE_GROUP),
|
'share_type' => $qb->expr()->literal(\OCP\Share::SHARE_TYPE_GROUP),
|
||||||
'share_with' => $qb->expr()->literal('sharedWith'),
|
'share_with' => $qb->expr()->literal('sharedWith'),
|
||||||
'uid_owner' => $qb->expr()->literal('sharedBy'),
|
'uid_owner' => $qb->expr()->literal('sharedBy'),
|
||||||
|
'item_type' => $qb->expr()->literal('file'),
|
||||||
'file_source' => $qb->expr()->literal(42),
|
'file_source' => $qb->expr()->literal(42),
|
||||||
'permissions' => $qb->expr()->literal(13),
|
|
||||||
'file_target' => $qb->expr()->literal('myTarget'),
|
'file_target' => $qb->expr()->literal('myTarget'),
|
||||||
|
'permissions' => $qb->expr()->literal(13),
|
||||||
]);
|
]);
|
||||||
$qb->execute();
|
$this->assertEquals(1, $qb->execute());
|
||||||
|
|
||||||
|
// Get the id
|
||||||
|
$qb = $this->dbConn->getQueryBuilder();
|
||||||
|
$cursor = $qb->select('id')
|
||||||
|
->from('share')
|
||||||
|
->setMaxResults(1)
|
||||||
|
->orderBy('id', 'DESC')
|
||||||
|
->execute();
|
||||||
|
$id = $cursor->fetch();
|
||||||
|
$id = $id['id'];
|
||||||
|
$cursor->closeCursor();
|
||||||
|
|
||||||
$storage = $this->getMock('OC\Files\Storage\Storage');
|
$storage = $this->getMock('OC\Files\Storage\Storage');
|
||||||
$storage
|
$storage
|
||||||
->expects($this->once())
|
->expects($this->once())
|
||||||
->method('getOwner')
|
->method('getOwner')
|
||||||
->willReturn('shareOwner');
|
->willReturn('shareOwner');
|
||||||
$path = $this->getMock('OCP\Files\Node');
|
$path = $this->getMock('OCP\Files\Folder');
|
||||||
$path
|
$path
|
||||||
->expects($this->once())
|
->expects($this->once())
|
||||||
->method('getStorage')
|
->method('getStorage')
|
||||||
|
@ -173,9 +195,9 @@ class DefaultShareProviderTest extends \Test\TestCase {
|
||||||
->with('sharedWith')
|
->with('sharedWith')
|
||||||
->willReturn($sharedWith);
|
->willReturn($sharedWith);
|
||||||
|
|
||||||
$share = $this->provider->getShareById(1);
|
$share = $this->provider->getShareById($id);
|
||||||
|
|
||||||
$this->assertEquals(1, $share->getId());
|
$this->assertEquals($id, $share->getId());
|
||||||
$this->assertEquals(\OCP\Share::SHARE_TYPE_GROUP, $share->getShareType());
|
$this->assertEquals(\OCP\Share::SHARE_TYPE_GROUP, $share->getShareType());
|
||||||
$this->assertEquals($sharedWith, $share->getSharedWith());
|
$this->assertEquals($sharedWith, $share->getSharedWith());
|
||||||
$this->assertEquals($sharedBy, $share->getSharedBy());
|
$this->assertEquals($sharedBy, $share->getSharedBy());
|
||||||
|
@ -192,17 +214,28 @@ class DefaultShareProviderTest extends \Test\TestCase {
|
||||||
|
|
||||||
$qb->insert('share')
|
$qb->insert('share')
|
||||||
->values([
|
->values([
|
||||||
'id' => $qb->expr()->literal(1),
|
|
||||||
'share_type' => $qb->expr()->literal(\OCP\Share::SHARE_TYPE_LINK),
|
'share_type' => $qb->expr()->literal(\OCP\Share::SHARE_TYPE_LINK),
|
||||||
'share_with' => $qb->expr()->literal('sharedWith'),
|
'share_with' => $qb->expr()->literal('sharedWith'),
|
||||||
'uid_owner' => $qb->expr()->literal('sharedBy'),
|
'uid_owner' => $qb->expr()->literal('sharedBy'),
|
||||||
|
'item_type' => $qb->expr()->literal('file'),
|
||||||
'file_source' => $qb->expr()->literal(42),
|
'file_source' => $qb->expr()->literal(42),
|
||||||
|
'file_target' => $qb->expr()->literal('myTarget'),
|
||||||
'permissions' => $qb->expr()->literal(13),
|
'permissions' => $qb->expr()->literal(13),
|
||||||
'token' => $qb->expr()->literal('token'),
|
'token' => $qb->expr()->literal('token'),
|
||||||
'expiration' => $qb->expr()->literal('2000-01-02 00:00:00'),
|
'expiration' => $qb->expr()->literal('2000-01-02 00:00:00'),
|
||||||
'file_target' => $qb->expr()->literal('myTarget'),
|
|
||||||
]);
|
]);
|
||||||
$qb->execute();
|
$this->assertEquals(1, $qb->execute());
|
||||||
|
|
||||||
|
// Get the id
|
||||||
|
$qb = $this->dbConn->getQueryBuilder();
|
||||||
|
$cursor = $qb->select('id')
|
||||||
|
->from('share')
|
||||||
|
->setMaxResults(1)
|
||||||
|
->orderBy('id', 'DESC')
|
||||||
|
->execute();
|
||||||
|
$id = $cursor->fetch();
|
||||||
|
$id = $id['id'];
|
||||||
|
$cursor->closeCursor();
|
||||||
|
|
||||||
$storage = $this->getMock('OC\Files\Storage\Storage');
|
$storage = $this->getMock('OC\Files\Storage\Storage');
|
||||||
$storage
|
$storage
|
||||||
|
@ -229,9 +262,9 @@ class DefaultShareProviderTest extends \Test\TestCase {
|
||||||
['shareOwner', $shareOwner],
|
['shareOwner', $shareOwner],
|
||||||
]));
|
]));
|
||||||
|
|
||||||
$share = $this->provider->getShareById(1);
|
$share = $this->provider->getShareById($id);
|
||||||
|
|
||||||
$this->assertEquals(1, $share->getId());
|
$this->assertEquals($id, $share->getId());
|
||||||
$this->assertEquals(\OCP\Share::SHARE_TYPE_LINK, $share->getShareType());
|
$this->assertEquals(\OCP\Share::SHARE_TYPE_LINK, $share->getShareType());
|
||||||
$this->assertEquals('sharedWith', $share->getSharedWith());
|
$this->assertEquals('sharedWith', $share->getSharedWith());
|
||||||
$this->assertEquals($sharedBy, $share->getSharedBy());
|
$this->assertEquals($sharedBy, $share->getSharedBy());
|
||||||
|
@ -248,15 +281,27 @@ class DefaultShareProviderTest extends \Test\TestCase {
|
||||||
|
|
||||||
$qb->insert('share')
|
$qb->insert('share')
|
||||||
->values([
|
->values([
|
||||||
'id' => $qb->expr()->literal(1),
|
|
||||||
'share_type' => $qb->expr()->literal(\OCP\Share::SHARE_TYPE_REMOTE),
|
'share_type' => $qb->expr()->literal(\OCP\Share::SHARE_TYPE_REMOTE),
|
||||||
'share_with' => $qb->expr()->literal('sharedWith'),
|
'share_with' => $qb->expr()->literal('sharedWith'),
|
||||||
'uid_owner' => $qb->expr()->literal('sharedBy'),
|
'uid_owner' => $qb->expr()->literal('sharedBy'),
|
||||||
|
'item_type' => $qb->expr()->literal('file'),
|
||||||
'file_source' => $qb->expr()->literal(42),
|
'file_source' => $qb->expr()->literal(42),
|
||||||
'permissions' => $qb->expr()->literal(13),
|
|
||||||
'file_target' => $qb->expr()->literal('myTarget'),
|
'file_target' => $qb->expr()->literal('myTarget'),
|
||||||
|
'permissions' => $qb->expr()->literal(13),
|
||||||
]);
|
]);
|
||||||
$qb->execute();
|
$this->assertEquals(1, $qb->execute());
|
||||||
|
|
||||||
|
// Get the id
|
||||||
|
$qb = $this->dbConn->getQueryBuilder();
|
||||||
|
$cursor = $qb->select('id')
|
||||||
|
->from('share')
|
||||||
|
->setMaxResults(1)
|
||||||
|
->orderBy('id', 'DESC')
|
||||||
|
->execute();
|
||||||
|
$id = $cursor->fetch();
|
||||||
|
$id = $id['id'];
|
||||||
|
$cursor->closeCursor();
|
||||||
|
|
||||||
|
|
||||||
$storage = $this->getMock('OC\Files\Storage\Storage');
|
$storage = $this->getMock('OC\Files\Storage\Storage');
|
||||||
$storage
|
$storage
|
||||||
|
@ -283,9 +328,9 @@ class DefaultShareProviderTest extends \Test\TestCase {
|
||||||
['shareOwner', $shareOwner],
|
['shareOwner', $shareOwner],
|
||||||
]));
|
]));
|
||||||
|
|
||||||
$share = $this->provider->getShareById(1);
|
$share = $this->provider->getShareById($id);
|
||||||
|
|
||||||
$this->assertEquals(1, $share->getId());
|
$this->assertEquals($id, $share->getId());
|
||||||
$this->assertEquals(\OCP\Share::SHARE_TYPE_REMOTE, $share->getShareType());
|
$this->assertEquals(\OCP\Share::SHARE_TYPE_REMOTE, $share->getShareType());
|
||||||
$this->assertEquals('sharedWith', $share->getSharedWith());
|
$this->assertEquals('sharedWith', $share->getSharedWith());
|
||||||
$this->assertEquals($sharedBy, $share->getSharedBy());
|
$this->assertEquals($sharedBy, $share->getSharedBy());
|
||||||
|
@ -301,14 +346,27 @@ class DefaultShareProviderTest extends \Test\TestCase {
|
||||||
$qb = $this->dbConn->getQueryBuilder();
|
$qb = $this->dbConn->getQueryBuilder();
|
||||||
$qb->insert('share')
|
$qb->insert('share')
|
||||||
->values([
|
->values([
|
||||||
'id' => $qb->expr()->literal(1),
|
|
||||||
'share_type' => $qb->expr()->literal(\OCP\Share::SHARE_TYPE_USER),
|
'share_type' => $qb->expr()->literal(\OCP\Share::SHARE_TYPE_USER),
|
||||||
'share_with' => $qb->expr()->literal('sharedWith'),
|
'share_with' => $qb->expr()->literal('sharedWith'),
|
||||||
'uid_owner' => $qb->expr()->literal('sharedBy'),
|
'uid_owner' => $qb->expr()->literal('sharedBy'),
|
||||||
|
'item_type' => $qb->expr()->literal('file'),
|
||||||
'file_source' => $qb->expr()->literal(42),
|
'file_source' => $qb->expr()->literal(42),
|
||||||
|
'file_target' => $qb->expr()->literal('myTarget'),
|
||||||
'permissions' => $qb->expr()->literal(13),
|
'permissions' => $qb->expr()->literal(13),
|
||||||
]);
|
]);
|
||||||
$qb->execute();
|
$this->assertEquals(1, $qb->execute());
|
||||||
|
|
||||||
|
// Get the id
|
||||||
|
$qb = $this->dbConn->getQueryBuilder();
|
||||||
|
$cursor = $qb->select('id')
|
||||||
|
->from('share')
|
||||||
|
->setMaxResults(1)
|
||||||
|
->orderBy('id', 'DESC')
|
||||||
|
->execute();
|
||||||
|
$id = $cursor->fetch();
|
||||||
|
$id = $id['id'];
|
||||||
|
$cursor->closeCursor();
|
||||||
|
|
||||||
|
|
||||||
$path = $this->getMock('OCP\Files\File');
|
$path = $this->getMock('OCP\Files\File');
|
||||||
$path
|
$path
|
||||||
|
@ -330,7 +388,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
|
||||||
$share = $this->getMock('OC\Share20\IShare');
|
$share = $this->getMock('OC\Share20\IShare');
|
||||||
$share
|
$share
|
||||||
->method('getId')
|
->method('getId')
|
||||||
->willReturn(1);
|
->willReturn($id);
|
||||||
$share
|
$share
|
||||||
->expects($this->once())
|
->expects($this->once())
|
||||||
->method('getShareType')
|
->method('getShareType')
|
||||||
|
@ -375,7 +433,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
|
||||||
\OCP\Util::connectHook('OCP\Share', 'post_unshare', $hookListner, 'listen');
|
\OCP\Util::connectHook('OCP\Share', 'post_unshare', $hookListner, 'listen');
|
||||||
|
|
||||||
$hookListnerExpects = [
|
$hookListnerExpects = [
|
||||||
'id' => 1,
|
'id' => $id,
|
||||||
'itemType' => 'file',
|
'itemType' => 'file',
|
||||||
'itemSource' => 42,
|
'itemSource' => 42,
|
||||||
'shareType' => \OCP\Share::SHARE_TYPE_USER,
|
'shareType' => \OCP\Share::SHARE_TYPE_USER,
|
||||||
|
@ -409,41 +467,67 @@ class DefaultShareProviderTest extends \Test\TestCase {
|
||||||
$qb = $this->dbConn->getQueryBuilder();
|
$qb = $this->dbConn->getQueryBuilder();
|
||||||
$qb->insert('share')
|
$qb->insert('share')
|
||||||
->values([
|
->values([
|
||||||
'id' => $qb->expr()->literal(1),
|
|
||||||
'share_type' => $qb->expr()->literal(\OCP\Share::SHARE_TYPE_USER),
|
'share_type' => $qb->expr()->literal(\OCP\Share::SHARE_TYPE_USER),
|
||||||
'share_with' => $qb->expr()->literal('sharedWith'),
|
'share_with' => $qb->expr()->literal('sharedWith'),
|
||||||
'uid_owner' => $qb->expr()->literal('sharedBy'),
|
'uid_owner' => $qb->expr()->literal('sharedBy'),
|
||||||
|
'item_type' => $qb->expr()->literal('file'),
|
||||||
'file_source' => $qb->expr()->literal(42),
|
'file_source' => $qb->expr()->literal(42),
|
||||||
|
'file_target' => $qb->expr()->literal('myTarget'),
|
||||||
'permissions' => $qb->expr()->literal(13),
|
'permissions' => $qb->expr()->literal(13),
|
||||||
]);
|
]);
|
||||||
$qb->execute();
|
$this->assertEquals(1, $qb->execute());
|
||||||
|
|
||||||
|
// Get the id
|
||||||
|
$qb = $this->dbConn->getQueryBuilder();
|
||||||
|
$cursor = $qb->select('id')
|
||||||
|
->from('share')
|
||||||
|
->setMaxResults(1)
|
||||||
|
->orderBy('id', 'DESC')
|
||||||
|
->execute();
|
||||||
|
$id1 = $cursor->fetch();
|
||||||
|
$id1 = $id1['id'];
|
||||||
|
$cursor->closeCursor();
|
||||||
|
|
||||||
|
|
||||||
$qb = $this->dbConn->getQueryBuilder();
|
$qb = $this->dbConn->getQueryBuilder();
|
||||||
$qb->insert('share')
|
$qb->insert('share')
|
||||||
->values([
|
->values([
|
||||||
'id' => $qb->expr()->literal(2),
|
|
||||||
'share_type' => $qb->expr()->literal(\OCP\Share::SHARE_TYPE_USER),
|
'share_type' => $qb->expr()->literal(\OCP\Share::SHARE_TYPE_USER),
|
||||||
'share_with' => $qb->expr()->literal('sharedWith'),
|
'share_with' => $qb->expr()->literal('sharedWith'),
|
||||||
'uid_owner' => $qb->expr()->literal('sharedBy'),
|
'uid_owner' => $qb->expr()->literal('sharedBy'),
|
||||||
|
'item_type' => $qb->expr()->literal('file'),
|
||||||
'file_source' => $qb->expr()->literal(42),
|
'file_source' => $qb->expr()->literal(42),
|
||||||
|
'file_target' => $qb->expr()->literal('myTarget'),
|
||||||
'permissions' => $qb->expr()->literal(13),
|
'permissions' => $qb->expr()->literal(13),
|
||||||
'parent' => $qb->expr()->literal(1),
|
'parent' => $qb->expr()->literal($id1),
|
||||||
]);
|
]);
|
||||||
$qb->execute();
|
$this->assertEquals(1, $qb->execute());
|
||||||
|
|
||||||
|
// Get the id
|
||||||
|
$qb = $this->dbConn->getQueryBuilder();
|
||||||
|
$cursor = $qb->select('id')
|
||||||
|
->from('share')
|
||||||
|
->setMaxResults(1)
|
||||||
|
->orderBy('id', 'DESC')
|
||||||
|
->execute();
|
||||||
|
$id2 = $cursor->fetch();
|
||||||
|
$id2 = $id2['id'];
|
||||||
|
$cursor->closeCursor();
|
||||||
|
|
||||||
|
|
||||||
$qb = $this->dbConn->getQueryBuilder();
|
$qb = $this->dbConn->getQueryBuilder();
|
||||||
$qb->insert('share')
|
$qb->insert('share')
|
||||||
->values([
|
->values([
|
||||||
'id' => $qb->expr()->literal(3),
|
|
||||||
'share_type' => $qb->expr()->literal(\OCP\Share::SHARE_TYPE_USER),
|
'share_type' => $qb->expr()->literal(\OCP\Share::SHARE_TYPE_USER),
|
||||||
'share_with' => $qb->expr()->literal('sharedWith'),
|
'share_with' => $qb->expr()->literal('sharedWith'),
|
||||||
'uid_owner' => $qb->expr()->literal('sharedBy'),
|
'uid_owner' => $qb->expr()->literal('sharedBy'),
|
||||||
|
'item_type' => $qb->expr()->literal('file'),
|
||||||
'file_source' => $qb->expr()->literal(42),
|
'file_source' => $qb->expr()->literal(42),
|
||||||
|
'file_target' => $qb->expr()->literal('myTarget'),
|
||||||
'permissions' => $qb->expr()->literal(13),
|
'permissions' => $qb->expr()->literal(13),
|
||||||
'parent' => $qb->expr()->literal(2),
|
'parent' => $qb->expr()->literal($id2),
|
||||||
]);
|
]);
|
||||||
$qb->execute();
|
$this->assertEquals(1, $qb->execute());
|
||||||
|
|
||||||
|
|
||||||
$storage = $this->getMock('OC\Files\Storage\Storage');
|
$storage = $this->getMock('OC\Files\Storage\Storage');
|
||||||
$storage
|
$storage
|
||||||
|
@ -475,7 +559,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
|
||||||
['shareOwner', $shareOwner],
|
['shareOwner', $shareOwner],
|
||||||
]));
|
]));
|
||||||
|
|
||||||
$share = $this->provider->getShareById(1);
|
$share = $this->provider->getShareById($id1);
|
||||||
$this->provider->delete($share);
|
$this->provider->delete($share);
|
||||||
|
|
||||||
$qb = $this->dbConn->getQueryBuilder();
|
$qb = $this->dbConn->getQueryBuilder();
|
||||||
|
|
Loading…
Reference in New Issue