diff options
author | Joas Schilling <nickvergessen@gmx.de> | 2014-11-05 12:21:02 +0100 |
---|---|---|
committer | Joas Schilling <nickvergessen@gmx.de> | 2014-11-06 17:36:35 +0100 |
commit | 216ef617db7b0ed6e717fe92867aa11245a4cece (patch) | |
tree | fb0fe7caa652bbcc4c3a5f83f071be643c00af9b /tests/lib/group | |
parent | 62047f86f5828a5743a476177318bc00ca8e453f (diff) | |
download | nextcloud-server-216ef617db7b0ed6e717fe92867aa11245a4cece.tar.gz nextcloud-server-216ef617db7b0ed6e717fe92867aa11245a4cece.zip |
Do not use uniqid in Group and User tests as it is not unique on windows
Diffstat (limited to 'tests/lib/group')
-rw-r--r-- | tests/lib/group/backend.php | 8 | ||||
-rw-r--r-- | tests/lib/group/database.php | 23 | ||||
-rw-r--r-- | tests/lib/group/dummy.php | 3 |
3 files changed, 12 insertions, 22 deletions
diff --git a/tests/lib/group/backend.php b/tests/lib/group/backend.php index 95a5cf5f49c..62c189489d7 100644 --- a/tests/lib/group/backend.php +++ b/tests/lib/group/backend.php @@ -20,7 +20,7 @@ * */ -abstract class Test_Group_Backend extends PHPUnit_Framework_TestCase { +abstract class Test_Group_Backend extends \Test\TestCase { /** * @var OC_Group_Backend $backend */ @@ -33,7 +33,7 @@ abstract class Test_Group_Backend extends PHPUnit_Framework_TestCase { */ public function getGroupName($name = null) { if(is_null($name)) { - return uniqid('test_'); + return $this->getUniqueID('test_'); } else { return $name; } @@ -45,7 +45,7 @@ abstract class Test_Group_Backend extends PHPUnit_Framework_TestCase { * @return string */ public function getUserName() { - return uniqid('test_'); + return $this->getUniqueID('test_'); } public function testAddRemove() { @@ -138,6 +138,4 @@ abstract class Test_Group_Backend extends PHPUnit_Framework_TestCase { $result = $this->backend->countUsersInGroup($group, 'bar'); $this->assertSame(2, $result); } - - } diff --git a/tests/lib/group/database.php b/tests/lib/group/database.php index 9b39ac00452..10958a6ccdc 100644 --- a/tests/lib/group/database.php +++ b/tests/lib/group/database.php @@ -22,36 +22,27 @@ class Test_Group_Database extends Test_Group_Backend { private $groups=array(); - + /** * get a new unique group name * test cases can override this in order to clean up created groups * @return string */ public function getGroupName($name = null) { - if(is_null($name)) { - $name=uniqid('test_'); - } - $this->groups[]=$name; + $name = parent::getGroupName($name); + $this->groups[] = $name; return $name; } - /** - * get a new unique user name - * test cases can override this in order to clean up created user - * @return string - */ - public function getUserName() { - return uniqid('test_'); - } - - public function setUp() { + protected function setUp() { + parent::setUp(); $this->backend=new OC_Group_Database(); } - public function tearDown() { + protected function tearDown() { foreach($this->groups as $group) { $this->backend->deleteGroup($group); } + parent::tearDown(); } } diff --git a/tests/lib/group/dummy.php b/tests/lib/group/dummy.php index 287d6f1a977..b4456c8f7e1 100644 --- a/tests/lib/group/dummy.php +++ b/tests/lib/group/dummy.php @@ -21,7 +21,8 @@ */ class Test_Group_Dummy extends Test_Group_Backend { - public function setUp() { + protected function setUp() { + parent::setUp(); $this->backend=new OC_Group_Dummy(); } } |