diff options
author | Joas Schilling <nickvergessen@owncloud.com> | 2015-12-01 14:53:12 +0100 |
---|---|---|
committer | Joas Schilling <nickvergessen@owncloud.com> | 2015-12-01 15:00:44 +0100 |
commit | 08d07cc4db58a7f11532d73108b63a2f50390bf6 (patch) | |
tree | 5fc6cc0ce5543ab783eb4d6322a53e88252de2a9 /tests/lib | |
parent | 1d0c041ac859603357a580a1a16d382e4b6bdc06 (diff) | |
download | nextcloud-server-08d07cc4db58a7f11532d73108b63a2f50390bf6.tar.gz nextcloud-server-08d07cc4db58a7f11532d73108b63a2f50390bf6.zip |
Fix the unit test by running tearDown() and cleaning tags before the test
Diffstat (limited to 'tests/lib')
-rw-r--r-- | tests/lib/systemtag/systemtagmanagertest.php | 6 | ||||
-rw-r--r-- | tests/lib/systemtag/systemtagobjectmappertest.php | 8 |
2 files changed, 13 insertions, 1 deletions
diff --git a/tests/lib/systemtag/systemtagmanagertest.php b/tests/lib/systemtag/systemtagmanagertest.php index ad06b16e055..8498b85519f 100644 --- a/tests/lib/systemtag/systemtagmanagertest.php +++ b/tests/lib/systemtag/systemtagmanagertest.php @@ -40,9 +40,15 @@ class SystemTagManagerTest extends TestCase { $this->connection = \OC::$server->getDatabaseConnection(); $this->tagManager = new SystemTagManager($this->connection); + $this->pruneTagsTables(); } public function tearDown() { + $this->pruneTagsTables(); + parent::tearDown(); + } + + protected function pruneTagsTables() { $query = $this->connection->getQueryBuilder(); $query->delete(SystemTagObjectMapper::RELATION_TABLE)->execute(); $query->delete(SystemTagManager::TAG_TABLE)->execute(); diff --git a/tests/lib/systemtag/systemtagobjectmappertest.php b/tests/lib/systemtag/systemtagobjectmappertest.php index a4312fa722d..43d0b8c6960 100644 --- a/tests/lib/systemtag/systemtagobjectmappertest.php +++ b/tests/lib/systemtag/systemtagobjectmappertest.php @@ -62,6 +62,7 @@ class SystemTagObjectMapperTest extends TestCase { parent::setUp(); $this->connection = \OC::$server->getDatabaseConnection(); + $this->pruneTagsTables(); $this->tagManager = $this->getMockBuilder('OCP\SystemTag\ISystemTagManager') ->getMock(); @@ -92,9 +93,14 @@ class SystemTagObjectMapperTest extends TestCase { $this->tagMapper->assignTags(1, 'testtype', $this->tag2->getId()); $this->tagMapper->assignTags(2, 'testtype', $this->tag1->getId()); $this->tagMapper->assignTags(3, 'anothertype', $this->tag1->getId()); - } + } public function tearDown() { + $this->pruneTagsTables(); + parent::tearDown(); + } + + protected function pruneTagsTables() { $query = $this->connection->getQueryBuilder(); $query->delete(SystemTagObjectMapper::RELATION_TABLE)->execute(); $query->delete(SystemTagManager::TAG_TABLE)->execute(); |