diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2017-11-27 19:41:48 +0100 |
---|---|---|
committer | Daniel Calviño Sánchez <danxuliu@gmail.com> | 2017-11-27 20:39:45 +0100 |
commit | ffe034abb09b5f73ec50f15c7deb92357765377f (patch) | |
tree | 75b3b61faa7f3a01f4d22ce7cc51b5036e123711 /apps/dav/lib/Connector | |
parent | a5e4c2ea118327a6769abcc1fe4567695082105e (diff) | |
download | nextcloud-server-ffe034abb09b5f73ec50f15c7deb92357765377f.tar.gz nextcloud-server-ffe034abb09b5f73ec50f15c7deb92357765377f.zip |
Don't use runInSeparateProcess
Directly calling "header" in the PHPUnit process causes the "Cannot
modify header information - headers already sent by" error to be thrown.
Instead of running the test in a separate process, which is slower, this
commit wraps the call to "header" in a method that can be mocked in the
tests.
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
Diffstat (limited to 'apps/dav/lib/Connector')
-rw-r--r-- | apps/dav/lib/Connector/Sabre/File.php | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/apps/dav/lib/Connector/Sabre/File.php b/apps/dav/lib/Connector/Sabre/File.php index 2db956a3da8..2d20c0958ff 100644 --- a/apps/dav/lib/Connector/Sabre/File.php +++ b/apps/dav/lib/Connector/Sabre/File.php @@ -235,7 +235,7 @@ class File extends Node implements IFile { if (isset($this->request->server['HTTP_X_OC_MTIME'])) { $mtime = $this->sanitizeMtime($this->request->server['HTTP_X_OC_MTIME']); if ($this->fileView->touch($this->path, $mtime)) { - header('X-OC-MTime: accepted'); + $this->header('X-OC-MTime: accepted'); } } @@ -492,7 +492,7 @@ class File extends Node implements IFile { if (isset($this->request->server['HTTP_X_OC_MTIME'])) { $mtime = $this->sanitizeMtime($this->request->server['HTTP_X_OC_MTIME']); if ($targetStorage->touch($targetInternalPath, $mtime)) { - header('X-OC-MTime: accepted'); + $this->header('X-OC-MTime: accepted'); } } @@ -605,4 +605,8 @@ class File extends Node implements IFile { public function getChecksum() { return $this->info->getChecksum(); } + + protected function header($string) { + \header($string); + } } |