diff options
author | Joas Schilling <coding@schilljs.com> | 2020-11-10 19:21:08 +0100 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2020-11-10 21:39:19 +0100 |
commit | 0c695d97ece66d50d4a131205cf724ed49e8152a (patch) | |
tree | f11151a3d7d147548265d375bfd7caef111ef566 /tests/lib/DB | |
parent | a524e83be0d298f5cecdbb11d9c87dfef68a6a9c (diff) | |
download | nextcloud-server-0c695d97ece66d50d4a131205cf724ed49e8152a.tar.gz nextcloud-server-0c695d97ece66d50d4a131205cf724ed49e8152a.zip |
Fix unique key in test table
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'tests/lib/DB')
-rw-r--r-- | tests/lib/DB/ConnectionTest.php | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/tests/lib/DB/ConnectionTest.php b/tests/lib/DB/ConnectionTest.php index fa4d5fe005c..cab6133c3c0 100644 --- a/tests/lib/DB/ConnectionTest.php +++ b/tests/lib/DB/ConnectionTest.php @@ -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`'); |