summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2014-10-23 14:34:39 +0200
committerThomas Müller <thomas.mueller@tmit.eu>2014-10-23 14:34:39 +0200
commit770f643e5cf78493dde576f85fee9c4b66a31f38 (patch)
tree4674725e89d4bb02a8ba012787005e77f5a44c89 /tests
parent6c1871da06d127abdf7ce2fd5d3beb7683fe42a0 (diff)
parent6de8531ace81087ca7177b80dba710806952e753 (diff)
downloadnextcloud-server-770f643e5cf78493dde576f85fee9c4b66a31f38.tar.gz
nextcloud-server-770f643e5cf78493dde576f85fee9c4b66a31f38.zip
Merge pull request #11259 from owncloud/fix-windows-max-depth-test
fixing windows max depth test
Diffstat (limited to 'tests')
-rw-r--r--tests/lib/files/view.php25
1 files changed, 19 insertions, 6 deletions
diff --git a/tests/lib/files/view.php b/tests/lib/files/view.php
index 522535946a5..8d56ecd9003 100644
--- a/tests/lib/files/view.php
+++ b/tests/lib/files/view.php
@@ -588,19 +588,32 @@ class View extends \PHPUnit_Framework_TestCase {
$rootView = new \OC\Files\View('');
$longPath = '';
- // 4000 is the maximum path length in file_cache.path
+ $ds = DIRECTORY_SEPARATOR;
+ /*
+ * 4096 is the maximum path length in file_cache.path in *nix
+ * 1024 is the max path length in mac
+ * 228 is the max path length in windows
+ */
$folderName = 'abcdefghijklmnopqrstuvwxyz012345678901234567890123456789';
- $depth = (4000 / 57);
+ $tmpdirLength = strlen(\OC_Helper::tmpFolder());
+ if (\OC_Util::runningOnWindows()) {
+ $this->markTestSkipped();
+ $depth = ((260 - $tmpdirLength) / 57);
+ }elseif(\OC_Util::runningOnMac()){
+ $depth = ((1024 - $tmpdirLength) / 57);
+ } else {
+ $depth = ((4000 - $tmpdirLength) / 57);
+ }
foreach (range(0, $depth - 1) as $i) {
- $longPath .= '/' . $folderName;
+ $longPath .= $ds . $folderName;
$result = $rootView->mkdir($longPath);
$this->assertTrue($result, "mkdir failed on $i - path length: " . strlen($longPath));
- $result = $rootView->file_put_contents($longPath . '/test.txt', 'lorem');
+ $result = $rootView->file_put_contents($longPath . "{$ds}test.txt", 'lorem');
$this->assertEquals(5, $result, "file_put_contents failed on $i");
$this->assertTrue($rootView->file_exists($longPath));
- $this->assertTrue($rootView->file_exists($longPath . '/test.txt'));
+ $this->assertTrue($rootView->file_exists($longPath . "{$ds}test.txt"));
}
$cache = $storage->getCache();
@@ -617,7 +630,7 @@ class View extends \PHPUnit_Framework_TestCase {
$this->assertTrue(is_array($cachedFile), "No cache entry for file at $i");
$this->assertEquals('test.txt', $cachedFile['name'], "Wrong cache entry for file at $i");
- $longPath .= '/' . $folderName;
+ $longPath .= $ds . $folderName;
}
}