Skip to content

Commit 465aedb

Browse files
committed
correct expectations when running tests on swift storage
1 parent 18a58bc commit 465aedb

1 file changed

Lines changed: 37 additions & 12 deletions

File tree

apps/dav/tests/unit/Connector/Sabre/FileTest.php

Lines changed: 37 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,8 @@ public function testPutSingleFile() {
341341
}
342342

343343
public function legalMtimeProvider() {
344-
return [
344+
$primaryStorageConfig = getenv("PRIMARY_STORAGE_CONFIG");
345+
$testValues = [
345346
"string" => [
346347
'HTTP_X_OC_MTIME' => "string",
347348
'expected result' => 0
@@ -374,14 +375,6 @@ public function legalMtimeProvider() {
374375
'HTTP_X_OC_MTIME' => "2345asdf",
375376
'expected result' => 2345
376377
],
377-
"negative int" => [
378-
'HTTP_X_OC_MTIME' => -34,
379-
'expected result' => -34
380-
],
381-
"negative float" => [
382-
'HTTP_X_OC_MTIME' => -34.43,
383-
'expected result' => -34
384-
],
385378
"string castable hex int" => [
386379
'HTTP_X_OC_MTIME' => "0x45adf",
387380
'expected result' => 0
@@ -398,15 +391,47 @@ public function legalMtimeProvider() {
398391
'HTTP_X_OC_MTIME' => PHP_INT_MAX+1,
399392
'expected result' => PHP_INT_MAX
400393
],
394+
];
395+
if ($primaryStorageConfig === "swift") {
396+
$testValuesNegativeMtime = [
397+
"negative int" => [
398+
'HTTP_X_OC_MTIME' => -34,
399+
'expected result' => 0
400+
],
401+
"negative float" => [
402+
'HTTP_X_OC_MTIME' => -34.43,
403+
'expected result' => 0
404+
],
401405
"long negative int" => [
402406
'HTTP_X_OC_MTIME' => PHP_INT_MAX*-1,
403-
'expected result' => PHP_INT_MAX*-1
407+
'expected result' => 0
404408
],
405409
"too long negative int" => [
406410
'HTTP_X_OC_MTIME' => (PHP_INT_MAX*-1)-1,
407-
'expected result' => PHP_INT_MAX*-1
411+
'expected result' => 0
408412
],
409-
];
413+
];
414+
} else {
415+
$testValuesNegativeMtime = [
416+
"negative int" => [
417+
'HTTP_X_OC_MTIME' => -34,
418+
'expected result' => -34
419+
],
420+
"negative float" => [
421+
'HTTP_X_OC_MTIME' => -34.43,
422+
'expected result' => -34
423+
],
424+
"long negative int" => [
425+
'HTTP_X_OC_MTIME' => PHP_INT_MAX*-1,
426+
'expected result' => PHP_INT_MAX*-1
427+
],
428+
"too long negative int" => [
429+
'HTTP_X_OC_MTIME' => (PHP_INT_MAX*-1)-1,
430+
'expected result' => PHP_INT_MAX*-1
431+
],
432+
];
433+
}
434+
return array_merge($testValues, $testValuesNegativeMtime);
410435
}
411436

412437
/**

0 commit comments

Comments
 (0)