diff options
author | Arthur Schiwon <blizzz@owncloud.com> | 2013-09-25 19:15:27 +0200 |
---|---|---|
committer | Arthur Schiwon <blizzz@owncloud.com> | 2013-09-25 19:15:27 +0200 |
commit | b5ac672864b6d7ac892de0b4c36debd61e4a1588 (patch) | |
tree | 03da59c495a609db86a10ba86bbdeb52de730f14 /tests | |
parent | 1c976a7c9bd27f1fe3f2b1834fd3cbdf5f235bc1 (diff) | |
download | nextcloud-server-b5ac672864b6d7ac892de0b4c36debd61e4a1588.tar.gz nextcloud-server-b5ac672864b6d7ac892de0b4c36debd61e4a1588.zip |
Missing Test for the previous commit
Diffstat (limited to 'tests')
-rw-r--r-- | tests/lib/user.php | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/tests/lib/user.php b/tests/lib/user.php new file mode 100644 index 00000000000..66c7f3f0d74 --- /dev/null +++ b/tests/lib/user.php @@ -0,0 +1,43 @@ +<?php + +/** + * Copyright (c) 2013 Robin Appelman <icewind@owncloud.com> + * This file is licensed under the Affero General Public License version 3 or + * later. + * See the COPYING-README file. + */ + +namespace Test; + +use OC\Hooks\PublicEmitter; + +class User extends \PHPUnit_Framework_TestCase { + + public function testCheckPassword() { + /** + * @var \OC_User_Backend | \PHPUnit_Framework_MockObject_MockObject $backend + */ + $backend = $this->getMock('\OC_User_Dummy'); + $backend->expects($this->once()) + ->method('checkPassword') + ->with($this->equalTo('foo'), $this->equalTo('bar')) + ->will($this->returnValue('foo')); + + $backend->expects($this->any()) + ->method('implementsActions') + ->will($this->returnCallback(function ($actions) { + if ($actions === \OC_USER_BACKEND_CHECK_PASSWORD) { + return true; + } else { + return false; + } + })); + + $manager = \OC_User::getManager(); + $manager->registerBackend($backend); + + $uid = \OC_User::checkPassword('foo', 'bar'); + $this->assertEquals($uid, 'foo'); + } + +}
\ No newline at end of file |