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>
This commit is contained in:
parent
90fdf83ca7
commit
5a7986c25d
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue