]> source.dussan.org Git - nextcloud-server.git/commitdiff
Added method to DB and fix test 1820/head
authorRoeland Jago Douma <roeland@famdouma.nl>
Mon, 24 Oct 2016 07:44:33 +0000 (09:44 +0200)
committerRoeland Jago Douma <roeland@famdouma.nl>
Mon, 24 Oct 2016 07:45:04 +0000 (09:45 +0200)
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
lib/private/AppFramework/Db/Db.php
tests/lib/Files/PathVerificationTest.php

index 5fea09747af2f2db79c5d84f16d7ad0b8ff14d47..450549ffdbb4e28bd0762c68d973f2ba846a9266 100644 (file)
@@ -31,6 +31,7 @@ use OCP\DB\QueryBuilder\IQueryBuilder;
 use OCP\IDb;
 use OCP\IDBConnection;
 use OCP\PreConditionNotMetException;
+use Doctrine\DBAL\Platforms\MySqlPlatform;
 
 /**
  * @deprecated use IDBConnection directly, will be removed in ownCloud 10
@@ -300,4 +301,14 @@ class Db implements IDb {
        public function escapeLikeParameter($param) {
                return $this->connection->escapeLikeParameter($param);
        }
+
+       /**
+        * Check whether or not the current database support 4byte wide unicode
+        *
+        * @return bool
+        * @since 9.2.0
+        */
+       public function supports4ByteText() {
+               return $this->connection->supports4ByteText();
+       }
 }
index 992734bdece14ab5ad91b0a074344674e7fd20ce..12285bb7acd4a317d6c88d0a3a6ee4d6ce6499fc 100644 (file)
@@ -9,6 +9,7 @@ namespace Test\Files;
 
 use OC\Files\Storage\Local;
 use OC\Files\View;
+use OCP\Files\InvalidPathException;
 
 /**
  * Class PathVerificationTest
@@ -79,10 +80,15 @@ class PathVerificationTest extends \Test\TestCase {
 
        /**
         * @dataProvider providesAstralPlane
-        * @expectedException \OCP\Files\InvalidPathException
-        * @expectedExceptionMessage 4-byte characters are not supported in file names
         */
        public function testPathVerificationAstralPlane($fileName) {
+               $connection = \OC::$server->getDatabaseConnection();
+
+               if (!$connection->supports4ByteText()) {
+                       $this->expectException(InvalidPathException::class);
+                       $this->expectExceptionMessage('4-byte characters are not supported in file names');
+               }
+
                $this->view->verifyPath('', $fileName);
        }