]> source.dussan.org Git - nextcloud-server.git/commitdiff
Skip if dont support 4 bytes UTF8
authorVitor Mattos <vitor@php.rio>
Wed, 12 Jan 2022 16:31:38 +0000 (13:31 -0300)
committerVitor Mattos <vitor@php.rio>
Fri, 21 Jan 2022 11:37:07 +0000 (08:37 -0300)
Signed-off-by: Vitor Mattos <vitor@php.rio>
tests/lib/Comments/ManagerTest.php

index a0033011cb54bdd4fb5fa86ae551a8e22bf03655..e588630a48399891228092d8267a1f50f271649f 100644 (file)
@@ -2,6 +2,7 @@
 
 namespace Test\Comments;
 
+use Doctrine\DBAL\Platforms\MySQLPlatform;
 use OC\Comments\Comment;
 use OC\Comments\Manager;
 use OCP\AppFramework\Utility\ITimeFactory;
@@ -874,12 +875,21 @@ class ManagerTest extends TestCase {
                $this->assertTrue(is_string($manager->resolveDisplayName('planet', 'neptune')));
        }
 
+       private function skipIfNotSupport4ByteUTF() {
+               // 4 byte UTF doesn't work on mysql
+               $params = \OC::$server->get(\OC\DB\Connection::class)->getParams();
+               if (\OC::$server->getDatabaseConnection()->getDatabasePlatform() instanceof MySQLPlatform && $params['charset'] !== 'utf8mb4') {
+                       $this->markTestSkipped('MySQL doesn\'t support 4 byte UTF-8');
+               }
+       }
+
        /**
         * @dataProvider providerTestReactionAddAndDelete
         *
         * @return void
         */
        public function testReactionAddAndDelete(array $comments, array $reactionsExpected) {
+               $this->skipIfNotSupport4ByteUTF();
                $manager = $this->getManager();
                $buffer = [];
                foreach ($comments as $commentData) {
@@ -964,6 +974,7 @@ class ManagerTest extends TestCase {
         * @dataProvider providerTestRetrieveAllReactions
         */
        public function testRetrieveAllReactions(array $comments, array $expected) {
+               $this->skipIfNotSupport4ByteUTF();
                $manager = $this->getManager();
 
                $buffer = [];
@@ -1026,6 +1037,7 @@ class ManagerTest extends TestCase {
         * @dataProvider providerTestRetrieveAllReactionsWithSpecificReaction
         */
        public function testRetrieveAllReactionsWithSpecificReaction(array $comments, string $reaction, array $expected) {
+               $this->skipIfNotSupport4ByteUTF();
                $manager = $this->getManager();
 
                $buffer = [];
@@ -1090,6 +1102,7 @@ class ManagerTest extends TestCase {
         * @dataProvider providerTestGetReactionComment
         */
        public function testGetReactionComment(array $comments, $expected) {
+               $this->skipIfNotSupport4ByteUTF();
                $manager = $this->getManager();
 
                $buffer = [];