From 37c334a2a6480422f5471dabdf47461148dda147 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Wed, 8 Jul 2020 13:58:04 +0200 Subject: [PATCH] ensure mounts are scanned during tests Signed-off-by: Robin Appelman --- tests/lib/TestCase.php | 2 +- tests/lib/Traits/MountProviderTrait.php | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/lib/TestCase.php b/tests/lib/TestCase.php index b28be47875..88c5b46854 100644 --- a/tests/lib/TestCase.php +++ b/tests/lib/TestCase.php @@ -441,7 +441,7 @@ abstract class TestCase extends \PHPUnit\Framework\TestCase { } } - private function IsDatabaseAccessAllowed() { + protected function IsDatabaseAccessAllowed() { // on travis-ci.org we allow database access in any case - otherwise // this will break all apps right away if (true == getenv('TRAVIS')) { diff --git a/tests/lib/Traits/MountProviderTrait.php b/tests/lib/Traits/MountProviderTrait.php index 0437157e84..379d33ea71 100644 --- a/tests/lib/Traits/MountProviderTrait.php +++ b/tests/lib/Traits/MountProviderTrait.php @@ -33,6 +33,12 @@ trait MountProviderTrait { $this->mounts[$userId] = []; } $this->mounts[$userId][] = ['storage' => $storage, 'mountPoint' => $mountPoint, 'arguments' => $arguments]; + + if ($this->IsDatabaseAccessAllowed()) { + $mount = new MountPoint($storage, $mountPoint, $arguments, $this->storageFactory); + $storage = $mount->getStorage(); + $storage->getScanner()->scan(''); + } } protected function registerStorageWrapper($name, $wrapper) {