]> source.dussan.org Git - nextcloud-server.git/commitdiff
Fix unique key in test table
authorJoas Schilling <coding@schilljs.com>
Tue, 10 Nov 2020 18:21:08 +0000 (19:21 +0100)
committerJoas Schilling <coding@schilljs.com>
Thu, 12 Nov 2020 11:57:52 +0000 (12:57 +0100)
Signed-off-by: Joas Schilling <coding@schilljs.com>
tests/lib/DB/ConnectionTest.php

index fa4d5fe005c3e287127c7569d0879d99eeb35edc..cab6133c3c08697c57293e222d2220687be608e2 100644 (file)
@@ -220,13 +220,15 @@ class ConnectionTest extends \Test\TestCase {
                        ['user' => 'test2', 'category' => 'Coworkers', 'expectedResult' => 1],
                ];
 
+               $row = 0;
                foreach ($categoryEntries as $entry) {
                        $result = $this->connection->insertIfNotExist('*PREFIX*table',
                                [
                                        'textfield' => $entry['user'],
                                        'clobfield' => $entry['category'],
-                               ]);
-                       $this->assertEquals($entry['expectedResult'], $result);
+                                       'integerfield' => $row++,
+                               ], ['textfield', 'clobfield']);
+                       $this->assertEquals($entry['expectedResult'], $result, json_encode($entry));
                }
 
                $query = $this->connection->prepare('SELECT * FROM `*PREFIX*table`');
@@ -247,13 +249,15 @@ class ConnectionTest extends \Test\TestCase {
                        ['addressbookid' => 123, 'fullname' => 'test', 'expectedResult' => 1],
                ];
 
+               $row = 0;
                foreach ($categoryEntries as $entry) {
                        $result = $this->connection->insertIfNotExist('*PREFIX*table',
                                [
                                        'integerfield_default' => $entry['addressbookid'],
                                        'clobfield' => $entry['fullname'],
-                               ]);
-                       $this->assertEquals($entry['expectedResult'], $result);
+                                       'integerfield' => $row++,
+                               ], ['integerfield_default', 'clobfield']);
+                       $this->assertEquals($entry['expectedResult'], $result, json_encode($entry));
                }
 
                $query = $this->connection->prepare('SELECT * FROM `*PREFIX*table`');