Code Duplication    Length = 17-19 lines in 2 locations

tests/lib/files/cache/watcher.php 1 location

@@ 175-191 (lines=17) @@
172
	 * @param bool $scan
173
	 * @return \OC\Files\Storage\Storage
174
	 */
175
	private function getTestStorage($scan = true) {
176
		$storage = new \OC\Files\Storage\Temporary(array());
177
		$textData = "dummy file data\n";
178
		$imgData = file_get_contents(\OC::$SERVERROOT . '/core/img/logo.png');
179
		$storage->mkdir('folder');
180
		$storage->file_put_contents('foo.txt', $textData);
181
		$storage->file_put_contents('foo.png', $imgData);
182
		$storage->file_put_contents('folder/bar.txt', $textData);
183
		$storage->file_put_contents('folder/bar2.txt', $textData);
184
185
		if ($scan) {
186
			$scanner = $storage->getScanner();
187
			$scanner->scan('');
188
		}
189
		$this->storages[] = $storage;
190
		return $storage;
191
	}
192
}
193

tests/lib/files/view.php 1 location

@@ 513-531 (lines=19) @@
510
	 * @param string $class
511
	 * @return \OC\Files\Storage\Storage
512
	 */
513
	private function getTestStorage($scan = true, $class = '\OC\Files\Storage\Temporary') {
514
		/**
515
		 * @var \OC\Files\Storage\Storage $storage
516
		 */
517
		$storage = new $class(array());
518
		$textData = "dummy file data\n";
519
		$imgData = file_get_contents(\OC::$SERVERROOT . '/core/img/logo.png');
520
		$storage->mkdir('folder');
521
		$storage->file_put_contents('foo.txt', $textData);
522
		$storage->file_put_contents('foo.png', $imgData);
523
		$storage->file_put_contents('folder/bar.txt', $textData);
524
525
		if ($scan) {
526
			$scanner = $storage->getScanner();
527
			$scanner->scan('');
528
		}
529
		$this->storages[] = $storage;
530
		return $storage;
531
	}
532
533
	/**
534
	 * @medium