diff options
author | kondou <kondou@ts.unde.re> | 2013-08-05 14:47:14 +0200 |
---|---|---|
committer | kondou <kondou@ts.unde.re> | 2013-08-05 14:47:14 +0200 |
commit | a51af395952b428bfbec03e04991849049f32a5d (patch) | |
tree | a5b44997fd693162d055427ca928abe759f43bea /tests/lib/util.php | |
parent | 895d9ba1b9529f0ef7dbb47402324f2f8436fcdb (diff) | |
download | nextcloud-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.php | 30 |
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); |