Code Duplication    Length = 10-10 lines in 4 locations

tests/lib/files/view.php 4 locations

@@ 1231-1240 (lines=10) @@
1228
	 * @param string $rootPath
1229
	 * @param string $pathPrefix
1230
	 */
1231
	public function testReadFromWriteLockedPath($rootPath, $pathPrefix) {
1232
		$rootPath = str_replace('{folder}', 'files', $rootPath);
1233
		$pathPrefix = str_replace('{folder}', 'files', $pathPrefix);
1234
1235
		$view = new \OC\Files\View($rootPath);
1236
		$storage = new Temporary(array());
1237
		\OC\Files\Filesystem::mount($storage, [], '/');
1238
		$this->assertTrue($view->lockFile($pathPrefix . '/foo/bar', ILockingProvider::LOCK_EXCLUSIVE));
1239
		$view->lockFile($pathPrefix . '/foo/bar/asd', ILockingProvider::LOCK_SHARED);
1240
	}
1241
1242
	/**
1243
	 * Reading from a files_encryption folder that's being renamed
@@ 1250-1259 (lines=10) @@
1247
	 * @param string $rootPath
1248
	 * @param string $pathPrefix
1249
	 */
1250
	public function testReadFromWriteUnlockablePath($rootPath, $pathPrefix) {
1251
		$rootPath = str_replace('{folder}', 'files_encryption', $rootPath);
1252
		$pathPrefix = str_replace('{folder}', 'files_encryption', $pathPrefix);
1253
1254
		$view = new \OC\Files\View($rootPath);
1255
		$storage = new Temporary(array());
1256
		\OC\Files\Filesystem::mount($storage, [], '/');
1257
		$this->assertFalse($view->lockFile($pathPrefix . '/foo/bar', ILockingProvider::LOCK_EXCLUSIVE));
1258
		$this->assertFalse($view->lockFile($pathPrefix . '/foo/bar/asd', ILockingProvider::LOCK_SHARED));
1259
	}
1260
1261
	/**
1262
	 * e.g. writing a file that's being downloaded
@@ 1271-1280 (lines=10) @@
1268
	 * @param string $rootPath
1269
	 * @param string $pathPrefix
1270
	 */
1271
	public function testWriteToReadLockedFile($rootPath, $pathPrefix) {
1272
		$rootPath = str_replace('{folder}', 'files', $rootPath);
1273
		$pathPrefix = str_replace('{folder}', 'files', $pathPrefix);
1274
1275
		$view = new \OC\Files\View($rootPath);
1276
		$storage = new Temporary(array());
1277
		\OC\Files\Filesystem::mount($storage, [], '/');
1278
		$this->assertTrue($view->lockFile($pathPrefix . '/foo/bar', ILockingProvider::LOCK_SHARED));
1279
		$view->lockFile($pathPrefix . '/foo/bar', ILockingProvider::LOCK_EXCLUSIVE);
1280
	}
1281
1282
	/**
1283
	 * Writing a file that's being downloaded
@@ 1290-1299 (lines=10) @@
1287
	 * @param string $rootPath
1288
	 * @param string $pathPrefix
1289
	 */
1290
	public function testWriteToReadUnlockableFile($rootPath, $pathPrefix) {
1291
		$rootPath = str_replace('{folder}', 'files_encryption', $rootPath);
1292
		$pathPrefix = str_replace('{folder}', 'files_encryption', $pathPrefix);
1293
1294
		$view = new \OC\Files\View($rootPath);
1295
		$storage = new Temporary(array());
1296
		\OC\Files\Filesystem::mount($storage, [], '/');
1297
		$this->assertFalse($view->lockFile($pathPrefix . '/foo/bar', ILockingProvider::LOCK_SHARED));
1298
		$this->assertFalse($view->lockFile($pathPrefix . '/foo/bar', ILockingProvider::LOCK_EXCLUSIVE));
1299
	}
1300
1301
	/**
1302
	 * Test that locks are on mount point paths instead of mount root