diff options
author | Joas Schilling <nickvergessen@owncloud.com> | 2015-12-09 09:43:23 +0100 |
---|---|---|
committer | Joas Schilling <nickvergessen@owncloud.com> | 2015-12-09 09:51:33 +0100 |
commit | 5c0be3b565035f173b611f82e0b7ba6bd386b2e0 (patch) | |
tree | 53025aca896beacf9120378bdce3c4d4e2b6f5aa | |
parent | dda9525c4be9f04fd2869b78ff0612c2f57f4e56 (diff) | |
download | nextcloud-server-5c0be3b565035f173b611f82e0b7ba6bd386b2e0.tar.gz nextcloud-server-5c0be3b565035f173b611f82e0b7ba6bd386b2e0.zip |
Fix the last insert id test by changing to an autoincrement table
-rw-r--r-- | tests/lib/db/querybuilder/querybuildertest.php | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/tests/lib/db/querybuilder/querybuildertest.php b/tests/lib/db/querybuilder/querybuildertest.php index c8e029d9e40..de8f84ac345 100644 --- a/tests/lib/db/querybuilder/querybuildertest.php +++ b/tests/lib/db/querybuilder/querybuildertest.php @@ -1124,11 +1124,12 @@ class QueryBuilderTest extends \Test\TestCase { $this->assertTrue(true); } - $qB->insert('appconfig') + $qB->insert('properties') ->values([ - 'appid' => $qB->expr()->literal('testFirstResult'), - 'configkey' => $qB->expr()->literal('testing' . 50), - 'configvalue' => $qB->expr()->literal(100 - 50), + 'userid' => $qB->expr()->literal('testFirstResult'), + 'propertypath' => $qB->expr()->literal('testing'), + 'propertyname' => $qB->expr()->literal('testing'), + 'propertyvalue' => $qB->expr()->literal('testing'), ]) ->execute(); @@ -1136,7 +1137,18 @@ class QueryBuilderTest extends \Test\TestCase { $this->assertNotNull($actual); $this->assertInternalType('int', $actual); - $this->assertEquals($this->connection->lastInsertId('*PREFIX*appconfig'), $actual); + $this->assertEquals($this->connection->lastInsertId('*PREFIX*properties'), $actual); + + $qB->delete('properties') + ->where($qB->expr()->eq('userid', $qB->expr()->literal('testFirstResult'))) + ->execute(); + + try { + $qB->getLastInsertId(); + $this->fail('getLastInsertId() should throw an exception, when being called after delete()'); + } catch (\BadMethodCallException $e) { + $this->assertTrue(true); + } } public function dataGetTableName() { |