aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2014-06-12 14:50:18 +0200
committerVincent Petry <pvince81@owncloud.com>2014-06-12 14:50:18 +0200
commit8e463926a01b63f6e72505a48e131f4589646792 (patch)
tree344e59aa951b33c1eb7a0516657882e269767c3e /tests
parent482eded8b31b257dfed7761c7cb43f35ddcd3408 (diff)
parent19c73a8464f26ec4f49b47fc4ba217b2c899b904 (diff)
downloadnextcloud-server-8e463926a01b63f6e72505a48e131f4589646792.tar.gz
nextcloud-server-8e463926a01b63f6e72505a48e131f4589646792.zip
Merge pull request #9004 from owncloud/cleanup-storages
Added check and cleanup for storage/filecache
Diffstat (limited to 'tests')
-rw-r--r--tests/testcleanuplistener.php26
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/testcleanuplistener.php b/tests/testcleanuplistener.php
index b544c8fbe40..7065f0337b9 100644
--- a/tests/testcleanuplistener.php
+++ b/tests/testcleanuplistener.php
@@ -41,6 +41,12 @@ class TestCleanupListener implements PHPUnit_Framework_TestListener {
}
public function endTestSuite(PHPUnit_Framework_TestSuite $suite) {
+ if ($this->cleanStorages() && $this->isShowSuiteWarning()) {
+ printf("TestSuite '%s': Did not clean up storages\n", $suite->getName());
+ }
+ if ($this->cleanFileCache() && $this->isShowSuiteWarning()) {
+ printf("TestSuite '%s': Did not clean up file cache\n", $suite->getName());
+ }
if ($this->cleanStrayDataFiles() && $this->isShowSuiteWarning()) {
printf("TestSuite '%s': Did not clean up data dir\n", $suite->getName());
}
@@ -114,6 +120,26 @@ class TestCleanupListener implements PHPUnit_Framework_TestListener {
return false;
}
+ private function cleanStorages() {
+ $sql = 'DELETE FROM `*PREFIX*storages`';
+ $query = \OC_DB::prepare( $sql );
+ $result = $query->execute();
+ if ($result > 0) {
+ return true;
+ }
+ return false;
+ }
+
+ private function cleanFileCache() {
+ $sql = 'DELETE FROM `*PREFIX*filecache`';
+ $query = \OC_DB::prepare( $sql );
+ $result = $query->execute();
+ if ($result > 0) {
+ return true;
+ }
+ return false;
+ }
+
private function cleanStrayHooks() {
$hasHooks = false;
$hooks = OC_Hook::getHooks();