summaryrefslogtreecommitdiffstats
path: root/tests/lib/user
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2014-11-17 16:44:45 +0100
committerMorris Jobke <hey@morrisjobke.de>2014-11-17 16:44:45 +0100
commit146cb920c9daba10da0bd93efab3e64df97224de (patch)
treed55b5e13f4b9903cc23b9946ce188e9ad8c62ad7 /tests/lib/user
parent36528c6ef622876f9d89d3b0fbfafc8e44f569fb (diff)
parent6625d5c88f74edade459ec7e2ee0bfb79f21fedd (diff)
downloadnextcloud-server-146cb920c9daba10da0bd93efab3e64df97224de.tar.gz
nextcloud-server-146cb920c9daba10da0bd93efab3e64df97224de.zip
Merge pull request #12218 from owncloud/issue/10991-fixes
Issue/10991 Make unit tests pass on windows
Diffstat (limited to 'tests/lib/user')
-rw-r--r--tests/lib/user/backend.php21
-rw-r--r--tests/lib/user/database.php13
-rw-r--r--tests/lib/user/dummy.php3
3 files changed, 21 insertions, 16 deletions
diff --git a/tests/lib/user/backend.php b/tests/lib/user/backend.php
index 0d3914c7ca6..c2040f4e3be 100644
--- a/tests/lib/user/backend.php
+++ b/tests/lib/user/backend.php
@@ -30,7 +30,7 @@
* For an example see /tests/lib/user/dummy.php
*/
-abstract class Test_User_Backend extends PHPUnit_Framework_TestCase {
+abstract class Test_User_Backend extends \Test\TestCase {
/**
* @var OC_User_Backend $backend
*/
@@ -42,7 +42,7 @@ abstract class Test_User_Backend extends PHPUnit_Framework_TestCase {
* @return string
*/
public function getUser() {
- return uniqid('test_');
+ return $this->getUniqueID('test_');
}
public function testAddRemove() {
@@ -68,29 +68,29 @@ abstract class Test_User_Backend extends PHPUnit_Framework_TestCase {
$this->assertTrue((array_search($name1, $this->backend->getUsers())!==false));
$this->assertFalse((array_search($name2, $this->backend->getUsers())!==false));
}
-
+
public function testLogin() {
$name1=$this->getUser();
$name2=$this->getUser();
-
+
$this->assertFalse($this->backend->userExists($name1));
$this->assertFalse($this->backend->userExists($name2));
-
+
$this->backend->createUser($name1, 'pass1');
$this->backend->createUser($name2, 'pass2');
-
+
$this->assertTrue($this->backend->userExists($name1));
$this->assertTrue($this->backend->userExists($name2));
-
+
$this->assertSame($name1, $this->backend->checkPassword($name1, 'pass1'));
$this->assertSame($name2, $this->backend->checkPassword($name2, 'pass2'));
-
+
$this->assertFalse($this->backend->checkPassword($name1, 'pass2'));
$this->assertFalse($this->backend->checkPassword($name2, 'pass1'));
-
+
$this->assertFalse($this->backend->checkPassword($name1, 'dummy'));
$this->assertFalse($this->backend->checkPassword($name2, 'foobar'));
-
+
$this->backend->setPassword($name1, 'newpass1');
$this->assertFalse($this->backend->checkPassword($name1, 'pass1'));
$this->assertSame($name1, $this->backend->checkPassword($name1, 'newpass1'));
@@ -112,5 +112,4 @@ abstract class Test_User_Backend extends PHPUnit_Framework_TestCase {
$result = $this->backend->getDisplayNames('bar');
$this->assertSame(2, count($result));
}
-
}
diff --git a/tests/lib/user/database.php b/tests/lib/user/database.php
index a8e497720c2..3a6be1ceee5 100644
--- a/tests/lib/user/database.php
+++ b/tests/lib/user/database.php
@@ -21,22 +21,27 @@
*/
class Test_User_Database extends Test_User_Backend {
+ /** @var array */
+ private $users;
+
public function getUser() {
$user = parent::getUser();
$this->users[]=$user;
return $user;
}
-
- public function setUp() {
+
+ protected function setUp() {
+ parent::setUp();
$this->backend=new OC_User_Database();
}
-
- public function tearDown() {
+
+ protected function tearDown() {
if(!isset($this->users)) {
return;
}
foreach($this->users as $user) {
$this->backend->deleteUser($user);
}
+ parent::tearDown();
}
}
diff --git a/tests/lib/user/dummy.php b/tests/lib/user/dummy.php
index e417fd97603..fcc921de4b1 100644
--- a/tests/lib/user/dummy.php
+++ b/tests/lib/user/dummy.php
@@ -21,7 +21,8 @@
*/
class Test_User_Dummy extends Test_User_Backend {
- public function setUp() {
+ protected function setUp() {
+ parent::setUp();
$this->backend=new OC_User_Dummy();
}
}