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/tests/unit/Connector/Sabre | |
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/tests/unit/Connector/Sabre')
-rw-r--r-- | apps/dav/tests/unit/Connector/Sabre/FileTest.php | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/apps/dav/tests/unit/Connector/Sabre/FileTest.php b/apps/dav/tests/unit/Connector/Sabre/FileTest.php index 8890654c8cc..2bc65b987b7 100644 --- a/apps/dav/tests/unit/Connector/Sabre/FileTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/FileTest.php @@ -310,7 +310,11 @@ class FileTest extends \Test\TestCase { null ); - $file = new \OCA\DAV\Connector\Sabre\File($view, $info, null, $request); + /** @var \OCA\DAV\Connector\Sabre\File | \PHPUnit_Framework_MockObject_MockObject $file */ + $file = $this->getMockBuilder(\OCA\DAV\Connector\Sabre\File::class) + ->setConstructorArgs([$view, $info, null, $request]) + ->setMethods(['header']) + ->getMock(); // beforeMethod locks $view->lockFile($path, ILockingProvider::LOCK_SHARED); @@ -385,8 +389,6 @@ class FileTest extends \Test\TestCase { /** * Test putting a file with string Mtime - * @runInSeparateProcess - * @preserveGlobalState disabled * @dataProvider legalMtimeProvider */ public function testPutSingleFileLegalMtime($requestMtime, $resultMtime) { @@ -411,8 +413,6 @@ class FileTest extends \Test\TestCase { /** * Test putting a file with string Mtime using chunking - * @runInSeparateProcess - * @preserveGlobalState disabled * @dataProvider legalMtimeProvider */ public function testChunkedPutLegalMtime($requestMtime, $resultMtime) { |