diff options
author | Bjoern Schiessle <schiessle@owncloud.com> | 2014-07-04 17:37:35 +0200 |
---|---|---|
committer | Bjoern Schiessle <schiessle@owncloud.com> | 2014-10-13 17:27:02 +0200 |
commit | e4fa642e545b4a98bc52513213ec92efdff20331 (patch) | |
tree | 55052b896d1aaf3d9ee415a14e996dbd05b11433 | |
parent | 697f461ded3882b45292258f7e8bc67f3e775309 (diff) | |
download | nextcloud-server-e4fa642e545b4a98bc52513213ec92efdff20331.tar.gz nextcloud-server-e4fa642e545b4a98bc52513213ec92efdff20331.zip |
improved unit tests
-rw-r--r-- | apps/files_encryption/tests/proxy.php | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/apps/files_encryption/tests/proxy.php b/apps/files_encryption/tests/proxy.php index a9eddd1a810..42637a52e04 100644 --- a/apps/files_encryption/tests/proxy.php +++ b/apps/files_encryption/tests/proxy.php @@ -47,6 +47,7 @@ class Test_Encryption_Proxy extends \PHPUnit_Framework_TestCase { public $view; // view in /data/user/files public $rootView; // view on /data/user public $data; + public $dataLong; public $filename; public static function setUpBeforeClass() { @@ -80,6 +81,7 @@ class Test_Encryption_Proxy extends \PHPUnit_Framework_TestCase { // init short data $this->data = 'hats'; + $this->dataLong = file_get_contents(__DIR__ . '/../lib/crypt.php'); $this->filename = 'enc_proxy_tests-' . uniqid() . '.txt'; } @@ -95,17 +97,19 @@ class Test_Encryption_Proxy extends \PHPUnit_Framework_TestCase { */ function testPostFileSize() { - $this->view->file_put_contents($this->filename, $this->data); + $this->view->file_put_contents($this->filename, $this->dataLong); + $size = strlen($this->dataLong); \OC_FileProxy::$enabled = false; - $unencryptedSize = $this->view->filesize($this->filename); + $encryptedSize = $this->view->filesize($this->filename); \OC_FileProxy::$enabled = true; - $encryptedSize = $this->view->filesize($this->filename); + $unencryptedSize = $this->view->filesize($this->filename); - $this->assertTrue($encryptedSize !== $unencryptedSize); + $this->assertTrue($encryptedSize > $unencryptedSize); + $this->assertSame($size, $unencryptedSize); // cleanup $this->view->unlink($this->filename); |