diff options
author | Daniel Calviño Sánchez <danxuliu@gmail.com> | 2018-02-06 17:55:15 +0100 |
---|---|---|
committer | Roeland Jago Douma <roeland@famdouma.nl> | 2018-04-06 15:59:30 +0200 |
commit | 5a7986c25d45678f6e7aa1aed707721e77c46f65 (patch) | |
tree | 0f4e9cb4de02c7f15d44b9d72522a9f10b1f5413 /build | |
parent | 90fdf83ca7648418f899e28490f65de53fcd31d1 (diff) | |
download | nextcloud-server-5a7986c25d45678f6e7aa1aed707721e77c46f65.tar.gz nextcloud-server-5a7986c25d45678f6e7aa1aed707721e77c46f65.zip |
Fix use of data directory in integration tests
The data directory is not necessarily located at "../..". The proper
directory is now got by running "php console.php config:system:get
datadirectory".
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
Diffstat (limited to 'build')
-rw-r--r-- | build/integration/features/bootstrap/BasicStructure.php | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/build/integration/features/bootstrap/BasicStructure.php b/build/integration/features/bootstrap/BasicStructure.php index 0aead766f2a..b3a45f66cea 100644 --- a/build/integration/features/bootstrap/BasicStructure.php +++ b/build/integration/features/bootstrap/BasicStructure.php @@ -356,8 +356,29 @@ trait BasicStructure { * @param string $text */ public function modifyTextOfFile($user, $filename, $text) { - self::removeFile("../../data/$user/files", "$filename"); - file_put_contents("../../data/$user/files" . "$filename", "$text"); + self::removeFile($this->getDataDirectory() . "/$user/files", "$filename"); + file_put_contents($this->getDataDirectory() . "/$user/files" . "$filename", "$text"); + } + + private function getDataDirectory() { + // Based on "runOcc" from CommandLine trait + $args = ['config:system:get', 'datadirectory']; + $args = array_map(function($arg) { + return escapeshellarg($arg); + }, $args); + $args[] = '--no-ansi --no-warnings'; + $args = implode(' ', $args); + + $descriptor = [ + 0 => ['pipe', 'r'], + 1 => ['pipe', 'w'], + 2 => ['pipe', 'w'], + ]; + $process = proc_open('php console.php ' . $args, $descriptor, $pipes, $ocPath = '../..'); + $lastStdOut = stream_get_contents($pipes[1]); + proc_close($process); + + return trim($lastStdOut); } public function createFileSpecificSize($name, $size) { |