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.

DatabaseTest.php 1.8KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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. namespace Test\Group;
  26. /**
  27. * Class Database
  28. *
  29. * @group DB
  30. */
  31. class DatabaseTest extends Backend {
  32. private $groups = array();
  33. /**
  34. * get a new unique group name
  35. * test cases can override this in order to clean up created groups
  36. *
  37. * @return string
  38. */
  39. public function getGroupName($name = null) {
  40. $name = parent::getGroupName($name);
  41. $this->groups[] = $name;
  42. return $name;
  43. }
  44. protected function setUp() {
  45. parent::setUp();
  46. $this->backend = new \OC\Group\Database();
  47. }
  48. protected function tearDown() {
  49. foreach ($this->groups as $group) {
  50. $this->backend->deleteGroup($group);
  51. }
  52. parent::tearDown();
  53. }
  54. public function testAddDoubleNoCache() {
  55. $group = $this->getGroupName();
  56. $this->backend->createGroup($group);
  57. $backend = new \OC\Group\Database();
  58. $this->assertFalse($backend->createGroup($group));
  59. }
  60. }