Code Duplication    Length = 17-19 lines in 2 locations

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

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

tests/lib/files/view.php 1 location

@@ 596-614 (lines=19) @@
593
	 * @param string $class
594
	 * @return \OC\Files\Storage\Storage
595
	 */
596
	private function getTestStorage($scan = true, $class = '\OC\Files\Storage\Temporary') {
597
		/**
598
		 * @var \OC\Files\Storage\Storage $storage
599
		 */
600
		$storage = new $class(array());
601
		$textData = "dummy file data\n";
602
		$imgData = file_get_contents(\OC::$SERVERROOT . '/core/img/logo.png');
603
		$storage->mkdir('folder');
604
		$storage->file_put_contents('foo.txt', $textData);
605
		$storage->file_put_contents('foo.png', $imgData);
606
		$storage->file_put_contents('folder/bar.txt', $textData);
607
608
		if ($scan) {
609
			$scanner = $storage->getScanner();
610
			$scanner->scan('');
611
		}
612
		$this->storages[] = $storage;
613
		return $storage;
614
	}
615
616
	/**
617
	 * @medium