* 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 testStripPartialFileExtension() { $partFilename = 'testfile.txt.part'; $filename = 'testfile.txt'; $this->assertTrue(Encryption\Helper::isPartialFilePath($partFilename)); $this->assertEquals('testfile.txt', Encryption\Helper::stripPartialFileExtension($partFilename)); $this->assertFalse(Encryption\Helper::isPartialFilePath($filename)); $this->assertEquals('testfile.txt', Encryption\Helper::stripPartialFileExtension($filename)); } /** * @medium */ function testStripPartialFileExtensionWithTransferIdPath() { $partFilename = 'testfile.txt.ocTransferId643653835.part'; $filename = 'testfile.txt'; $this->assertTrue(Encryption\Helper::isPartialFilePath($partFilename)); $this->assertEquals('testfile.txt', Encryption\Helper::stripPartialFileExtension($partFilename)); $this->assertFalse(Encryption\Helper::isPartialFilePath($filename)); $this->assertEquals('testfile.txt', Encryption\Helper::stripPartialFileExtension($filename)); } }