diff options
Diffstat (limited to 'tests/lib/UtilTest.php')
-rw-r--r-- | tests/lib/UtilTest.php | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/tests/lib/UtilTest.php b/tests/lib/UtilTest.php index 68c56675425..064b73d0b7e 100644 --- a/tests/lib/UtilTest.php +++ b/tests/lib/UtilTest.php @@ -16,7 +16,7 @@ use OC_Util; * @group DB */ class UtilTest extends \Test\TestCase { - public function testGetVersion() { + public function testGetVersion(): void { $version = \OCP\Util::getVersion(); $this->assertTrue(is_array($version)); foreach ($version as $num) { @@ -24,17 +24,17 @@ class UtilTest extends \Test\TestCase { } } - public function testGetVersionString() { + public function testGetVersionString(): void { $version = \OC_Util::getVersionString(); $this->assertTrue(is_string($version)); } - public function testGetEditionString() { + public function testGetEditionString(): void { $edition = \OC_Util::getEditionString(); $this->assertTrue(is_string($edition)); } - public function testSanitizeHTML() { + public function testSanitizeHTML(): void { $badArray = [ 'While it is unusual to pass an array', 'this function actually <blink>supports</blink> it.', @@ -67,13 +67,13 @@ class UtilTest extends \Test\TestCase { $this->assertEquals('This is a good string without HTML.', $result); } - public function testEncodePath() { + public function testEncodePath(): void { $component = '/§#@test%&^ä/-child'; $result = OC_Util::encodePath($component); $this->assertEquals('/%C2%A7%23%40test%25%26%5E%C3%A4/-child', $result); } - public function testIsNonUTF8Locale() { + public function testIsNonUTF8Locale(): void { // OC_Util::isNonUTF8Locale() assumes escapeshellcmd('§') returns '' with non-UTF-8 locale. $locale = setlocale(LC_CTYPE, 0); setlocale(LC_CTYPE, 'C'); @@ -85,7 +85,7 @@ class UtilTest extends \Test\TestCase { setlocale(LC_CTYPE, $locale); } - public function testFileInfoLoaded() { + public function testFileInfoLoaded(): void { $expected = function_exists('finfo_open'); $this->assertEquals($expected, \OC_Util::fileInfoLoaded()); } @@ -95,7 +95,7 @@ class UtilTest extends \Test\TestCase { * but not for default strict email verification that requires a top level domain. * So we check that with strict email verification we fallback to the default */ - public function testGetDefaultEmailAddressStrict() { + public function testGetDefaultEmailAddressStrict(): void { $email = \OCP\Util::getDefaultEmailAddress('no-reply'); $this->assertEquals('no-reply@localhost.localdomain', $email); } @@ -103,7 +103,7 @@ class UtilTest extends \Test\TestCase { /** * If no strict email check is enabled "localhost" should validate as a valid email domain */ - public function testGetDefaultEmailAddress() { + public function testGetDefaultEmailAddress(): void { $config = \OC::$server->getConfig(); $config->setAppValue('core', 'enforce_strict_email_check', 'no'); $email = \OCP\Util::getDefaultEmailAddress('no-reply'); @@ -111,7 +111,7 @@ class UtilTest extends \Test\TestCase { $config->deleteAppValue('core', 'enforce_strict_email_check'); } - public function testGetDefaultEmailAddressFromConfig() { + public function testGetDefaultEmailAddressFromConfig(): void { $config = \OC::$server->getConfig(); $config->setSystemValue('mail_domain', 'example.com'); $email = \OCP\Util::getDefaultEmailAddress('no-reply'); @@ -119,7 +119,7 @@ class UtilTest extends \Test\TestCase { $config->deleteSystemValue('mail_domain'); } - public function testGetConfiguredEmailAddressFromConfig() { + public function testGetConfiguredEmailAddressFromConfig(): void { $config = \OC::$server->getConfig(); $config->setSystemValue('mail_domain', 'example.com'); $config->setSystemValue('mail_from_address', 'owncloud'); @@ -129,7 +129,7 @@ class UtilTest extends \Test\TestCase { $config->deleteSystemValue('mail_from_address'); } - public function testGetInstanceIdGeneratesValidId() { + public function testGetInstanceIdGeneratesValidId(): void { \OC::$server->getConfig()->deleteSystemValue('instanceid'); $instanceId = OC_Util::getInstanceId(); $this->assertStringStartsWith('oc', $instanceId); @@ -140,7 +140,7 @@ class UtilTest extends \Test\TestCase { /** * Test needUpgrade() when the core version is increased */ - public function testNeedUpgradeCore() { + public function testNeedUpgradeCore(): void { $config = \OC::$server->getConfig(); $oldConfigVersion = $config->getSystemValue('version', '0.0.0'); $oldSessionVersion = \OC::$server->getSession()->get('OC_Version'); @@ -160,7 +160,7 @@ class UtilTest extends \Test\TestCase { $this->assertFalse(\OCP\Util::needUpgrade()); } - public function testCheckDataDirectoryValidity() { + public function testCheckDataDirectoryValidity(): void { $dataDir = \OC::$server->getTempManager()->getTemporaryFolder(); touch($dataDir . '/.ncdata'); $errors = \OC_Util::checkDataDirectoryValidity($dataDir); @@ -194,7 +194,7 @@ class UtilTest extends \Test\TestCase { self::invokePrivate(\OCP\Util::class, 'scriptDeps', [[]]); } - public function testAddScript() { + public function testAddScript(): void { \OCP\Util::addScript('first', 'myFirstJSFile'); \OCP\Util::addScript('core', 'myFancyJSFile1'); \OCP\Util::addScript('files', 'myFancyJSFile2', 'core'); @@ -287,7 +287,7 @@ class UtilTest extends \Test\TestCase { } } - public function testAddScriptCircularDependency() { + public function testAddScriptCircularDependency(): void { \OCP\Util::addScript('circular', 'file1', 'dependency'); \OCP\Util::addScript('dependency', 'file2', 'circular'); @@ -296,7 +296,7 @@ class UtilTest extends \Test\TestCase { $this->assertContains('dependency/js/file2', $scripts); } - public function testAddVendorScript() { + public function testAddVendorScript(): void { \OC_Util::addVendorScript('core', 'myFancyJSFile1'); \OC_Util::addVendorScript('myApp', 'myFancyJSFile2'); \OC_Util::addVendorScript('core', 'myFancyJSFile0', true); @@ -313,7 +313,7 @@ class UtilTest extends \Test\TestCase { $this->assertEquals([], \OC_Util::$styles); } - public function testAddTranslations() { + public function testAddTranslations(): void { \OC_Util::addTranslations('appId', 'de'); $this->assertEquals([ @@ -322,7 +322,7 @@ class UtilTest extends \Test\TestCase { $this->assertEquals([], \OC_Util::$styles); } - public function testAddStyle() { + public function testAddStyle(): void { \OC_Util::addStyle('core', 'myFancyCSSFile1'); \OC_Util::addStyle('myApp', 'myFancyCSSFile2'); \OC_Util::addStyle('core', 'myFancyCSSFile0', true); @@ -339,7 +339,7 @@ class UtilTest extends \Test\TestCase { ], \OC_Util::$styles); } - public function testAddVendorStyle() { + public function testAddVendorStyle(): void { \OC_Util::addVendorStyle('core', 'myFancyCSSFile1'); \OC_Util::addVendorStyle('myApp', 'myFancyCSSFile2'); \OC_Util::addVendorStyle('core', 'myFancyCSSFile0', true); @@ -356,7 +356,7 @@ class UtilTest extends \Test\TestCase { ], \OC_Util::$styles); } - public function testShortenMultibyteString() { + public function testShortenMultibyteString(): void { $this->assertEquals('Short nuff', \OCP\Util::shortenMultibyteString('Short nuff', 255)); $this->assertEquals('ABC', \OCP\Util::shortenMultibyteString('ABCDEF', 3)); // each of the characters is 12 bytes |