blob: 45ef5e9ac491736cf4f49aa131cfe5449b7b3a52 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
<?php
/**
* Copyright (c) 2013 Bjoern Schiessle <schiessle@owncloud.com>
* This file is licensed under the Affero General Public License version 3 or
* later.
* See the COPYING-README file.
*/
require_once __DIR__ . '/../lib/helper.php';
use OCA\Encryption;
/**
* Class Test_Encryption_Helper
*/
class Test_Encryption_Helper extends \PHPUnit_Framework_TestCase {
/**
* @medium
*/
function testFixPartialFilePath() {
$partFilename = 'testfile.txt.part';
$filename = 'testfile.txt';
$this->assertTrue(Encryption\Helper::isPartialFilePath($partFilename));
$this->assertEquals('testfile.txt', Encryption\Helper::fixPartialFilePath($partFilename));
$this->assertFalse(Encryption\Helper::isPartialFilePath($filename));
$this->assertEquals('testfile.txt', Encryption\Helper::fixPartialFilePath($filename));
}
/**
* @medium
*/
function testFixPartialFileWithTransferIdPath() {
$partFilename = 'testfile.txt.ocTransferId643653835.part';
$filename = 'testfile.txt';
$this->assertTrue(Encryption\Helper::isPartialFilePath($partFilename));
$this->assertEquals('testfile.txt', Encryption\Helper::fixPartialFilePath($partFilename));
$this->assertFalse(Encryption\Helper::isPartialFilePath($filename));
$this->assertEquals('testfile.txt', Encryption\Helper::fixPartialFilePath($filename));
}
}
|