|
@@ 230-256 (lines=27) @@
|
| 227 |
|
); |
| 228 |
|
} |
| 229 |
|
|
| 230 |
|
public function testRename() { |
| 231 |
|
|
| 232 |
|
\OC\Files\Filesystem::file_put_contents("test.txt", "test file"); |
| 233 |
|
|
| 234 |
|
$t1 = time(); |
| 235 |
|
// second version is two weeks older, this way we make sure that no |
| 236 |
|
// version will be expired |
| 237 |
|
$t2 = $t1 - 60 * 60 * 24 * 14; |
| 238 |
|
|
| 239 |
|
// create some versions |
| 240 |
|
$v1 = self::USERS_VERSIONS_ROOT . '/test.txt.v' . $t1; |
| 241 |
|
$v2 = self::USERS_VERSIONS_ROOT . '/test.txt.v' . $t2; |
| 242 |
|
$v1Renamed = self::USERS_VERSIONS_ROOT . '/test2.txt.v' . $t1; |
| 243 |
|
$v2Renamed = self::USERS_VERSIONS_ROOT . '/test2.txt.v' . $t2; |
| 244 |
|
|
| 245 |
|
$this->rootView->file_put_contents($v1, 'version1'); |
| 246 |
|
$this->rootView->file_put_contents($v2, 'version2'); |
| 247 |
|
|
| 248 |
|
// execute rename hook of versions app |
| 249 |
|
\OC\Files\Filesystem::rename("test.txt", "test2.txt"); |
| 250 |
|
|
| 251 |
|
$this->assertFalse($this->rootView->file_exists($v1)); |
| 252 |
|
$this->assertFalse($this->rootView->file_exists($v2)); |
| 253 |
|
|
| 254 |
|
$this->assertTrue($this->rootView->file_exists($v1Renamed)); |
| 255 |
|
$this->assertTrue($this->rootView->file_exists($v2Renamed)); |
| 256 |
|
} |
| 257 |
|
|
| 258 |
|
public function testRenameInSharedFolder() { |
| 259 |
|
|
|
@@ 464-490 (lines=27) @@
|
| 461 |
|
$this->assertFalse($this->rootView->file_exists($v2Renamed)); |
| 462 |
|
} |
| 463 |
|
|
| 464 |
|
public function testCopy() { |
| 465 |
|
|
| 466 |
|
\OC\Files\Filesystem::file_put_contents("test.txt", "test file"); |
| 467 |
|
|
| 468 |
|
$t1 = time(); |
| 469 |
|
// second version is two weeks older, this way we make sure that no |
| 470 |
|
// version will be expired |
| 471 |
|
$t2 = $t1 - 60 * 60 * 24 * 14; |
| 472 |
|
|
| 473 |
|
// create some versions |
| 474 |
|
$v1 = self::USERS_VERSIONS_ROOT . '/test.txt.v' . $t1; |
| 475 |
|
$v2 = self::USERS_VERSIONS_ROOT . '/test.txt.v' . $t2; |
| 476 |
|
$v1Copied = self::USERS_VERSIONS_ROOT . '/test2.txt.v' . $t1; |
| 477 |
|
$v2Copied = self::USERS_VERSIONS_ROOT . '/test2.txt.v' . $t2; |
| 478 |
|
|
| 479 |
|
$this->rootView->file_put_contents($v1, 'version1'); |
| 480 |
|
$this->rootView->file_put_contents($v2, 'version2'); |
| 481 |
|
|
| 482 |
|
// execute copy hook of versions app |
| 483 |
|
\OC\Files\Filesystem::copy("test.txt", "test2.txt"); |
| 484 |
|
|
| 485 |
|
$this->assertTrue($this->rootView->file_exists($v1)); |
| 486 |
|
$this->assertTrue($this->rootView->file_exists($v2)); |
| 487 |
|
|
| 488 |
|
$this->assertTrue($this->rootView->file_exists($v1Copied)); |
| 489 |
|
$this->assertTrue($this->rootView->file_exists($v2Copied)); |
| 490 |
|
} |
| 491 |
|
|
| 492 |
|
/** |
| 493 |
|
* test if we find all versions and if the versions array contain |