summaryrefslogtreecommitdiffstats
path: root/tests/lib
diff options
context:
space:
mode:
Diffstat (limited to 'tests/lib')
-rw-r--r--tests/lib/datetimeformatter.php6
-rw-r--r--tests/lib/l10n.php18
-rw-r--r--tests/lib/largefilehelpergetfilesize.php9
3 files changed, 29 insertions, 4 deletions
diff --git a/tests/lib/datetimeformatter.php b/tests/lib/datetimeformatter.php
index 4b91c3a1cc7..9a50ee4a257 100644
--- a/tests/lib/datetimeformatter.php
+++ b/tests/lib/datetimeformatter.php
@@ -42,8 +42,7 @@ class DateTimeFormatter extends TestCase {
}
public function formatTimeSpanData() {
- // use the same time all the time, so the tests are reliable when time would switch
- $time = time();
+ $time = 1416916800; // Use a fixed timestamp so we dont switch days/years with the getTimestampAgo
$deL10N = new \OC_L10N('lib', 'de');
return array(
array('seconds ago', $time, $time),
@@ -81,8 +80,7 @@ class DateTimeFormatter extends TestCase {
}
public function formatDateSpanData() {
- // use the same time all the time, so the tests are reliable when time would switch
- $time = time();
+ $time = 1416916800; // Use a fixed timestamp so we dont switch days/years with the getTimestampAgo
$deL10N = new \OC_L10N('lib', 'de');
return array(
// Normal testing
diff --git a/tests/lib/l10n.php b/tests/lib/l10n.php
index 68f43b76f51..2235581add8 100644
--- a/tests/lib/l10n.php
+++ b/tests/lib/l10n.php
@@ -42,6 +42,24 @@ class Test_L10n extends \Test\TestCase {
*/
}
+ public function russianMissingPluralTranslationsData() {
+ return array(
+ array(1, '1 missing plural'),
+ array(2, '2 missing plurals'),
+ array(6, '6 missing plurals'),
+ );
+ }
+
+ /**
+ * @dataProvider russianMissingPluralTranslationsData
+ */
+ public function testRussianMissingPluralTranslations($count, $expected) {
+ $l = new OC_L10N('test');
+ $l->load(OC::$SERVERROOT.'/tests/data/l10n/ru.json');
+
+ $this->assertEquals($expected, (string)$l->n('%n missing plural', '%n missing plurals', $count));
+ }
+
public function testCzechPluralTranslations() {
$l = new OC_L10N('test');
$transFile = OC::$SERVERROOT.'/tests/data/l10n/cs.json';
diff --git a/tests/lib/largefilehelpergetfilesize.php b/tests/lib/largefilehelpergetfilesize.php
index c97b7b32b0f..57bc2381966 100644
--- a/tests/lib/largefilehelpergetfilesize.php
+++ b/tests/lib/largefilehelpergetfilesize.php
@@ -13,6 +13,10 @@ namespace Test;
* Large files are not considered yet.
*/
class LargeFileHelperGetFileSize extends TestCase {
+ /** @var string */
+ protected $filename;
+ /** @var int */
+ protected $fileSize;
/** @var \OC\LargeFileHelper */
protected $helper;
@@ -41,6 +45,11 @@ class LargeFileHelperGetFileSize extends TestCase {
'The PHP curl extension is required for this test.'
);
}
+ if (\OC::$server->getIniWrapper()->getString('open_basedir') !== '') {
+ $this->markTestSkipped(
+ 'The PHP curl extension does not work with the file:// protocol when open_basedir is enabled.'
+ );
+ }
$this->assertSame(
$fileSize,
$this->helper->getFileSizeViaCurl($filename)