You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

database.php 1.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <?php
  2. /**
  3. * @author Arthur Schiwon <blizzz@owncloud.com>
  4. * @author Joas Schilling <nickvergessen@owncloud.com>
  5. * @author Robin Appelman <icewind@owncloud.com>
  6. * @author Scrutinizer Auto-Fixer <auto-fixer@scrutinizer-ci.com>
  7. * @author Thomas Müller <thomas.mueller@tmit.eu>
  8. *
  9. * @copyright Copyright (c) 2015, ownCloud, Inc.
  10. * @license AGPL-3.0
  11. *
  12. * This code is free software: you can redistribute it and/or modify
  13. * it under the terms of the GNU Affero General Public License, version 3,
  14. * as published by the Free Software Foundation.
  15. *
  16. * This program is distributed in the hope that it will be useful,
  17. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  18. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  19. * GNU Affero General Public License for more details.
  20. *
  21. * You should have received a copy of the GNU Affero General Public License, version 3,
  22. * along with this program. If not, see <http://www.gnu.org/licenses/>
  23. *
  24. */
  25. /**
  26. * Class Test_Group_Database
  27. *
  28. * @group DB
  29. */
  30. class Test_Group_Database extends Test_Group_Backend {
  31. private $groups = array();
  32. /**
  33. * get a new unique group name
  34. * test cases can override this in order to clean up created groups
  35. *
  36. * @return string
  37. */
  38. public function getGroupName($name = null) {
  39. $name = parent::getGroupName($name);
  40. $this->groups[] = $name;
  41. return $name;
  42. }
  43. protected function setUp() {
  44. parent::setUp();
  45. $this->backend = new OC_Group_Database();
  46. }
  47. protected function tearDown() {
  48. foreach ($this->groups as $group) {
  49. $this->backend->deleteGroup($group);
  50. }
  51. parent::tearDown();
  52. }
  53. public function testAddDoubleNoCache() {
  54. $group = $this->getGroupName();
  55. $this->backend->createGroup($group);
  56. $backend = new OC_Group_Database();
  57. $this->assertFalse($backend->createGroup($group));
  58. }
  59. }