summaryrefslogtreecommitdiffstats
path: root/tests/lib/largefilehelpergetfilesize.php
diff options
context:
space:
mode:
authorJoas Schilling <nickvergessen@gmx.de>2014-11-05 16:42:19 +0100
committerJoas Schilling <nickvergessen@gmx.de>2014-11-06 17:36:36 +0100
commitf2282e4251585761500a319c10d697e9a1900444 (patch)
tree5d6fac6cda5bed780d2d4d5d558bb239f731b80e /tests/lib/largefilehelpergetfilesize.php
parent216ef617db7b0ed6e717fe92867aa11245a4cece (diff)
downloadnextcloud-server-f2282e4251585761500a319c10d697e9a1900444.tar.gz
nextcloud-server-f2282e4251585761500a319c10d697e9a1900444.zip
Test LargeFileHelperGetFileSize also with ascii only characters
And skip the UTF8 names on Windows as they are not supported
Diffstat (limited to 'tests/lib/largefilehelpergetfilesize.php')
-rw-r--r--tests/lib/largefilehelpergetfilesize.php55
1 files changed, 37 insertions, 18 deletions
diff --git a/tests/lib/largefilehelpergetfilesize.php b/tests/lib/largefilehelpergetfilesize.php
index 58571d641e0..90ecc3dde70 100644
--- a/tests/lib/largefilehelpergetfilesize.php
+++ b/tests/lib/largefilehelpergetfilesize.php
@@ -13,58 +13,77 @@ namespace Test;
* Large files are not considered yet.
*/
class LargeFileHelperGetFileSize extends \PHPUnit_Framework_TestCase {
- protected $filename;
- protected $fileSize;
+ /** @var \OC\LargeFileHelper */
protected $helper;
public function setUp() {
parent::setUp();
- $ds = DIRECTORY_SEPARATOR;
- $this->filename = dirname(__DIR__) . "{$ds}data{$ds}strängé filename (duplicate #2).txt";
- $this->fileSize = 446;
- $this->helper = new \OC\LargeFileHelper;
+ $this->helper = new \OC\LargeFileHelper();
}
- public function testGetFileSizeViaCurl() {
+ public function dataFileNameProvider() {
+ $path = dirname(__DIR__) . DIRECTORY_SEPARATOR . 'data' . DIRECTORY_SEPARATOR;
+
+ $filePaths = array(array($path . 'lorem.txt', 446));
+ if (!\OC_Util::runningOnWindows()) {
+ $filePaths[] = array($path . 'strängé filename (duplicate #2).txt', 446);
+ }
+
+ return $filePaths;
+ }
+
+ /**
+ * @dataProvider dataFileNameProvider
+ */
+ public function testGetFileSizeViaCurl($filename, $fileSize) {
if (!extension_loaded('curl')) {
$this->markTestSkipped(
'The PHP curl extension is required for this test.'
);
}
$this->assertSame(
- $this->fileSize,
- $this->helper->getFileSizeViaCurl($this->filename)
+ $fileSize,
+ $this->helper->getFileSizeViaCurl($filename)
);
}
- public function testGetFileSizeViaCOM() {
+ /**
+ * @dataProvider dataFileNameProvider
+ */
+ public function testGetFileSizeViaCOM($filename, $fileSize) {
if (!extension_loaded('COM')) {
$this->markTestSkipped(
'The PHP Windows COM extension is required for this test.'
);
}
$this->assertSame(
- $this->fileSize,
- $this->helper->getFileSizeViaCOM($this->filename)
+ $fileSize,
+ $this->helper->getFileSizeViaCOM($filename)
);
}
- public function testGetFileSizeViaExec() {
+ /**
+ * @dataProvider dataFileNameProvider
+ */
+ public function testGetFileSizeViaExec($filename, $fileSize) {
if (!\OC_Helper::is_function_enabled('exec')) {
$this->markTestSkipped(
'The exec() function needs to be enabled for this test.'
);
}
$this->assertSame(
- $this->fileSize,
- $this->helper->getFileSizeViaExec($this->filename)
+ $fileSize,
+ $this->helper->getFileSizeViaExec($filename)
);
}
- public function testGetFileSizeNative() {
+ /**
+ * @dataProvider dataFileNameProvider
+ */
+ public function testGetFileSizeNative($filename, $fileSize) {
$this->assertSame(
- $this->fileSize,
- $this->helper->getFileSizeNative($this->filename)
+ $fileSize,
+ $this->helper->getFileSizeNative($filename)
);
}
}