diff options
Diffstat (limited to 'build/integration/features/bootstrap/BasicStructure.php')
-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) { |