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

@@ 573-591 (lines=19) @@
570
	 * @param string $class
571
	 * @return \OC\Files\Storage\Storage
572
	 */
573
	private function getTestStorage($scan = true, $class = '\OC\Files\Storage\Temporary') {
574
		/**
575
		 * @var \OC\Files\Storage\Storage $storage
576
		 */
577
		$storage = new $class(array());
578
		$textData = "dummy file data\n";
579
		$imgData = file_get_contents(\OC::$SERVERROOT . '/core/img/logo.png');
580
		$storage->mkdir('folder');
581
		$storage->file_put_contents('foo.txt', $textData);
582
		$storage->file_put_contents('foo.png', $imgData);
583
		$storage->file_put_contents('folder/bar.txt', $textData);
584
585
		if ($scan) {
586
			$scanner = $storage->getScanner();
587
			$scanner->scan('');
588
		}
589
		$this->storages[] = $storage;
590
		return $storage;
591
	}
592
593
	/**
594
	 * @medium