diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2016-02-26 09:32:41 +0100 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2016-02-26 09:32:41 +0100 |
commit | cbde4bb92fd8cbad48f81c36a83b5bc83b5c378d (patch) | |
tree | b4118e81ebd515c02968e3b1a187dd40cf0e5976 | |
parent | 5718402277b3d9a8bd688e3fbbf965bcf19addbe (diff) | |
parent | 9412f6910479ee6ecfcd54ddfd98ea613735e764 (diff) | |
download | nextcloud-server-cbde4bb92fd8cbad48f81c36a83b5bc83b5c378d.tar.gz nextcloud-server-cbde4bb92fd8cbad48f81c36a83b5bc83b5c378d.zip |
Merge pull request #22650 from owncloud/fix_hook
Fix verifyExpirationDate passwordSet argument
-rw-r--r-- | lib/private/share20/manager.php | 2 | ||||
-rw-r--r-- | tests/lib/share20/managertest.php | 5 |
2 files changed, 4 insertions, 3 deletions
diff --git a/lib/private/share20/manager.php b/lib/private/share20/manager.php index 9b33e947557..63119edf504 100644 --- a/lib/private/share20/manager.php +++ b/lib/private/share20/manager.php @@ -280,7 +280,7 @@ class Manager implements IManager { 'expirationDate' => &$expirationDate, 'accepted' => &$accepted, 'message' => &$message, - 'passwordSet' => $share->getPassword() === null, + 'passwordSet' => $share->getPassword() !== null, ]); if (!$accepted) { diff --git a/tests/lib/share20/managertest.php b/tests/lib/share20/managertest.php index c41f0754396..42610f94715 100644 --- a/tests/lib/share20/managertest.php +++ b/tests/lib/share20/managertest.php @@ -787,7 +787,7 @@ class ManagerTest extends \Test\TestCase { $hookListner = $this->getMockBuilder('Dummy')->setMethods(['listener'])->getMock(); \OCP\Util::connectHook('\OC\Share', 'verifyExpirationDate', $hookListner, 'listener'); $hookListner->expects($this->once())->method('listener')->with($this->callback(function ($data) use ($expected) { - return $data['expirationDate'] == $expected; + return $data['expirationDate'] == $expected && $data['passwordSet'] === false; })); $res = $this->invokePrivate($this->manager, 'validateExpirationDate', [$share]); @@ -799,10 +799,11 @@ class ManagerTest extends \Test\TestCase { $hookListner = $this->getMockBuilder('Dummy')->setMethods(['listener'])->getMock(); \OCP\Util::connectHook('\OC\Share', 'verifyExpirationDate', $hookListner, 'listener'); $hookListner->expects($this->once())->method('listener')->with($this->callback(function ($data) { - return $data['expirationDate'] === null; + return $data['expirationDate'] === null && $data['passwordSet'] === true; })); $share = $this->manager->newShare(); + $share->setPassword('password'); $date = $this->invokePrivate($this->manager, 'validateExpirationDate', [$share]); |