summaryrefslogtreecommitdiffstats
path: root/tests/lib/util.php
diff options
context:
space:
mode:
authorkondou <kondou@ts.unde.re>2013-08-05 14:47:14 +0200
committerkondou <kondou@ts.unde.re>2013-08-05 14:47:14 +0200
commita51af395952b428bfbec03e04991849049f32a5d (patch)
treea5b44997fd693162d055427ca928abe759f43bea /tests/lib/util.php
parent895d9ba1b9529f0ef7dbb47402324f2f8436fcdb (diff)
downloadnextcloud-server-a51af395952b428bfbec03e04991849049f32a5d.tar.gz
nextcloud-server-a51af395952b428bfbec03e04991849049f32a5d.zip
Add unittests
Unittests for: - search/result - util - preferences
Diffstat (limited to 'tests/lib/util.php')
-rw-r--r--tests/lib/util.php30
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/lib/util.php b/tests/lib/util.php
index a038538d7ea..13aa49c8c6f 100644
--- a/tests/lib/util.php
+++ b/tests/lib/util.php
@@ -7,6 +7,23 @@
*/
class Test_Util extends PHPUnit_Framework_TestCase {
+ public function testGetVersion() {
+ $version = \OC_Util::getVersion();
+ $this->assertTrue(is_array($version));
+ foreach ($version as $num) {
+ $this->assertTrue(is_int($num));
+ }
+ }
+
+ public function testGetVersionString() {
+ $version = \OC_Util::getVersionString();
+ $this->assertTrue(is_string($version));
+ }
+
+ public function testGetEditionString() {
+ $edition = \OC_Util::getEditionString();
+ $this->assertTrue(is_string($edition));
+ }
function testFormatDate() {
date_default_timezone_set("UTC");
@@ -41,6 +58,19 @@ class Test_Util extends PHPUnit_Framework_TestCase {
$this->assertEquals("/%C2%A7%23%40test%25%26%5E%C3%A4/-child", $result);
}
+ public function testFileInfoLoaded() {
+ $expected = function_exists('finfo_open');
+ $this->assertEquals($expected, \OC_Util::fileInfoLoaded());
+ }
+
+ public function testIsInternetConnectionEnabled() {
+ \OC_Config::setValue("has_internet_connection", false);
+ $this->assertFalse(\OC_Util::isInternetConnectionEnabled());
+
+ \OC_Config::setValue("has_internet_connection", true);
+ $this->assertTrue(\OC_Util::isInternetConnectionEnabled());
+ }
+
function testGenerate_random_bytes() {
$result = strlen(OC_Util::generate_random_bytes(59));
$this->assertEquals(59, $result);