Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't use runInSeparateProcess #28676

Merged
merged 2 commits into from
Aug 15, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions apps/dav/lib/Connector/Sabre/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ public function put($data) {
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');
}
}

Expand Down Expand Up @@ -486,7 +486,7 @@ private function createFileChunked($data) {
$this->request->server ['HTTP_X_OC_MTIME']
);
if ($targetStorage->touch($targetInternalPath, $mtime)) {
header('X-OC-MTime: accepted');
$this->header('X-OC-MTime: accepted');
}
}

Expand Down Expand Up @@ -639,4 +639,8 @@ public function getChecksum($algo = null) {

return '';
}

protected function header($string) {
\header($string);
}
}
12 changes: 6 additions & 6 deletions apps/dav/tests/unit/Connector/Sabre/FileTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,11 @@ private function doPut($path, $viewRoot = null, \OC\AppFramework\Http\Request $r
null
);

$file = new File($view, $info, null, $request);
/** @var File | \PHPUnit_Framework_MockObject_MockObject $file */
$file = $this->getMockBuilder(File::class)
->setConstructorArgs([$view, $info, null, $request])
->setMethods(['header'])
->getMock();

// beforeMethod locks
$view->lockFile($path, ILockingProvider::LOCK_SHARED);
Expand All @@ -351,7 +355,7 @@ public function testPutSingleFile() {
* @return boolean true if negative mtime is supported
*/
private function supportsNegativeMtime() {
return (getenv("PRIMARY_STORAGE_CONFIG") !== "swift");
return !(getenv("RUN_OBJECTSTORE_TESTS") !== false);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this clear as mud to you?
having the 2 "!" - I guess the construction !== false is a way of saying "if true" -> "if RUN_OBJECTSTORE_TESTS" and then the "!" at the front negates that.

but it messes my brain a bit

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but it messes my brain a bit

me too .... I need to understand the initial logic as well ... see rocket chat ....

}

public function legalMtimeProvider() {
Expand Down Expand Up @@ -409,8 +413,6 @@ public function legalMtimeProvider() {

/**
* Test putting a file with string Mtime
* @runInSeparateProcess
* @preserveGlobalState disabled
* @dataProvider legalMtimeProvider
*/
public function testPutSingleFileLegalMtime($requestMtime, $resultMtime) {
Expand All @@ -426,8 +428,6 @@ public function testPutSingleFileLegalMtime($requestMtime, $resultMtime) {

/**
* Test putting a file with string Mtime using chunking
* @runInSeparateProcess
* @preserveGlobalState disabled
* @dataProvider legalMtimeProvider
*/
public function testChunkedPutLegalMtime($requestMtime, $resultMtime) {
Expand Down